@Namespace(value="cv") @NoOffset @Properties(inherit=opencv_core.class) public class FileNode extends Pointer
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.
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Modifier and Type | Field and Description |
---|---|
static int |
EMPTY
enum cv::FileNode::
|
static int |
FLOAT
enum cv::FileNode::
|
static int |
FLOW
enum cv::FileNode::
|
static int |
INT
enum cv::FileNode::
|
static int |
MAP
enum cv::FileNode::
|
static int |
NAMED
enum cv::FileNode::
|
static int |
NONE
enum cv::FileNode::
|
static int |
REAL
enum cv::FileNode::
|
static int |
SEQ
enum cv::FileNode::
|
static int |
STR
enum cv::FileNode::
|
static int |
STRING
enum cv::FileNode::
|
static int |
TYPE_MASK
enum cv::FileNode::
|
static int |
UNIFORM
enum cv::FileNode::
|
Constructor and Description |
---|
FileNode()
\brief The constructors.
|
FileNode(FileNode node)
\overload
|
FileNode(FileStorage fs,
long blockIdx,
long ofs)
Deprecated.
|
FileNode(long size)
Native array allocator.
|
FileNode(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
BytePointer |
asBytePointer()
returns the node content as text string
|
double |
asDouble()
returns the node content as double
|
float |
asFloat()
returns the node content as float
|
int |
asInt()
returns the node content as an integer.
|
FileNode |
at(int i)
\overload
|
FileNodeIterator |
begin()
returns iterator pointing to the first node element
|
long |
blockIdx() |
FileNode |
blockIdx(long setter) |
boolean |
empty()
returns true if the node is empty
|
FileNodeIterator |
end()
returns iterator pointing to the element following the last node element
|
FileNode |
get(BytePointer nodename)
\brief Returns element of a mapping node or a sequence node.
|
FileNode |
get(String nodename) |
FileNode |
getNode(BytePointer nodename)
\overload
|
FileNode |
getNode(String nodename) |
FileNode |
getPointer(long i) |
static boolean |
isCollection(int flags) |
static boolean |
isEmptyCollection(int flags) |
static boolean |
isFlow(int flags) |
boolean |
isInt()
returns true if the node is an integer
|
boolean |
isMap()
returns true if the node is a mapping
|
static boolean |
isMap(int flags) |
boolean |
isNamed()
returns true if the node has a name
|
boolean |
isNone()
returns true if the node is a "none" object
|
boolean |
isReal()
returns true if the node is a floating-point number
|
boolean |
isSeq()
returns true if the node is a sequence
|
static boolean |
isSeq(int flags) |
boolean |
isString()
returns true if the node is a text string
|
StringVector |
keys()
\brief Returns keys of a mapping node.
|
Mat |
mat()
Simplified reading API to use with bindings.
|
BytePointer |
name()
returns the node name or an empty string if the node is nameless
|
long |
ofs() |
FileNode |
ofs(long setter) |
FileNode |
position(long position) |
BytePointer |
ptr() |
FileNode |
put(FileNode node) |
long |
rawSize()
returns raw size of the FileNode in bytes
|
void |
readRaw(BytePointer fmt,
Pointer vec,
long len)
\brief Reads node elements to the buffer with the specified format.
|
void |
readRaw(String fmt,
Pointer vec,
long len) |
double |
real()
Simplified reading API to use with bindings.
|
void |
setValue(int type,
Pointer value) |
void |
setValue(int type,
Pointer value,
int len)
Internal method used when reading FileStorage.
|
long |
size()
returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise.
|
BytePointer |
string()
Simplified reading API to use with bindings.
|
int |
type()
\brief Returns type of the node.
|
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public static final int NONE
public static final int INT
public static final int REAL
public static final int FLOAT
public static final int STR
public static final int STRING
public static final int SEQ
public static final int MAP
public static final int TYPE_MASK
public static final int FLOW
public static final int UNIFORM
public static final int EMPTY
public static final int NAMED
public FileNode(Pointer p)
Pointer(Pointer)
.public FileNode(long size)
Pointer.position(long)
.public FileNode()
These constructors are used to create a default file node, construct it from obsolete structures or from the another file node.
public FileNode(@Const FileStorage fs, @Cast(value="size_t") long blockIdx, @Cast(value="size_t") long ofs)
fs
- Pointer to the file storage structure.blockIdx
- Index of the memory block where the file node is storedofs
- Offset in bytes from the beginning of the serialized storage
public FileNode getPointer(long i)
getPointer
in class Pointer
@ByVal @Name(value="operator []") public FileNode get(@opencv_core.Str BytePointer nodename)
nodename
- Name of an element in the mapping node.@ByVal @Name(value="operator []") public FileNode getNode(@Cast(value="const char*") BytePointer nodename)
nodename
- Name of an element in the mapping node.@ByVal @Name(value="operator []") public FileNode at(int i)
i
- Index of an element in the sequence node.@ByVal public StringVector keys()
public int type()
@Cast(value="bool") public boolean isReal()
@StdString public BytePointer name()
@Cast(value="size_t") public long size()
@Name(value="operator int") public int asInt()
@Name(value="operator std::string") @StdString public BytePointer asBytePointer()
@Cast(value="uchar*") public BytePointer ptr()
@ByVal public FileNodeIterator begin()
@ByVal public FileNodeIterator end()
public void readRaw(@opencv_core.Str BytePointer fmt, Pointer vec, @Cast(value="size_t") long len)
Usually it is more convenient to use operator >>
instead of this method.
fmt
- Specification of each array element. See \ref format_spec "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.public void readRaw(@opencv_core.Str String fmt, Pointer vec, @Cast(value="size_t") long len)
public void setValue(int type, @Const Pointer value, int len)
public double real()
@StdString public BytePointer string()
public FileNode blockIdx(long setter)
public FileNode ofs(long setter)
Copyright © 2024. All rights reserved.