Class: OpenCV::VectorString

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

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



16224
16225
16226
16227
16228
16229
16230
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16224

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



16221
16222
16223
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16221

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



16216
16217
16218
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16216

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16160

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

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



16204
16205
16206
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16204

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



16195
16196
16197
16198
16199
16200
16201
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16195

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



16210
16211
16212
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16210

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

Instance Method Details

#<<(val) ⇒ Object



16251
16252
16253
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16251

def <<(val)
    push_back(val)
end

#[](size) ⇒ Object

wrapper for cv::String vector_string::operator[](size_t size)



16296
16297
16298
16299
16300
16301
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16296

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


16235
16236
16237
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16235

def __owner__?
    @__obj_ptr__[:bowner]
end

#at(size) ⇒ Object

wrapper for cv::String vector_string::at(size_t size)



16304
16305
16306
16307
16308
16309
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16304

def at(size)
    result = Rbind::vector_string_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::String vector_string::back()



16320
16321
16322
16323
16324
16325
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16320

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



16281
16282
16283
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16281

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

#dataObject

wrapper for void * vector_string::data()



16328
16329
16330
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16328

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

#each(&block) ⇒ Object



16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16241

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



16286
16287
16288
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16286

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

#frontObject

wrapper for cv::String vector_string::front()



16312
16313
16314
16315
16316
16317
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16312

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



16338
16339
16340
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16338

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

#push_back(other) ⇒ Object

wrapper for void vector_string::push_back(const cv::String other)



16333
16334
16335
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16333

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

#reserve(size) ⇒ Object

wrapper for void vector_string::reserve(size_t size)



16291
16292
16293
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16291

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

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

methods wrapper for void vector_string::resize(size_t size, const cv::String val=cv::String)



16271
16272
16273
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16271

def resize(size, val = cv::String)
    Rbind::vector_string_resize( self, size, val)
end

#sizeObject

wrapper for size_t vector_string::size()



16276
16277
16278
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16276

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

#swap(other) ⇒ Object

wrapper for void vector_string::swap(vector_string other)



16343
16344
16345
# File 'lib/ruby/ropencv/ropencv_types.rb', line 16343

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