53 using namespace FIFFLIB;
69 : type(p_FiffDirTree->type)
70 , id(p_FiffDirTree->id)
71 , dir(p_FiffDirTree->dir)
72 , nent_tree(p_FiffDirTree->nent_tree)
73 , parent(p_FiffDirTree->parent)
74 , parent_id(p_FiffDirTree->parent_id)
75 , children(p_FiffDirTree->children)
93 if(p_Nodes.size() <= 0)
98 for(
k = 0;
k < p_Nodes.size(); ++
k)
100 p_pStreamOut->start_block(p_Nodes[
k]->
type);
101 if (p_Nodes[
k]->
id.version != -1)
104 p_pStreamOut->write_id(FIFF_PARENT_FILE_ID, in_id);
106 p_pStreamOut->write_id(FIFF_BLOCK_ID);
107 p_pStreamOut->write_id(FIFF_PARENT_BLOCK_ID, p_Nodes[
k]->
id);
109 for (p = 0; p < p_Nodes[
k]->nent(); ++p)
114 if(p_Nodes[
k]->
dir[p]->kind == FIFF_BLOCK_ID || p_Nodes[
k]->
dir[p]->kind == FIFF_PARENT_BLOCK_ID || p_Nodes[
k]->
dir[p]->kind == FIFF_PARENT_FILE_ID)
120 if (!p_pStreamIn->device()->seek(p_Nodes[
k]->dir[p]->pos))
122 printf(
"Could not seek to the tag\n");
130 in->setByteOrder(QDataStream::BigEndian);
147 in->readRawData(tag->data(), tag->size());
155 out->setByteOrder(QDataStream::BigEndian);
157 *out << (qint32)tag->kind;
158 *out << (qint32)tag->type;
159 *out << (qint32)tag->size();
160 *out << (qint32)FIFFV_NEXT_SEQ;
162 out->writeRawData(tag->data(),tag->size());
164 for(p = 0; p < p_Nodes[
k]->nchild(); ++p)
166 QList<FiffDirNode::SPtr> childList;
167 childList << p_Nodes[
k]->children[p];
170 p_pStreamOut->end_block(p_Nodes[
k]->
type);
179 QList<FiffDirNode::SPtr> nodes;
180 if(this->
type == p_kind)
183 QList<FiffDirNode::SPtr>::const_iterator i;
184 for (i = this->
children.begin(); i != this->children.end(); ++i)
185 nodes.append((*i)->dir_tree_find(p_kind));
194 for (qint32 p = 0; p < this->
nent(); ++p)
196 if (this->
dir[p]->kind == findkind)
212 for(qint32 p = 0; p < this->
nent(); ++p)
213 if(this->
dir.at(p)->kind == findkind)
222 if(this->
type == p_kind)
225 QList<FiffDirNode::SPtr>::const_iterator i;
226 for(i = this->
children.begin(); i != this->children.end(); ++i)
227 if((*i)->has_kind(p_kind))
237 int j, prev_kind,count;
238 QList<FiffDirEntry::SPtr> dentry = this->
dir;
240 for (
int k = 0;
k < indent;
k++)
248 for (j = 0, prev_kind = -1, count = 0; j < this->
nent(); j++) {
249 if (dentry[j]->kind != prev_kind) {
251 printf (
" [%d]\n",count);
254 for (
int k = 0;
k < indent+2;
k++)
257 prev_kind = dentry[j]->kind;
262 prev_kind = dentry[j]->kind;
265 printf (
" [%d]\n",count);
268 for (j = 0; j < this->
nchild(); j++)
270 for (
int k = 0;
k < indent;
k++)
279 for (
int k = 0; _fiff_block_explanations[
k].kind >= 0;
k++) {
280 if (_fiff_block_explanations[
k].kind == kind) {
281 printf (
"%d = %s",kind,_fiff_block_explanations[
k].text);
285 printf (
"Cannot explain: %d",kind);
293 for (
k = 0; _fiff_explanations[
k].kind >= 0;
k++) {
294 if (_fiff_explanations[
k].kind == kind) {
295 printf (
"%d = %s",kind,_fiff_explanations[
k].text);
299 printf (
"Cannot explain: %d",kind);
307 for (
k = 0; _fiff_explanations[
k].kind >= 0;
k++) {
308 if (_fiff_explanations[
k].kind == kind)
309 return _fiff_explanations[
k].text;