Class: OpenCV::VectorRect

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

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



19140
19141
19142
19143
19144
19145
19146
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19140

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



19137
19138
19139
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19137

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



19132
19133
19134
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19132

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


19076
19077
19078
19079
19080
19081
19082
19083
19084
19085
19086
19087
19088
19089
19090
19091
19092
19093
19094
19095
19096
19097
19098
19099
19100
19101
19102
19103
19104
19105
19106
19107
19108
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19076

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

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



19120
19121
19122
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19120

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



19111
19112
19113
19114
19115
19116
19117
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19111

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



19126
19127
19128
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19126

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

Instance Method Details

#<<(val) ⇒ Object



19167
19168
19169
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19167

def <<(val)
    push_back(val)
end

#[](size) ⇒ Object

wrapper for cv::Rect vector_Rect::operator[](size_t size)



19212
19213
19214
19215
19216
19217
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19212

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


19151
19152
19153
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19151

def __owner__?
    @__obj_ptr__[:bowner]
end

#at(size) ⇒ Object

wrapper for cv::Rect vector_Rect::at(size_t size)



19220
19221
19222
19223
19224
19225
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19220

def at(size)
    result = Rbind::vector_rect_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::Rect vector_Rect::back()



19236
19237
19238
19239
19240
19241
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19236

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



19197
19198
19199
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19197

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

#dataObject

wrapper for void * vector_Rect::data()



19244
19245
19246
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19244

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

#each(&block) ⇒ Object



19157
19158
19159
19160
19161
19162
19163
19164
19165
19166
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19157

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



19202
19203
19204
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19202

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

#frontObject

wrapper for cv::Rect vector_Rect::front()



19228
19229
19230
19231
19232
19233
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19228

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



19254
19255
19256
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19254

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

#push_back(other) ⇒ Object

wrapper for void vector_Rect::push_back(const cv::Rect other)



19249
19250
19251
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19249

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

#reserve(size) ⇒ Object

wrapper for void vector_Rect::reserve(size_t size)



19207
19208
19209
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19207

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

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

methods wrapper for void vector_Rect::resize(size_t size, const cv::Rect val=cv::Rect)



19187
19188
19189
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19187

def resize(size, val = cv::Rect)
    Rbind::vector_rect_resize( self, size, val)
end

#sizeObject

wrapper for size_t vector_Rect::size()



19192
19193
19194
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19192

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

#swap(other) ⇒ Object

wrapper for void vector_Rect::swap(vector_Rect other)



19259
19260
19261
# File 'lib/ruby/ropencv/ropencv_types.rb', line 19259

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