Class: OpenCV::PtrAlgorithm

Inherits:
Object
  • Object
show all
Extended by:
FFI::DataConverter
Defined in:
lib/ruby/ropencv/ropencv_types.rb

Instance Attribute Summary collapse

Sepcializing collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ PtrAlgorithm

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of PtrAlgorithm.



16078
16079
16080
16081
16082
16083
16084
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16078

def initialize(ptr)
    @__obj_ptr__ = if ptr.is_a? PtrAlgorithmStruct
                       ptr
                   else
                       PtrAlgorithmStruct.new(FFI::AutoPointer.new(ptr,PtrAlgorithmStruct.method(:release)))
                   end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



16094
16095
16096
16097
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16094

def method_missing(m,*args)
    raise "Ptr #<Rbind::RPtr:0x007f84c212a2c0> is empty. Cannot call #{m} on it!" if empty
    obj.method(m).call(*args)
end

Instance Attribute Details

#__obj_ptr__Object (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16075
16076
16077
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16075

def __obj_ptr__
  @__obj_ptr__
end

Class Method Details

.from_native(ptr, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

can be overwritten by the user



16070
16071
16072
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16070

def self.from_native(ptr,context)
    rbind_from_native(ptr,context)
end

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16027

def self.new(*args)
    if args.first.is_a?(FFI::Pointer) || args.first.is_a?(PtrAlgorithmStruct)
        raise ArgumentError, "too many arguments for creating #{self.name} from Pointer" unless args.size == 1
        return super(args.first)
    end
    # wrapper for Ptr_Algorithm::Ptr_Algorithm(const Ptr_Algorithm other)
    @@ptr_algorithm_ptr_algorithm_defaults0 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@ptr_algorithm_ptr_algorithm_defaults0[i]
        end
        begin
            return Rbind::ptr_algorithm_ptr_algorithm(*args)
        rescue TypeError => e
            @error = e
        end
    end

    raise ArgumentError, "no constructor for #{self}(#{args.inspect})"
end

.rbind_from_native(ptr, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16058
16059
16060
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16058

def self.rbind_from_native(ptr,context)
    PtrAlgorithm.new(ptr)
end

.rbind_to_native(obj, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16049
16050
16051
16052
16053
16054
16055
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16049

def self.rbind_to_native(obj,context)
    if obj.is_a? PtrAlgorithm
        obj.__obj_ptr__
    else
        raise TypeError, "expected kind of #{name}, was #{obj.class}"
    end
end

.to_native(obj, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

can be overwritten by the user



16064
16065
16066
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16064

def self.to_native(obj,context)
    rbind_to_native(obj,context)
end

Instance Method Details

#__owner__?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

returns true if the underlying pointer is owner of the real object

Returns:

  • (Boolean)


16089
16090
16091
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16089

def __owner__?
    @__obj_ptr__[:bowner]
end

#addrefObject

methods wrapper for void Ptr_Algorithm::addref()



16107
16108
16109
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16107

def addref()
    Rbind::ptr_algorithm_addref( self)
end

#delete_objObject

wrapper for void Ptr_Algorithm::delete_obj()



16117
16118
16119
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16117

def delete_obj()
    Rbind::ptr_algorithm_delete_obj( self)
end

#emptyObject

wrapper for bool Ptr_Algorithm::empty()



16122
16123
16124
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16122

def empty()
    Rbind::ptr_algorithm_empty( self)
end

#objObject

wrapper for const cv::Algorithm *obj



16127
16128
16129
16130
16131
16132
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16127

def obj()
    result = Rbind::ptr_algorithm_get_obj( self)
    # store owner insight the pointer to not get garbage collected
    result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__?
    result
end

#releaseObject

wrapper for void Ptr_Algorithm::release()



16112
16113
16114
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16112

def release()
    Rbind::ptr_algorithm_release( self)
end