Class cv::FileNode#

File Storage Node class. View details

Collaboration diagram for cv::FileNode:

Public Types#

type of the file storage node

enum cv::FileNode {
    cv::NONE = 0,
    cv::INT = 1,
    cv::REAL = 2,
    cv::FLOAT = REAL,
    cv::STR = 3,
    cv::STRING = STR,
    cv::SEQ = 4,
    cv::MAP = 5,
    cv::TYPE_MASK = 7,
    cv::FLOW = 8,
    cv::UNIFORM = 8,
    cv::EMPTY = 16,
    cv::NAMED = 32
}

Detailed Description#

File Storage Node class.

The node is used to store each and every element of the file storage opened for reading. When XML/YAML file is read, it is first parsed and stored in the memory as a hierarchical collection of nodes. Each node can be a “leaf” that is contain a single number or a string, or be a collection of other nodes. There can be named collections (mappings) where each element has a name and it is accessed by a name, and ordered collections (sequences) where elements do not have names but rather accessed by index. Type of the file node can be determined using FileNode::type method.

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.

Examples
samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp, and samples/dnn/classification.cpp.

Member Enumeration Documentation#

enum FileNode

type of the file storage node

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

SEQ

sequence

MAP

mapping

TYPE_MASK

FLOW

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

UNIFORM

UNIFORM is used only when reading FileStorage; FLOW is used only when writing. So they share the same bit.

if set, means that all the collection elements are numbers of the same type (real’s or int’s).

EMPTY

empty structure (sequence or mapping)

NAMED

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

Constructor & Destructor Documentation#

FileNode()#

cv::FileNode::FileNode()

Python:

The constructors.

These constructors are used to create a default file node, construct it from obsolete structures or from the another file node.

FileNode()#

cv::FileNode::FileNode(const FileNode & node)

Python:

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

Parameters

  • node — File node to be used as initialization for the created file node.

FileNode()#

cv::FileNode::FileNode(
const FileStorage * fs,
size_t blockIdx,
size_t ofs )

Python:

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

Parameters

  • fs — Pointer to the file storage structure.

  • blockIdx — Index of the memory block where the file node is stored

  • ofs — Offset in bytes from the beginning of the serialized storage

FileNode()#

cv::FileNode::FileNode(
FileStorage::Impl * fs,
size_t blockIdx,
size_t ofs )

Python:

Member Function Documentation#

begin()#

FileNodeIterator cv::FileNode::begin()

returns iterator pointing to the first node element

empty()#

bool cv::FileNode::empty()

Python:

cv.FileNode.empty() -> retval

returns true if the node is empty

end()#

FileNodeIterator cv::FileNode::end()

returns iterator pointing to the element following the last node element

isInt()#

bool cv::FileNode::isInt()

Python:

cv.FileNode.isInt() -> retval

returns true if the node is an integer

isMap()#

bool cv::FileNode::isMap()

Python:

cv.FileNode.isMap() -> retval

returns true if the node is a mapping

isNamed()#

bool cv::FileNode::isNamed()

Python:

cv.FileNode.isNamed() -> retval

returns true if the node has a name

isNone()#

bool cv::FileNode::isNone()

Python:

cv.FileNode.isNone() -> retval

returns true if the node is a “none” object

isReal()#

bool cv::FileNode::isReal()

Python:

cv.FileNode.isReal() -> retval

returns true if the node is a floating-point number

isSeq()#

bool cv::FileNode::isSeq()

Python:

cv.FileNode.isSeq() -> retval

returns true if the node is a sequence

isString()#

bool cv::FileNode::isString()

Python:

cv.FileNode.isString() -> retval

returns true if the node is a text string

keys()#

std::vector< String > cv::FileNode::keys()

Python:

cv.FileNode.keys() -> retval

Returns keys of a mapping node.

Returns

Keys of a mapping node.

mat()#

Mat cv::FileNode::mat()

Python:

cv.FileNode.mat() -> retval

Simplified reading API to use with bindings.

name()#

std::string cv::FileNode::name()

Python:

cv.FileNode.name() -> retval

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

operator double()#

cv::FileNode::operator double()

returns the node content as double

operator float()#

cv::FileNode::operator float()

returns the node content as float

operator int64_t()#

cv::FileNode::operator int64_t()

returns the node content as a signed 64bit integer. If the node stores floating-point number, it is rounded.

operator std::string()#

cv::FileNode::operator std::string()

returns the node content as text string

Here is the call graph for this function:

cv::FileNode::string Node1 cv::FileNode::string Node1->Node1

cv::FileNode::string Node1 cv::FileNode::string Node1->Node1

operator=()#

FileNode & cv::FileNode::operator=(const FileNode & node)

operator#

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

Python:

cv.FileNode.at(i) -> retval
cv.FileNode.getNode(nodename) -> retval

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

Parameters

  • nodename — Name of an element in the mapping node.

operator#

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

Python:

cv.FileNode.at(i) -> retval
cv.FileNode.getNode(nodename) -> retval

Returns element of a mapping node or a sequence node.

Parameters

  • nodename — Name of an element in the mapping node.

Returns

Returns the element with the given identifier.

operator#

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

Python:

cv.FileNode.at(i) -> retval
cv.FileNode.getNode(nodename) -> retval

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

Parameters

  • i — Index of an element in the sequence node.

ptr()#

uchar * cv::FileNode::ptr()

ptr()#

const uchar * cv::FileNode::ptr()

rawSize()#

size_t cv::FileNode::rawSize()

Python:

cv.FileNode.rawSize() -> retval

returns raw size of the FileNode in bytes

readRaw()#

void cv::FileNode::readRaw(
const String & fmt,
void * vec,
size_t len )

Reads node elements to the buffer with the specified format.

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

Parameters

  • fmt — Specification of each array element. See format specification

  • vec — Pointer to the destination array.

  • len — Number of bytes to read (buffer size limit). If it is greater than number of remaining elements then all of them will be read.

real()#

double cv::FileNode::real()

Python:

cv.FileNode.real() -> retval

Simplified reading API to use with bindings.

setValue()#

void cv::FileNode::setValue(
int type,
const void * value,
int len = -1 )

Internal method used when reading FileStorage. Sets the type (int, real or string) and value of the previously created node.

size()#

size_t cv::FileNode::size()

Python:

cv.FileNode.size() -> retval

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

string()#

std::string cv::FileNode::string()

Python:

cv.FileNode.string() -> retval

Simplified reading API to use with bindings.

type()#

int cv::FileNode::type()

Python:

cv.FileNode.type() -> retval

Returns type of the node.

Returns

Type of the node. See FileNode::Type

isCollection()#

static bool cv::FileNode::isCollection(int flags)

isEmptyCollection()#

static bool cv::FileNode::isEmptyCollection(int flags)

isFlow()#

static bool cv::FileNode::isFlow(int flags)

isMap()#

static bool cv::FileNode::isMap(int flags)

Python:

cv.FileNode.isMap() -> retval

isSeq()#

static bool cv::FileNode::isSeq(int flags)

Python:

cv.FileNode.isSeq() -> retval

Member Data Documentation#

blockIdx#

size_t cv::FileNode::blockIdx

fs#

FileStorage::Impl * cv::FileNode::fs

ofs#

size_t cv::FileNode::ofs

Source file#

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