Class: OpenCV::VectorDouble

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

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



19353
19354
19355
19356
19357
19358
19359
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19353

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



19350
19351
19352
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19350

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



19345
19346
19347
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19345

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


19289
19290
19291
19292
19293
19294
19295
19296
19297
19298
19299
19300
19301
19302
19303
19304
19305
19306
19307
19308
19309
19310
19311
19312
19313
19314
19315
19316
19317
19318
19319
19320
19321
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19289

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

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



19333
19334
19335
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19333

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



19324
19325
19326
19327
19328
19329
19330
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19324

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



19339
19340
19341
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19339

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

Instance Method Details

#<<(val) ⇒ Object



19380
19381
19382
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19380

def <<(val)
    push_back(val)
end

#[](size) ⇒ Object

wrapper for double vector_double::operator[](size_t size)



19425
19426
19427
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19425

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


19364
19365
19366
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19364

def __owner__?
    @__obj_ptr__[:bowner]
end

#at(size) ⇒ Object

wrapper for double vector_double::at(size_t size)



19430
19431
19432
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19430

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

#backObject

wrapper for double vector_double::back()



19440
19441
19442
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19440

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

#capacityObject

wrapper for size_t vector_double::capacity()



19410
19411
19412
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19410

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

#dataObject

wrapper for void * vector_double::data()



19445
19446
19447
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19445

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

#each(&block) ⇒ Object



19370
19371
19372
19373
19374
19375
19376
19377
19378
19379
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19370

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



19415
19416
19417
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19415

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

#frontObject

wrapper for double vector_double::front()



19435
19436
19437
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19435

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

#pop_backObject

wrapper for void vector_double::pop_back()



19455
19456
19457
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19455

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

#push_back(other) ⇒ Object

wrapper for void vector_double::push_back(double other)



19450
19451
19452
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19450

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

#reserve(size) ⇒ Object

wrapper for void vector_double::reserve(size_t size)



19420
19421
19422
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19420

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

#resize(size, val = double) ⇒ Object

methods wrapper for void vector_double::resize(size_t size, double val=double)



19400
19401
19402
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19400

def resize(size, val = double)
    Rbind::vector_double_resize( self, size, val)
end

#sizeObject

wrapper for size_t vector_double::size()



19405
19406
19407
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19405

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

#swap(other) ⇒ Object

wrapper for void vector_double::swap(vector_double other)



19460
19461
19462
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19460

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