Class: OpenCV::VectorPoint

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ VectorPoint

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



15878
15879
15880
15881
15882
15883
15884
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15878

def initialize(ptr)
    @__obj_ptr__ = if ptr.is_a? VectorPointStruct
                       ptr
                   else
                       VectorPointStruct.new(FFI::AutoPointer.new(ptr,VectorPointStruct.method(:release)))
                   end
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.



15875
15876
15877
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15875

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



15870
15871
15872
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15870

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15814

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

    # wrapper for vector_Point::vector_Point(const vector_Point other)
    @@vector_point_vector_point2_defaults1 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@vector_point_vector_point2_defaults1[i]
        end
        begin
            return Rbind::vector_point_vector_point2(*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.



15858
15859
15860
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15858

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



15849
15850
15851
15852
15853
15854
15855
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15849

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



15864
15865
15866
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15864

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

Instance Method Details

#<<(val) ⇒ Object



15905
15906
15907
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15905

def <<(val)
    push_back(val)
end

#[](size) ⇒ Object

wrapper for cv::Point vector_Point::operator[](size_t size)



15950
15951
15952
15953
15954
15955
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15950

def [](size)
    result = Rbind::vector_point_operator_array( self, size)
    # 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

#__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)


15889
15890
15891
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15889

def __owner__?
    @__obj_ptr__[:bowner]
end

#at(size) ⇒ Object

wrapper for cv::Point vector_Point::at(size_t size)



15958
15959
15960
15961
15962
15963
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15958

def at(size)
    result = Rbind::vector_point_at( self, size)
    # 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

#backObject

wrapper for cv::Point vector_Point::back()



15974
15975
15976
15977
15978
15979
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15974

def back()
    result = Rbind::vector_point_back( 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

#capacityObject

wrapper for size_t vector_Point::capacity()



15935
15936
15937
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15935

def capacity()
    Rbind::vector_point_capacity( self)
end

#dataObject

wrapper for void * vector_Point::data()



15982
15983
15984
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15982

def data()
    Rbind::vector_point_data( self)
end

#each(&block) ⇒ Object



15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15895

def each(&block)
    if block
         s = size
         0.upto(s-1) do |i|
             yield self[i]
         end
    else
        Enumerator.new(self)
    end
end

#emptyObject

wrapper for bool vector_Point::empty()



15940
15941
15942
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15940

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

#frontObject

wrapper for cv::Point vector_Point::front()



15966
15967
15968
15969
15970
15971
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15966

def front()
    result = Rbind::vector_point_front( 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

#pop_backObject

wrapper for void vector_Point::pop_back()



15992
15993
15994
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15992

def pop_back()
    Rbind::vector_point_pop_back( self)
end

#push_back(other) ⇒ Object

wrapper for void vector_Point::push_back(const cv::Point other)



15987
15988
15989
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15987

def push_back(other)
    Rbind::vector_point_push_back( self, other)
end

#reserve(size) ⇒ Object

wrapper for void vector_Point::reserve(size_t size)



15945
15946
15947
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15945

def reserve(size)
    Rbind::vector_point_reserve( self, size)
end

#resize(size, val = cv::Point) ⇒ Object

methods wrapper for void vector_Point::resize(size_t size, const cv::Point val=cv::Point)



15925
15926
15927
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15925

def resize(size, val = cv::Point)
    Rbind::vector_point_resize( self, size, val)
end

#sizeObject

wrapper for size_t vector_Point::size()



15930
15931
15932
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15930

def size()
    Rbind::vector_point_size( self)
end

#swap(other) ⇒ Object

wrapper for void vector_Point::swap(vector_Point other)



15997
15998
15999
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15997

def swap(other)
    Rbind::vector_point_swap( self, other)
end