Class: OpenCV::Cv::FileNode

Inherits:
Object
  • Object
show all
Extended by:
FFI::DataConverter
Includes:
Enumerable
Defined in:
lib/ropencv/ropencv_ruby.rb,
lib/ropencv/ropencv_types.rb

Constants collapse

NONE =
0
INT =
1
REAL =
2
FLOAT =
REAL
STR =
3
STRING =
STR
REF =
4
SEQ =
5
MAP =
6
TYPE_MASK =
7
FLOW =
8
USER =
16
EMPTY =
32
NAMED =
64

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



309
310
311
312
313
314
315
# File 'lib/ropencv/ropencv_ruby.rb', line 309

def method_missing(m,*args)
    if args.empty? && map?
        self[m.to_s]
    else
        super
    end
end

Class Method Details

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
# File 'lib/ropencv/ropencv_types.rb', line 11031

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

    raise ArgumentError, "no constructor for #{self}(#{args.inspect})"
end

.nullObject

returns a null pointer to the object



11027
11028
11029
# File 'lib/ropencv/ropencv_types.rb', line 11027

def self.null
    new(FileNodeStruct.new)
end

Instance Method Details

#[](nodename) ⇒ Cv::FileNode #[](i) ⇒ Cv::FileNode

Note:

wrapper for overloaded method []

Overloads:

Raises:

  • (ArgumentError)


11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
# File 'lib/ropencv/ropencv_types.rb', line 11212

def [](*args)
    __validate_pointer__
    # overloaded method wrapper for cv::FileNode cv::FileNode::operator[](c_string nodename)
    @@cv_file_node_operator_array_defaults0 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        targs = args.clone
        targs.size.upto(0) do |i|
            targs[i] = @@cv_file_node_operator_array_defaults0[i]
        end
        begin
                result = Rbind::cv_file_node_operator_array(self,*targs)
            # store owner insight the pointer to not get garbage collected
            result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__?
            return result
        rescue TypeError => e
            @error = e
        end
    end

    # overloaded method wrapper for cv::FileNode cv::FileNode::operator[](int i)
    @@cv_file_node_operator_array2_defaults1 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        targs = args.clone
        targs.size.upto(0) do |i|
            targs[i] = @@cv_file_node_operator_array2_defaults1[i]
        end
        begin
                result = Rbind::cv_file_node_operator_array2(self,*targs)
            # store owner insight the pointer to not get garbage collected
            result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__?
            return result
        rescue TypeError => e
            @error = e
        end
    end

    raise ArgumentError, "No overloaded signature fits to: #{args.map(&:class)}"
end

#beginCv::FileNodeIterator

Note:

method wrapper for cv::FileNodeIterator cv::FileNode::begin()



11182
11183
11184
11185
11186
11187
11188
11189
11190
# File 'lib/ropencv/ropencv_types.rb', line 11182

def begin()
    __validate_pointer__
    result = Rbind::cv_file_node_begin( self)
    if result.respond_to?(:__owner__?) && !result.__owner__?
    # store owner insight the pointer to not get garbage collected
        result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) 
    end
    result
end

#each(&block) ⇒ Object



237
238
239
240
241
242
243
244
245
246
247
# File 'lib/ropencv/ropencv_ruby.rb', line 237

def each(&block)
    if block_given?
        iter = self.begin()
        while(iter != self.end())
            yield(iter.to_node)
            iter.plusplus_operator
        end
    else
        to_enum(:each)
    end
end

#emptyBool

Note:

method wrapper for bool cv::FileNode::empty()

Returns:

  • (Bool)


11260
11261
11262
11263
# File 'lib/ropencv/ropencv_types.rb', line 11260

def empty()
    __validate_pointer__
    Rbind::cv_file_node_empty( self)
end

#empty?Object



230
# File 'lib/ropencv/ropencv_ruby.rb', line 230

alias :empty? :empty

#endCv::FileNodeIterator

Note:

method wrapper for cv::FileNodeIterator cv::FileNode::end()



11194
11195
11196
11197
11198
11199
11200
11201
11202
# File 'lib/ropencv/ropencv_types.rb', line 11194

def end()
    __validate_pointer__
    result = Rbind::cv_file_node_end( self)
    if result.respond_to?(:__owner__?) && !result.__owner__?
    # store owner insight the pointer to not get garbage collected
        result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) 
    end
    result
end

#is_intBool Also known as: isInt

Note:

method wrapper for bool cv::FileNode::isInt()

Returns:

  • (Bool)


11291
11292
11293
11294
# File 'lib/ropencv/ropencv_types.rb', line 11291

def is_int()
    __validate_pointer__
    Rbind::cv_file_node_is_int( self)
end

#is_mapBool Also known as: isMap

Note:

method wrapper for bool cv::FileNode::isMap()

Returns:

  • (Bool)


11283
11284
11285
11286
# File 'lib/ropencv/ropencv_types.rb', line 11283

def is_map()
    __validate_pointer__
    Rbind::cv_file_node_is_map( self)
end

#is_namedBool Also known as: isNamed

Note:

method wrapper for bool cv::FileNode::isNamed()

Returns:

  • (Bool)


11315
11316
11317
11318
# File 'lib/ropencv/ropencv_types.rb', line 11315

def is_named()
    __validate_pointer__
    Rbind::cv_file_node_is_named( self)
end

#is_noneBool Also known as: isNone

Note:

method wrapper for bool cv::FileNode::isNone()

Returns:

  • (Bool)


11267
11268
11269
11270
# File 'lib/ropencv/ropencv_types.rb', line 11267

def is_none()
    __validate_pointer__
    Rbind::cv_file_node_is_none( self)
end

#is_realBool Also known as: isReal

Note:

method wrapper for bool cv::FileNode::isReal()

Returns:

  • (Bool)


11299
11300
11301
11302
# File 'lib/ropencv/ropencv_types.rb', line 11299

def is_real()
    __validate_pointer__
    Rbind::cv_file_node_is_real( self)
end

#is_seqBool Also known as: isSeq

Note:

method wrapper for bool cv::FileNode::isSeq()

Returns:

  • (Bool)


11275
11276
11277
11278
# File 'lib/ropencv/ropencv_types.rb', line 11275

def is_seq()
    __validate_pointer__
    Rbind::cv_file_node_is_seq( self)
end

#is_stringBool Also known as: isString

Note:

method wrapper for bool cv::FileNode::isString()

Returns:

  • (Bool)


11307
11308
11309
11310
# File 'lib/ropencv/ropencv_types.rb', line 11307

def is_string()
    __validate_pointer__
    Rbind::cv_file_node_is_string( self)
end

#nameCv::String

Note:

method wrapper for cv::String cv::FileNode::name()

Returns:



11323
11324
11325
11326
11327
11328
11329
11330
11331
# File 'lib/ropencv/ropencv_types.rb', line 11323

def name()
    __validate_pointer__
    result = Rbind::cv_file_node_name( self)
    if result.respond_to?(:__owner__?) && !result.__owner__?
    # store owner insight the pointer to not get garbage collected
        result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) 
    end
    result
end

#read_double(val) ⇒ Void

Note:

method wrapper for void cv::FileNode::operator>>(double& val)

Parameters:

  • val (FFI::MemoryPointer)

Returns:

  • (Void)


11159
11160
11161
11162
# File 'lib/ropencv/ropencv_types.rb', line 11159

def read_double(val)
    __validate_pointer__
    Rbind::cv_file_node_read_double( self, val)
end

#read_float(val) ⇒ Void

Note:

method wrapper for void cv::FileNode::operator>>(float& val)

Parameters:

  • val (FFI::MemoryPointer)

Returns:

  • (Void)


11151
11152
11153
11154
# File 'lib/ropencv/ropencv_types.rb', line 11151

def read_float(val)
    __validate_pointer__
    Rbind::cv_file_node_read_float( self, val)
end

#read_int(val) ⇒ Void

Note:

method wrapper for void cv::FileNode::operator>>(int& val)

methods

Parameters:

  • val (FFI::MemoryPointer)

Returns:

  • (Void)


11143
11144
11145
11146
# File 'lib/ropencv/ropencv_types.rb', line 11143

def read_int(val)
    __validate_pointer__
    Rbind::cv_file_node_read_int( self, val)
end

#read_mat(val) ⇒ Void

Note:

method wrapper for void cv::FileNode::operator>>(cv::Mat& val)

Parameters:

Returns:

  • (Void)


11175
11176
11177
11178
# File 'lib/ropencv/ropencv_types.rb', line 11175

def read_mat(val)
    __validate_pointer__
    Rbind::cv_file_node_read_mat( self, val)
end

#read_string(val) ⇒ Void

Note:

method wrapper for void cv::FileNode::operator>>(cv::String& val)

Parameters:

Returns:

  • (Void)


11167
11168
11169
11170
# File 'lib/ropencv/ropencv_types.rb', line 11167

def read_string(val)
    __validate_pointer__
    Rbind::cv_file_node_read_string( self, val)
end

#sizeSize_T

Note:

method wrapper for size_t cv::FileNode::size()

Returns:

  • (Size_T)


11335
11336
11337
11338
# File 'lib/ropencv/ropencv_types.rb', line 11335

def size()
    __validate_pointer__
    Rbind::cv_file_node_size( self)
end

#to_array_of_doubleObject

Raises:

  • (RuntimeError)


259
260
261
262
# File 'lib/ropencv/ropencv_ruby.rb', line 259

def to_array_of_double
    raise RuntimeError, "FileNode is not the root node of a sequence" unless seq?
    map(&:to_double)
end

#to_array_of_floatObject

Raises:

  • (RuntimeError)


254
255
256
257
# File 'lib/ropencv/ropencv_ruby.rb', line 254

def to_array_of_float
    raise RuntimeError, "FileNode is not the root node of a sequence" unless seq?
    map(&:to_float)
end

#to_array_of_intObject

Raises:

  • (RuntimeError)


249
250
251
252
# File 'lib/ropencv/ropencv_ruby.rb', line 249

def to_array_of_int
    raise RuntimeError, "FileNode is not the root node of a sequence" unless seq?
    map(&:to_int)
end

#to_array_of_stringObject

Raises:

  • (RuntimeError)


264
265
266
267
# File 'lib/ropencv/ropencv_ruby.rb', line 264

def to_array_of_string
    raise RuntimeError, "FileNode is not the root node of a sequence" unless seq?
    map(&:to_string)
end

#to_doubleObject

Raises:

  • (RuntimeError)


285
286
287
288
289
290
291
# File 'lib/ropencv/ropencv_ruby.rb', line 285

def to_double
    raise RuntimeError, "FileNode is empty" if empty?
    raise RuntimeError, "FileNode is not storing a double" unless isReal
    p = FFI::MemoryPointer.new(:uchar,8)
    read_double(p)
    p.get_float64 0
end

#to_floatObject

Raises:

  • (RuntimeError)


277
278
279
280
281
282
283
# File 'lib/ropencv/ropencv_ruby.rb', line 277

def to_float
    raise RuntimeError, "FileNode is empty" if empty?
    raise RuntimeError, "FileNode is not storing a float" unless isReal
    p = FFI::MemoryPointer.new(:float,1)
    read_float(p)
    p.get_float32 0
end

#to_intObject

Raises:

  • (RuntimeError)


293
294
295
296
297
298
299
# File 'lib/ropencv/ropencv_ruby.rb', line 293

def to_int
    raise RuntimeError, "FileNode is empty" if empty?
    raise RuntimeError, "FileNode is not storing a double" unless isInt
    p = FFI::MemoryPointer.new(:int,1)
    read_int(p)
    p.get_int32 0
end

#to_matObject

Raises:

  • (RuntimeError)


269
270
271
272
273
274
275
# File 'lib/ropencv/ropencv_ruby.rb', line 269

def to_mat
    raise RuntimeError, "FileNode is empty" if empty?
    raise RuntimeError, "FileNode is not storing a Mat" unless isMap
    val = Cv::Mat.new
    read_mat(val)
    val
end

#to_sObject

converts FileNode into a string by crawling through all its attributes



11117
11118
11119
# File 'lib/ropencv/ropencv_types.rb', line 11117

def to_s
    "#<cv::FileNode >"
end

#to_stringObject

Raises:

  • (RuntimeError)


301
302
303
304
305
306
307
# File 'lib/ropencv/ropencv_ruby.rb', line 301

def to_string
    raise RuntimeError, "FileNode is empty" if empty?
    raise RuntimeError, "FileNode is not storing a string" unless isString
    str = Cv::String.new
    read_string(str)
    str
end

#typeFixnum

Note:

method wrapper for int cv::FileNode::type()

Returns:

  • (Fixnum)


11253
11254
11255
11256
# File 'lib/ropencv/ropencv_types.rb', line 11253

def type()
    __validate_pointer__
    Rbind::cv_file_node_type( self)
end