MNE-CPP  0.1.9
A Framework for Electrophysiology
fiff_dir_node.h
Go to the documentation of this file.
1 //=============================================================================================================
37 #ifndef FIFF_DIR_NODE_H
38 #define FIFF_DIR_NODE_H
39 
40 //=============================================================================================================
41 // INCLUDES
42 //=============================================================================================================
43 
44 #include "fiff_global.h"
45 #include "fiff_constants.h"
46 #include "fiff_types.h"
47 #include "fiff_dir_entry.h"
48 #include "fiff_id.h"
49 #include "fiff_explain.h"
50 
51 //=============================================================================================================
52 // QT INCLUDES
53 //=============================================================================================================
54 
55 #include <QList>
56 #include <QSharedPointer>
57 #include <QStringList>
58 
59 //=============================================================================================================
60 // DEFINE NAMESPACE FIFFLIB
61 //=============================================================================================================
62 
63 namespace FIFFLIB
64 {
65 
66 class FiffStream;
67 class FiffTag;
68 
69 //=============================================================================================================
76 public:
77  typedef QSharedPointer<FiffDirNode> SPtr;
78  typedef QSharedPointer<const FiffDirNode> ConstSPtr;
80  //=========================================================================================================
84  FiffDirNode();
85 
86  //=========================================================================================================
92  FiffDirNode(const FiffDirNode* p_FiffDirTree);
93 
94  //=========================================================================================================
98  ~FiffDirNode();
99 
100  //=========================================================================================================
113  static bool copy_tree(QSharedPointer<FiffStream>& p_pStreamIn, const FiffId& in_id, const QList< QSharedPointer<FiffDirNode> >& p_Nodes, QSharedPointer<FiffStream>& p_pStreamOut);
114 
115  //=========================================================================================================
121  inline bool isEmpty() const
122  {
123  return this->type < 0;
124  }
125 
126  //=========================================================================================================
137  QList<FiffDirNode::SPtr> dir_tree_find(fiff_int_t p_kind) const;
138 
139  //=========================================================================================================
154  inline bool find_tag(QSharedPointer<FiffStream>& p_pStream, fiff_int_t findkind, QSharedPointer<FiffTag>& p_pTag) const;
155 
156  //=========================================================================================================
171  bool find_tag(FiffStream* p_pStream, fiff_int_t findkind, QSharedPointer<FiffTag>& p_pTag) const;
172 
173  //=========================================================================================================
181  bool has_tag(fiff_int_t findkind);
182 
183  //=========================================================================================================
191  bool has_kind(fiff_int_t p_kind) const;
192 
193  //=========================================================================================================
200  void print(int indent) const;
201 
202  //=========================================================================================================
209  static void explain_block(int kind);
210 
211  //=========================================================================================================
218  static void explain (int kind);
219 
220  //=========================================================================================================
227  static const char *get_tag_explanation (int kind);
228 
229  //=========================================================================================================
235  fiff_int_t nent() const;
236 
237  //=========================================================================================================
243  fiff_int_t nchild() const;
244 
245 public:
246  fiff_int_t type;
248  QList<FiffDirEntry::SPtr> dir;
249 // fiff_int_t nent; /**< Number of entries in this node. */
250  QList<FiffDirEntry::SPtr> dir_tree;
252  fiff_int_t nent_tree;
255  QList<FiffDirNode::SPtr> children;
256 // fiff_int_t nchild; /**< Number of child nodes. */ -> use nchild() instead
257 
258  // typedef struct _fiffDirNode {
259  // int type; /**< Block type for this directory *
260  // fiffId id; /**< Id of this block if any *
261  // fiffDirEntry dir; /**< Directory of tags in this node *
262  // int nent; /**< Number of entries in this node *
263  // fiffDirEntry dir_tree; /**< Directory of tags within this node
264  // * subtrees as well as FIFF_BLOCK_START and FIFF_BLOCK_END
265  // * included. NOTE: While dir is allocated separately
266  // * dir_tree is a pointer to the dirtree field
267  // * in the FiffStream structure. The dir_tree and nent_tree
268  // * fields are only used within the library to facilitate
269  // * certain operations. *
270  // int nent_tree; /**< Number of entries in the directory tree node *
271  // struct _fiffDirNode *parent; /**< Parent node *
272  // struct _fiffDirNode **children; /**< Child nodes *
273  // int nchild; /**< Number of child nodes *
274  // } fiffDirNodeRec,*fiffDirNode; /**< Directory tree structure used by the fiff library routines. *
275 };
276 
277 //=============================================================================================================
278 // INLINE DEFINITIONS
279 //=============================================================================================================
280 
281 inline bool FiffDirNode::find_tag(QSharedPointer<FiffStream> &p_pStream, fiff_int_t findkind, QSharedPointer<FiffTag> &p_pTag) const
282 {
283  return find_tag(p_pStream.data(), findkind, p_pTag);
284 }
285 } // NAMESPACE
286 
287 #endif // FIFF_DIR_NODE_H
FIFFLIB::FiffDirNode::isEmpty
bool isEmpty() const
Definition: fiff_dir_node.h:121
FIFFLIB::FiffDirNode::children
QList< FiffDirNode::SPtr > children
Definition: fiff_dir_node.h:255
FIFFLIB::FiffDirNode::dir_tree
QList< FiffDirEntry::SPtr > dir_tree
Definition: fiff_dir_node.h:250
FIFFLIB::FiffDirNode::parent_id
FiffId parent_id
Definition: fiff_dir_node.h:254
FIFFLIB::FiffDirNode
Directory Node structure.
Definition: fiff_dir_node.h:75
FIFFLIB::FiffDirNode::find_tag
bool find_tag(QSharedPointer< FiffStream > &p_pStream, fiff_int_t findkind, QSharedPointer< FiffTag > &p_pTag) const
Definition: fiff_dir_node.h:281
FIFFLIB::FiffDirNode::nent_tree
fiff_int_t nent_tree
Definition: fiff_dir_node.h:252
FIFFLIB::FiffId
Universially unique identifier.
Definition: fiff_id.h:68
FIFFLIB::FiffDirNode::parent
FiffDirNode::SPtr parent
Definition: fiff_dir_node.h:253
fiff_constants.h
Fiff constants.
FIFFSHARED_EXPORT
#define FIFFSHARED_EXPORT
Definition: fiff_global.h:56
fiff_dir_entry.h
FiffDirEntry class declaration.
fiff_global.h
Fiff library export/import macros.
fiff_explain.h
Fiff block and dir tag explainations.
FIFFLIB::FiffDirNode::id
FiffId id
Definition: fiff_dir_node.h:247
fiff_id.h
FiffId class declaration.
FIFFLIB::FiffDirNode::type
fiff_int_t type
Definition: fiff_dir_node.h:246
fiff_types.h
Definitions for describing the objects in a FIFF file.
FIFFLIB::FiffDirNode::SPtr
QSharedPointer< FiffDirNode > SPtr
Definition: fiff_dir_node.h:77
FIFFLIB::FiffDirNode::dir
QList< FiffDirEntry::SPtr > dir
Definition: fiff_dir_node.h:248
FIFFLIB::FiffDirNode::ConstSPtr
QSharedPointer< const FiffDirNode > ConstSPtr
Definition: fiff_dir_node.h:78
FIFFLIB::FiffStream
FIFF File I/O routines.
Definition: fiff_stream.h:104