OpenCV  4.0.0
Open Source Computer Vision
Public Member Functions | Protected Attributes | List of all members
cv::FileNodeIterator Class Reference

used to iterate through sequences and mappings. More...

#include "persistence.hpp"

Public Member Functions

 FileNodeIterator ()
 The constructors. More...
 
 FileNodeIterator (const FileNode &node, bool seekEnd)
 
 FileNodeIterator (const FileNodeIterator &it)
 
bool equalTo (const FileNodeIterator &it) const
 
FileNode operator* () const
 returns the currently observed element More...
 
FileNodeIteratoroperator++ ()
 moves iterator to the next node More...
 
FileNodeIterator operator++ (int)
 moves iterator to the next node More...
 
FileNodeIteratoroperator+= (int ofs)
 moves iterator forward by the specified offset (possibly negative) More...
 
FileNodeIteratorreadRaw (const String &fmt, void *vec, size_t maxCount=(size_t) INT_MAX)
 Reads node elements to the buffer with the specified format. More...
 
size_t remaining () const
 returns the number of remaining (not read yet) elements More...
 

Protected Attributes

size_t blockIdx
 
size_t blockSize
 
const FileStoragefs
 
size_t idx
 
size_t nodeNElems
 
size_t ofs
 

Related Functions

(Note that these are not member functions.)

template<typename _Tp >
static FileNodeIteratoroperator>> (FileNodeIterator &it, _Tp &value)
 Reads data from a file storage. More...
 
template<typename _Tp >
static FileNodeIteratoroperator>> (FileNodeIterator &it, std::vector< _Tp > &vec)
 Reads data from a file storage. More...
 
bool operator== (const FileNodeIterator &it1, const FileNodeIterator &it2)
 
bool operator!= (const FileNodeIterator &it1, const FileNodeIterator &it2)
 
static ptrdiff_t operator- (const FileNodeIterator &it1, const FileNodeIterator &it2)
 
static bool operator< (const FileNodeIterator &it1, const FileNodeIterator &it2)
 

Detailed Description

used to iterate through sequences and mappings.

A standard STL notation, with node.begin(), node.end() denoting the beginning and the end of a sequence, stored in node. See the data reading sample in the beginning of the section.

Examples:
samples/cpp/filestorage.cpp.

Constructor & Destructor Documentation

§ FileNodeIterator() [1/3]

cv::FileNodeIterator::FileNodeIterator ( )

The constructors.

These constructors are used to create a default iterator, set it to specific element in a file node or construct it from another iterator.

§ FileNodeIterator() [2/3]

cv::FileNodeIterator::FileNodeIterator ( const FileNode node,
bool  seekEnd 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
nodeFile node - the collection to iterate over; it can be a scalar (equivalent to 1-element collection) or "none" (equivalent to empty collection).
seekEnd- true if iterator needs to be set after the last element of the node; that is: node.begin() => FileNodeIterator(node, false) node.end() => FileNodeIterator(node, true)

§ FileNodeIterator() [3/3]

cv::FileNodeIterator::FileNodeIterator ( const FileNodeIterator it)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
itIterator to be used as initialization for the created iterator.

Member Function Documentation

§ equalTo()

bool cv::FileNodeIterator::equalTo ( const FileNodeIterator it) const

§ operator*()

FileNode cv::FileNodeIterator::operator* ( ) const

returns the currently observed element

§ operator++() [1/2]

FileNodeIterator& cv::FileNodeIterator::operator++ ( )

moves iterator to the next node

§ operator++() [2/2]

FileNodeIterator cv::FileNodeIterator::operator++ ( int  )

moves iterator to the next node

§ operator+=()

FileNodeIterator& cv::FileNodeIterator::operator+= ( int  ofs)

moves iterator forward by the specified offset (possibly negative)

§ readRaw()

FileNodeIterator& cv::FileNodeIterator::readRaw ( const String fmt,
void *  vec,
size_t  maxCount = (size_t) INT_MAX 
)

Reads node elements to the buffer with the specified format.

Usually it is more convenient to use operator >> instead of this method.

Parameters
fmtSpecification of each array element. See format specification
vecPointer to the destination array.
maxCountNumber of elements to read. If it is greater than number of remaining elements then all of them will be read.

§ remaining()

size_t cv::FileNodeIterator::remaining ( ) const

returns the number of remaining (not read yet) elements

Friends And Related Function Documentation

§ operator!=()

bool operator!= ( const FileNodeIterator it1,
const FileNodeIterator it2 
)
related

§ operator-()

static ptrdiff_t operator- ( const FileNodeIterator it1,
const FileNodeIterator it2 
)
related

§ operator<()

static bool operator< ( const FileNodeIterator it1,
const FileNodeIterator it2 
)
related

§ operator==()

bool operator== ( const FileNodeIterator it1,
const FileNodeIterator it2 
)
related

§ operator>>() [1/2]

template<typename _Tp >
static FileNodeIterator & operator>> ( FileNodeIterator it,
_Tp &  value 
)
related

Reads data from a file storage.

§ operator>>() [2/2]

template<typename _Tp >
static FileNodeIterator & operator>> ( FileNodeIterator it,
std::vector< _Tp > &  vec 
)
related

Reads data from a file storage.

Member Data Documentation

§ blockIdx

size_t cv::FileNodeIterator::blockIdx
protected

§ blockSize

size_t cv::FileNodeIterator::blockSize
protected

§ fs

const FileStorage* cv::FileNodeIterator::fs
protected

§ idx

size_t cv::FileNodeIterator::idx
protected

§ nodeNElems

size_t cv::FileNodeIterator::nodeNElems
protected

§ ofs

size_t cv::FileNodeIterator::ofs
protected

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