OpenCV  2.4.13
Open Source Computer Vision
cv::FileNode Class Reference

#include <core.hpp>

Public Types

enum  {
  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
}
 type of the file storage node More...
 

Public Member Functions

 FileNode ()
 the default constructor More...
 
 FileNode (const CvFileStorage *fs, const CvFileNode *node)
 the full constructor wrapping CvFileNode structure. More...
 
 FileNode (const FileNode &node)
 the copy constructor More...
 
FileNode operator[] (const string &nodename) const
 returns element of a mapping node More...
 
FileNode operator[] (const char *nodename) const
 returns element of a mapping node More...
 
FileNode operator[] (int i) const
 returns element of a sequence node More...
 
int type () const
 returns type of the node More...
 
bool empty () const
 returns true if the node is empty More...
 
bool isNone () const
 returns true if the node is a "none" object More...
 
bool isSeq () const
 returns true if the node is a sequence More...
 
bool isMap () const
 returns true if the node is a mapping More...
 
bool isInt () const
 returns true if the node is an integer More...
 
bool isReal () const
 returns true if the node is a floating-point number More...
 
bool isString () const
 returns true if the node is a text string More...
 
bool isNamed () const
 returns true if the node has a name More...
 
string name () const
 returns the node name or an empty string if the node is nameless More...
 
size_t size () const
 returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise. More...
 
 operator int () const
 returns the node content as an integer. If the node stores floating-point number, it is rounded. More...
 
 operator float () const
 returns the node content as float More...
 
 operator double () const
 returns the node content as double More...
 
 operator string () const
 returns the node content as text string More...
 
CvFileNodeoperator* ()
 returns pointer to the underlying file node More...
 
const CvFileNodeoperator* () const
 returns pointer to the underlying file node More...
 
FileNodeIterator begin () const
 returns iterator pointing to the first node element More...
 
FileNodeIterator end () const
 returns iterator pointing to the element following the last node element More...
 
void readRaw (const string &fmt, uchar *vec, size_t len) const
 reads node elements to the buffer with the specified format More...
 
voidreadObj () const
 reads the registered object and returns pointer to it More...
 

Public Attributes

const CvFileStoragefs
 
const CvFileNodenode
 

Detailed Description

File Storage Node class

The node is used to store each and every element of the file storage opened for reading - from the primitive objects, such as numbers and text strings, to the complex nodes: sequences, mappings and the registered objects.

Note that file nodes are only used for navigating file storages opened for reading. When a file storage is opened for writing, no data is stored in memory after it is written.

Member Enumeration Documentation

anonymous enum

type of the file storage node

Enumerator
NONE 

empty node

INT 

an integer

REAL 

floating-point number

FLOAT 

synonym or REAL

STR 

text string in UTF-8 encoding

STRING 

synonym for STR

REF 

integer of size size_t. Typically used for storing complex dynamic structures where some elements reference the others

SEQ 

sequence

MAP 

mapping

TYPE_MASK 
FLOW 

compact representation of a sequence or mapping. Used only by YAML writer

USER 

a registered object (e.g. a matrix)

EMPTY 

empty structure (sequence or mapping)

NAMED 

the node has a name (i.e. it is element of a mapping)

Constructor & Destructor Documentation

cv::FileNode::FileNode ( )
inline

the default constructor

cv::FileNode::FileNode ( const CvFileStorage fs,
const CvFileNode node 
)
inline

the full constructor wrapping CvFileNode structure.

cv::FileNode::FileNode ( const FileNode node)
inline

the copy constructor

Member Function Documentation

FileNodeIterator cv::FileNode::begin ( ) const
inline

returns iterator pointing to the first node element

bool cv::FileNode::empty ( ) const
inline

returns true if the node is empty

FileNodeIterator cv::FileNode::end ( ) const
inline

returns iterator pointing to the element following the last node element

bool cv::FileNode::isInt ( ) const
inline

returns true if the node is an integer

bool cv::FileNode::isMap ( ) const
inline

returns true if the node is a mapping

bool cv::FileNode::isNamed ( ) const
inline

returns true if the node has a name

bool cv::FileNode::isNone ( ) const
inline

returns true if the node is a "none" object

bool cv::FileNode::isReal ( ) const
inline

returns true if the node is a floating-point number

bool cv::FileNode::isSeq ( ) const
inline

returns true if the node is a sequence

bool cv::FileNode::isString ( ) const
inline

returns true if the node is a text string

string cv::FileNode::name ( ) const

returns the node name or an empty string if the node is nameless

cv::FileNode::operator double ( ) const
inline

returns the node content as double

cv::FileNode::operator float ( ) const
inline

returns the node content as float

cv::FileNode::operator int ( ) const
inline

returns the node content as an integer. If the node stores floating-point number, it is rounded.

cv::FileNode::operator string ( ) const
inline

returns the node content as text string

CvFileNode * cv::FileNode::operator* ( )
inline

returns pointer to the underlying file node

const CvFileNode * cv::FileNode::operator* ( ) const
inline

returns pointer to the underlying file node

FileNode cv::FileNode::operator[] ( const string &  nodename) const

returns element of a mapping node

FileNode cv::FileNode::operator[] ( const char *  nodename) const

returns element of a mapping node

FileNode cv::FileNode::operator[] ( int  i) const

returns element of a sequence node

void* cv::FileNode::readObj ( ) const

reads the registered object and returns pointer to it

void cv::FileNode::readRaw ( const string &  fmt,
uchar vec,
size_t  len 
) const
inline

reads node elements to the buffer with the specified format

size_t cv::FileNode::size ( ) const
inline

returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise.

int cv::FileNode::type ( ) const
inline

returns type of the node

Member Data Documentation

const CvFileStorage* cv::FileNode::fs
const CvFileNode* cv::FileNode::node

The documentation for this class was generated from the following files: