v2.0.0
Loading...
Searching...
No Matches
fiff_dir_node.h
Go to the documentation of this file.
1//=============================================================================================================
31
32#ifndef FIFF_DIR_NODE_H
33#define FIFF_DIR_NODE_H
34
35//=============================================================================================================
36// INCLUDES
37//=============================================================================================================
38
39#include "fiff_global.h"
40#include "fiff_constants.h"
41#include "fiff_types.h"
42#include "fiff_dir_entry.h"
43#include "fiff_id.h"
44
45//=============================================================================================================
46// QT INCLUDES
47//=============================================================================================================
48
49#include <QList>
50#include <QSharedPointer>
51#include <QStringList>
52#include <memory>
53
54//=============================================================================================================
55// DEFINE NAMESPACE FIFFLIB
56//=============================================================================================================
57
58namespace FIFFLIB
59{
60
61class FiffStream;
62class FiffTag;
63
64//=============================================================================================================
81{
82public:
83 using SPtr = QSharedPointer<FiffDirNode>;
84 using ConstSPtr = QSharedPointer<const FiffDirNode>;
85 using UPtr = std::unique_ptr<FiffDirNode>;
86 using ConstUPtr = std::unique_ptr<const FiffDirNode>;
87
88 //=========================================================================================================
93
94 //=========================================================================================================
100 FiffDirNode(const FiffDirNode* p_FiffDirTree);
101
102 //=========================================================================================================
106 ~FiffDirNode();
107
108 //=========================================================================================================
119 static bool copy_tree(QSharedPointer<FiffStream>& p_pStreamIn, const FiffId& in_id, const QList<QSharedPointer<FiffDirNode>>& p_Nodes, QSharedPointer<FiffStream>& p_pStreamOut);
120
121 //=========================================================================================================
127 inline bool isEmpty() const
128 {
129 return this->type < 0;
130 }
131
132 //=========================================================================================================
140 QList<FiffDirNode::SPtr> dir_tree_find(fiff_int_t p_kind) const;
141
142 //=========================================================================================================
156 inline bool find_tag(QSharedPointer<FiffStream>& p_pStream, fiff_int_t findkind, std::unique_ptr<FiffTag>& p_pTag) const;
157
158 //=========================================================================================================
172 bool find_tag(FiffStream* p_pStream, fiff_int_t findkind, std::unique_ptr<FiffTag>& p_pTag) const;
173
174 //=========================================================================================================
182 bool has_tag(fiff_int_t findkind);
183
184 //=========================================================================================================
192 bool has_kind(fiff_int_t p_kind) const;
193
194 //=========================================================================================================
200 void print(int indent) const;
201
202 //=========================================================================================================
208 static void explain_block(int kind);
209
210 //=========================================================================================================
216 static void explain(int kind);
217
218 //=========================================================================================================
226 static const char* get_tag_explanation(int kind);
227
228 //=========================================================================================================
236 static const char* get_unit_name(int unit);
237
238 //=========================================================================================================
244 fiff_int_t nent() const;
245
246 //=========================================================================================================
252 fiff_int_t nchild() const;
253
254public:
257 QList<FiffDirEntry::SPtr> dir;
258 // fiff_int_t nent; /**< Number of entries in this node. */
259 QList<FiffDirEntry::SPtr> dir_tree;
264 QList<FiffDirNode::SPtr> children;
265 // fiff_int_t nchild; /**< Number of child nodes. */ -> use nchild() instead
266};
267
268//=============================================================================================================
269// INLINE DEFINITIONS
270//=============================================================================================================
271
272inline bool FiffDirNode::find_tag(QSharedPointer<FiffStream>& p_pStream, fiff_int_t findkind, std::unique_ptr<FiffTag>& p_pTag) const
273{
274 return find_tag(p_pStream.data(), findkind, p_pTag);
275}
276} // NAMESPACE
277
278#endif // FIFF_DIR_NODE_H
Symbolic FIFF tag, block, value, unit and channel-type constants shared across FIFFLIB.
Export/import macros and build-info accessors for the FIFFLIB shared library.
#define FIFFSHARED_EXPORT
Definition fiff_global.h:44
Single entry of the FIFF tag directory: kind, type, byte size and absolute file position.
128-bit FIFF identifier record (machine ID + creation time) used to stamp files, blocks and parent re...
Primitive scalar typedefs and forward-compatible aliases backing the FIFF type system.
FIFF file I/O, in-memory data structures and high-level readers/writers.
qint32 fiff_int_t
Definition fiff_types.h:86
fiff_int_t nchild() const
QList< FiffDirNode::SPtr > children
bool find_tag(FiffStream *p_pStream, fiff_int_t findkind, std::unique_ptr< FiffTag > &p_pTag) const
static const char * get_unit_name(int unit)
std::unique_ptr< const FiffDirNode > ConstUPtr
static void explain(int kind)
FiffDirNode::SPtr parent
QSharedPointer< FiffDirNode > SPtr
static void explain_block(int kind)
fiff_int_t nent() const
static const char * get_tag_explanation(int kind)
void print(int indent) const
bool has_kind(fiff_int_t p_kind) const
bool has_tag(fiff_int_t findkind)
QList< FiffDirEntry::SPtr > dir
QList< FiffDirEntry::SPtr > dir_tree
std::unique_ptr< FiffDirNode > UPtr
bool find_tag(QSharedPointer< FiffStream > &p_pStream, fiff_int_t findkind, std::unique_ptr< FiffTag > &p_pTag) const
static bool copy_tree(QSharedPointer< FiffStream > &p_pStreamIn, const FiffId &in_id, const QList< QSharedPointer< FiffDirNode > > &p_Nodes, QSharedPointer< FiffStream > &p_pStreamOut)
QSharedPointer< const FiffDirNode > ConstSPtr
128-bit FIFF identifier: hardware machine ID plus creation time, stamped on every file and block.
Definition fiff_id.h:69
FIFF tag-stream reader/writer: wraps a QIODevice and exposes typed read_* / write_* methods for every...
FIFF tag: 16-byte header (kind, type, size, next) plus payload, with typed decoders for every FIFFT_*...
Definition fiff_tag.h:161