Class: OpenCV::VectorFloat

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

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



16437
16438
16439
16440
16441
16442
16443
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16437

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



16434
16435
16436
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16434

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



16429
16430
16431
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16429

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16373

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

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



16417
16418
16419
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16417

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



16408
16409
16410
16411
16412
16413
16414
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16408

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



16423
16424
16425
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16423

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

Instance Method Details

#<<(val) ⇒ Object



16464
16465
16466
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16464

def <<(val)
    push_back(val)
end

#[](size) ⇒ Object

wrapper for float vector_float::operator[](size_t size)



16509
16510
16511
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16509

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


16448
16449
16450
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16448

def __owner__?
    @__obj_ptr__[:bowner]
end

#at(size) ⇒ Object

wrapper for float vector_float::at(size_t size)



16514
16515
16516
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16514

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

#backObject

wrapper for float vector_float::back()



16524
16525
16526
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16524

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

#capacityObject

wrapper for size_t vector_float::capacity()



16494
16495
16496
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16494

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

#dataObject

wrapper for void * vector_float::data()



16529
16530
16531
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16529

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

#each(&block) ⇒ Object



16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16454

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



16499
16500
16501
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16499

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

#frontObject

wrapper for float vector_float::front()



16519
16520
16521
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16519

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

#pop_backObject

wrapper for void vector_float::pop_back()



16539
16540
16541
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16539

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

#push_back(other) ⇒ Object

wrapper for void vector_float::push_back(float other)



16534
16535
16536
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16534

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

#reserve(size) ⇒ Object

wrapper for void vector_float::reserve(size_t size)



16504
16505
16506
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16504

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

#resize(size, val = loat) ⇒ Object

methods wrapper for void vector_float::resize(size_t size, float val=float)



16484
16485
16486
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16484

def resize(size, val = loat)
    Rbind::vector_float_resize( self, size, val)
end

#sizeObject

wrapper for size_t vector_float::size()



16489
16490
16491
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16489

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

#swap(other) ⇒ Object

wrapper for void vector_float::swap(vector_float other)



16544
16545
16546
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16544

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