Class: OpenCV::Cv::FileNode
- Inherits:
-
Object
- Object
- OpenCV::Cv::FileNode
show all
- Extended by:
- FFI::DataConverter
- Includes:
- Enumerable
- Defined in:
- lib/ropencv/ropencv_ruby.rb,
lib/ropencv/ropencv_types.rb
- 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
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
@@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
|
.null ⇒ Object
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
Note:
wrapper for overloaded method []
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__
@@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)
result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__?
return result
rescue TypeError => e
@error = e
end
end
@@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)
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
|
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__?
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
|
#empty ⇒ Bool
Note:
method wrapper for bool cv::FileNode::empty()
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
|
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__?
result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self)
end
result
end
|
#is_int ⇒ Bool
Also known as:
isInt
Note:
method wrapper for bool cv::FileNode::isInt()
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_map ⇒ Bool
Also known as:
isMap
Note:
method wrapper for bool cv::FileNode::isMap()
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_named ⇒ Bool
Also known as:
isNamed
Note:
method wrapper for bool cv::FileNode::isNamed()
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_none ⇒ Bool
Also known as:
isNone
Note:
method wrapper for bool cv::FileNode::isNone()
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_real ⇒ Bool
Also known as:
isReal
Note:
method wrapper for bool cv::FileNode::isReal()
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_seq ⇒ Bool
Also known as:
isSeq
Note:
method wrapper for bool cv::FileNode::isSeq()
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_string ⇒ Bool
Also known as:
isString
Note:
method wrapper for bool cv::FileNode::isString()
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
|
Note:
method wrapper for cv::String cv::FileNode::name()
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__?
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)
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)
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
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)
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)
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
|
#size ⇒ Size_T
Note:
method wrapper for size_t cv::FileNode::size()
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_double ⇒ Object
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_float ⇒ Object
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_int ⇒ Object
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_string ⇒ Object
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_double ⇒ Object
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_float ⇒ Object
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_int ⇒ Object
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_mat ⇒ Object
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_s ⇒ Object
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_string ⇒ Object
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
|
#type ⇒ Fixnum
Note:
method wrapper for int cv::FileNode::type()
11253
11254
11255
11256
|
# File 'lib/ropencv/ropencv_types.rb', line 11253
def type()
__validate_pointer__
Rbind::cv_file_node_type( self)
end
|