Class: OpenCV::PtrFeature2D

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) ⇒ PtrFeature2D

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 PtrFeature2D.



17956
17957
17958
17959
17960
17961
17962
# File 'lib/ruby/ropencv/ropencv_types.rb', line 17956

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



17972
17973
17974
17975
# File 'lib/ruby/ropencv/ropencv_types.rb', line 17972

def method_missing(m,*args)
    raise "Ptr #<Rbind::RPtr:0x007f84c212fa18> 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.



17953
17954
17955
# File 'lib/ruby/ropencv/ropencv_types.rb', line 17953

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



17948
17949
17950
# File 'lib/ruby/ropencv/ropencv_types.rb', line 17948

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


17905
17906
17907
17908
17909
17910
17911
17912
17913
17914
17915
17916
17917
17918
17919
17920
17921
17922
17923
17924
# File 'lib/ruby/ropencv/ropencv_types.rb', line 17905

def self.new(*args)
    if args.first.is_a?(FFI::Pointer) || args.first.is_a?(PtrFeature2DStruct)
        raise ArgumentError, "too many arguments for creating #{self.name} from Pointer" unless args.size == 1
        return super(args.first)
    end
    # wrapper for Ptr_Feature2D::Ptr_Feature2D(const Ptr_Feature2D other)
    @@ptr_feature2d_ptr_feature2d_defaults0 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@ptr_feature2d_ptr_feature2d_defaults0[i]
        end
        begin
            return Rbind::ptr_feature2d_ptr_feature2d(*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.



17936
17937
17938
# File 'lib/ruby/ropencv/ropencv_types.rb', line 17936

def self.rbind_from_native(ptr,context)
    PtrFeature2D.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.



17927
17928
17929
17930
17931
17932
17933
# File 'lib/ruby/ropencv/ropencv_types.rb', line 17927

def self.rbind_to_native(obj,context)
    if obj.is_a? PtrFeature2D
        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



17942
17943
17944
# File 'lib/ruby/ropencv/ropencv_types.rb', line 17942

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)


17967
17968
17969
# File 'lib/ruby/ropencv/ropencv_types.rb', line 17967

def __owner__?
    @__obj_ptr__[:bowner]
end

#addrefObject

methods wrapper for void Ptr_Feature2D::addref()



17985
17986
17987
# File 'lib/ruby/ropencv/ropencv_types.rb', line 17985

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

#delete_objObject

wrapper for void Ptr_Feature2D::delete_obj()



17995
17996
17997
# File 'lib/ruby/ropencv/ropencv_types.rb', line 17995

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

#emptyObject

wrapper for bool Ptr_Feature2D::empty()



18000
18001
18002
# File 'lib/ruby/ropencv/ropencv_types.rb', line 18000

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

#objObject

wrapper for const cv::Feature2D *obj



18005
18006
18007
18008
18009
18010
# File 'lib/ruby/ropencv/ropencv_types.rb', line 18005

def obj()
    result = Rbind::ptr_feature2d_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_Feature2D::release()



17990
17991
17992
# File 'lib/ruby/ropencv/ropencv_types.rb', line 17990

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