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//=============================================================================================================
79public:
80 using SPtr = QSharedPointer<FiffDirNode>;
81 using ConstSPtr = QSharedPointer<const FiffDirNode>;
82 using UPtr = std::unique_ptr<FiffDirNode>;
83 using ConstUPtr = std::unique_ptr<const FiffDirNode>;
84
85 //=========================================================================================================
90
91 //=========================================================================================================
97 FiffDirNode(const FiffDirNode* p_FiffDirTree);
98
99 //=========================================================================================================
103 ~FiffDirNode();
104
105 //=========================================================================================================
116 static bool copy_tree(QSharedPointer<FiffStream>& p_pStreamIn, const FiffId& in_id, const QList< QSharedPointer<FiffDirNode> >& p_Nodes, QSharedPointer<FiffStream>& p_pStreamOut);
117
118 //=========================================================================================================
124 inline bool isEmpty() const
125 {
126 return this->type < 0;
127 }
128
129 //=========================================================================================================
137 QList<FiffDirNode::SPtr> dir_tree_find(fiff_int_t p_kind) const;
138
139 //=========================================================================================================
153 inline bool find_tag(QSharedPointer<FiffStream>& p_pStream, fiff_int_t findkind, std::unique_ptr<FiffTag>& p_pTag) const;
154
155 //=========================================================================================================
169 bool find_tag(FiffStream* p_pStream, fiff_int_t findkind, std::unique_ptr<FiffTag>& p_pTag) const;
170
171 //=========================================================================================================
179 bool has_tag(fiff_int_t findkind);
180
181 //=========================================================================================================
189 bool has_kind(fiff_int_t p_kind) const;
190
191 //=========================================================================================================
197 void print(int indent) const;
198
199 //=========================================================================================================
205 static void explain_block(int kind);
206
207 //=========================================================================================================
213 static void explain (int kind);
214
215 //=========================================================================================================
223 static const char *get_tag_explanation (int kind);
224
225 //=========================================================================================================
231 fiff_int_t nent() const;
232
233 //=========================================================================================================
239 fiff_int_t nchild() const;
240
241public:
242 fiff_int_t type;
244 QList<FiffDirEntry::SPtr> dir;
245// fiff_int_t nent; /**< Number of entries in this node. */
246 QList<FiffDirEntry::SPtr> dir_tree;
248 fiff_int_t nent_tree;
251 QList<FiffDirNode::SPtr> children;
252// fiff_int_t nchild; /**< Number of child nodes. */ -> use nchild() instead
253
254};
255
256//=============================================================================================================
257// INLINE DEFINITIONS
258//=============================================================================================================
259
260inline bool FiffDirNode::find_tag(QSharedPointer<FiffStream> &p_pStream, fiff_int_t findkind, std::unique_ptr<FiffTag> &p_pTag) const
261{
262 return find_tag(p_pStream.data(), findkind, p_pTag);
263}
264} // NAMESPACE
265
266#endif // FIFF_DIR_NODE_H
128-bit FIFF identifier record (machine ID + creation time) used to stamp files, blocks and parent re...
Symbolic FIFF tag, block, value, unit and channel-type constants shared across FIFFLIB.
Single entry of the FIFF tag directory: kind, type, byte size and absolute file position.
Export/import macros and build-info accessors for the FIFFLIB shared library.
#define FIFFSHARED_EXPORT
Definition fiff_global.h:44
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.
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
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:66
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:159