MNE-CPP  beta 1.0
fiff_dir_tree.h
Go to the documentation of this file.
1 //=============================================================================================================
36 #ifndef FIFF_DIR_TREE_H
37 #define FIFF_DIR_TREE_H
38 
39 //*************************************************************************************************************
40 //=============================================================================================================
41 // FIFF 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 
50 
51 //*************************************************************************************************************
52 //=============================================================================================================
53 // QT INCLUDES
54 //=============================================================================================================
55 
56 #include <QDebug>
57 #include <QFile>
58 #include <QList>
59 #include <QSharedPointer>
60 #include <QStringList>
61 
62 
63 //*************************************************************************************************************
64 //=============================================================================================================
65 // DEFINE NAMESPACE FIFFLIB
66 //=============================================================================================================
67 
68 namespace FIFFLIB
69 {
70 
71 class FiffStream;
72 class FiffTag;
73 
74 //=============================================================================================================
81 
82 public:
83  typedef QSharedPointer<FiffDirTree> SPtr;
84  typedef QSharedPointer<const FiffDirTree> ConstSPtr;
86  //=========================================================================================================
90  FiffDirTree();
91 
92  //=========================================================================================================
98  FiffDirTree(const FiffDirTree &p_FiffDirTree);
99 
100  //=========================================================================================================
104  ~FiffDirTree();
105 
106  //=========================================================================================================
110  void clear();
111 
112  //=========================================================================================================
125  static bool copy_tree(QSharedPointer<FiffStream> p_pStreamIn, FiffId& in_id, QList<FiffDirTree>& p_Nodes, QSharedPointer<FiffStream> p_pStreamOut);
126 
127  //=========================================================================================================
133  inline bool isEmpty() const
134  {
135  return this->nent <= 0;
136  }
137 
138  //=========================================================================================================
151  static qint32 make_dir_tree(FiffStream* p_pStream, QList<FiffDirEntry>& p_Dir, FiffDirTree& p_Tree, qint32 start = 0);
152 
153  //=========================================================================================================
163  QList<FiffDirTree> dir_tree_find(fiff_int_t p_kind) const;
164 
165  //=========================================================================================================
179  bool find_tag(FiffStream* p_pStream, fiff_int_t findkind, QSharedPointer<FiffTag>& p_pTag) const;
180 
181  //=========================================================================================================
189  bool has_tag(fiff_int_t findkind);
190 
191  //=========================================================================================================
199  bool has_kind(fiff_int_t p_kind) const;
200 
201 public:
202  fiff_int_t block;
205  QList<FiffDirEntry> dir;
206  fiff_int_t nent;
207  fiff_int_t nent_tree;
208  QList<FiffDirTree> children;
209  fiff_int_t nchild;
211 // typedef struct _fiffDirNode {
212 // int type; /**< Block type for this directory *
213 // fiffId id; /**< Id of this block if any *
214 // fiffDirEntry dir; /**< Directory of tags in this node *
215 // int nent; /**< Number of entries in this node *
216 // fiffDirEntry dir_tree; /**< Directory of tags within this node
217 // * subtrees as well as FIFF_BLOCK_START and FIFF_BLOCK_END
218 // * included. NOTE: While dir is allocated separately
219 // * dir_tree is a pointer to the dirtree field
220 // * in the FiffStream structure. The dir_tree and nent_tree
221 // * fields are only used within the library to facilitate
222 // * certain operations. *
223 // int nent_tree; /**< Number of entries in the directory tree node *
224 // struct _fiffDirNode *parent; /**< Parent node *
225 // struct _fiffDirNode **children; /**< Child nodes *
226 // int nchild; /**< Number of child nodes *
227 // } fiffDirNodeRec,*fiffDirNode; /**< Directory tree structure used by the fiff library routines. *
228 };
229 
230 } // NAMESPACE
231 
232 #endif // FIFF_DIR_TREE_H
QList< FiffDirTree > children
FiffDirEntry class declaration.
Old fiff_type declarations - replace them.
Universially unique identifier.
Definition: fiff_id.h:78
Fiff constants.
QSharedPointer< FiffDirTree > SPtr
Definition: fiff_dir_tree.h:83
bool isEmpty() const
#define FIFFSHARED_EXPORT
Definition: fiff_global.h:58
Directory tree structure.
Definition: fiff_dir_tree.h:80
QList< FiffDirEntry > dir
Fiff library export/import macros.
Definition: fiff.h:98
FiffId class declaration.
FIFF File I/O routines.
Definition: fiff_stream.h:129
QSharedPointer< const FiffDirTree > ConstSPtr
Definition: fiff_dir_tree.h:84