Class: OpenCV::VectorInt

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

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



15677
15678
15679
15680
15681
15682
15683
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15677

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



15674
15675
15676
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15674

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



15669
15670
15671
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15669

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15613

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

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



15657
15658
15659
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15657

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



15648
15649
15650
15651
15652
15653
15654
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15648

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



15663
15664
15665
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15663

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

Instance Method Details

#<<(val) ⇒ Object



15704
15705
15706
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15704

def <<(val)
    push_back(val)
end

#[](size) ⇒ Object

wrapper for int vector_int::operator[](size_t size)



15749
15750
15751
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15749

def [](size)
    Rbind::vector_int_operator_array( self, size)
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)


15688
15689
15690
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15688

def __owner__?
    @__obj_ptr__[:bowner]
end

#at(size) ⇒ Object

wrapper for int vector_int::at(size_t size)



15754
15755
15756
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15754

def at(size)
    Rbind::vector_int_at( self, size)
end

#backObject

wrapper for int vector_int::back()



15764
15765
15766
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15764

def back()
    Rbind::vector_int_back( self)
end

#capacityObject

wrapper for size_t vector_int::capacity()



15734
15735
15736
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15734

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

#dataObject

wrapper for void * vector_int::data()



15769
15770
15771
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15769

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

#each(&block) ⇒ Object



15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15694

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_int::empty()



15739
15740
15741
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15739

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

#frontObject

wrapper for int vector_int::front()



15759
15760
15761
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15759

def front()
    Rbind::vector_int_front( self)
end

#pop_backObject

wrapper for void vector_int::pop_back()



15779
15780
15781
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15779

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

#push_back(other) ⇒ Object

wrapper for void vector_int::push_back(int other)



15774
15775
15776
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15774

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

#reserve(size) ⇒ Object

wrapper for void vector_int::reserve(size_t size)



15744
15745
15746
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15744

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

#resize(size, val = Fixnum) ⇒ Object

methods wrapper for void vector_int::resize(size_t size, int val=int)



15724
15725
15726
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15724

def resize(size, val = Fixnum)
    Rbind::vector_int_resize( self, size, val)
end

#sizeObject

wrapper for size_t vector_int::size()



15729
15730
15731
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15729

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

#swap(other) ⇒ Object

wrapper for void vector_int::swap(vector_int other)



15784
15785
15786
# File 'lib/ruby/ropencv/ropencv_types.rb', line 15784

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