v2.0.0
Loading...
Searching...
No Matches
FIFFLIB::FiffDirNode Class Reference

Recursive FIFF block-tree node: block kind, block ID, directly contained directory entries and child sub-blocks. More...

#include <fiff_dir_node.h>

Public Types

using SPtr = QSharedPointer<FiffDirNode>
using ConstSPtr = QSharedPointer<const FiffDirNode>
using UPtr = std::unique_ptr<FiffDirNode>
using ConstUPtr = std::unique_ptr<const FiffDirNode>

Public Member Functions

 FiffDirNode ()
 FiffDirNode (const FiffDirNode *p_FiffDirTree)
 ~FiffDirNode ()
bool isEmpty () const
QList< FiffDirNode::SPtrdir_tree_find (fiff_int_t p_kind) const
bool find_tag (QSharedPointer< FiffStream > &p_pStream, fiff_int_t findkind, std::unique_ptr< FiffTag > &p_pTag) const
bool find_tag (FiffStream *p_pStream, fiff_int_t findkind, std::unique_ptr< FiffTag > &p_pTag) const
bool has_tag (fiff_int_t findkind)
bool has_kind (fiff_int_t p_kind) const
void print (int indent) const
fiff_int_t nent () const
fiff_int_t nchild () const

Static Public Member Functions

static bool copy_tree (QSharedPointer< FiffStream > &p_pStreamIn, const FiffId &in_id, const QList< QSharedPointer< FiffDirNode > > &p_Nodes, QSharedPointer< FiffStream > &p_pStreamOut)
static void explain_block (int kind)
static void explain (int kind)
static const char * get_tag_explanation (int kind)

Public Attributes

fiff_int_t type
FiffId id
QList< FiffDirEntry::SPtrdir
QList< FiffDirEntry::SPtrdir_tree
fiff_int_t nent_tree
FiffDirNode::SPtr parent
FiffId parent_id
QList< FiffDirNode::SPtrchildren

Detailed Description

Recursive FIFF block-tree node: block kind, block ID, directly contained directory entries and child sub-blocks.

Each node corresponds to one FIFFB_BLOCK_START ... FIFFB_BLOCK_END pair in the on-disk tag stream. The full tree is built once by FiffStream::make_dir_tree after the directory tag is parsed, and is then traversed by every higher-level reader (FiffInfo, FiffRawData, FiffEvoked, FiffCov, ...) via dir_tree_find. The static copy_tree helper streams an entire sub-tree from one FiffStream to another preserving block IDs, which is how MNE-CPP writes derived files that keep provenance back to the source recording.

Definition at line 78 of file fiff_dir_node.h.

Member Typedef Documentation

◆ ConstSPtr

using FIFFLIB::FiffDirNode::ConstSPtr = QSharedPointer<const FiffDirNode>

Const shared pointer type for FiffDirNode.

Definition at line 81 of file fiff_dir_node.h.

◆ ConstUPtr

using FIFFLIB::FiffDirNode::ConstUPtr = std::unique_ptr<const FiffDirNode>

Const unique pointer type for FiffDirNode.

Definition at line 83 of file fiff_dir_node.h.

◆ SPtr

using FIFFLIB::FiffDirNode::SPtr = QSharedPointer<FiffDirNode>

Shared pointer type for FiffDirNode.

Definition at line 80 of file fiff_dir_node.h.

◆ UPtr

using FIFFLIB::FiffDirNode::UPtr = std::unique_ptr<FiffDirNode>

Unique pointer type for FiffDirNode.

Definition at line 82 of file fiff_dir_node.h.

Constructor & Destructor Documentation

◆ FiffDirNode() [1/2]

FiffDirNode::FiffDirNode ( )

Constructors the directory tree structure.

Definition at line 45 of file fiff_dir_node.cpp.

◆ FiffDirNode() [2/2]

FiffDirNode::FiffDirNode ( const FiffDirNode * p_FiffDirTree)

Copy constructor.

Parameters
[in]p_FiffDirTreeDirectory tree structure which should be copied.

Definition at line 54 of file fiff_dir_node.cpp.

◆ ~FiffDirNode()

FiffDirNode::~FiffDirNode ( )

Destroys the fiffDirTree.

Definition at line 67 of file fiff_dir_node.cpp.

Member Function Documentation

◆ copy_tree()

bool FiffDirNode::copy_tree ( QSharedPointer< FiffStream > & p_pStreamIn,
const FiffId & in_id,
const QList< QSharedPointer< FiffDirNode > > & p_Nodes,
QSharedPointer< FiffStream > & p_pStreamOut )
static

Copies directory subtrees from fidin to fidout

Parameters
[in]p_pStreamInfiff file to copy from.
[in]in_idfile id description.
[in]p_Nodessubtree directories to be copied.
[out]p_pStreamOutfiff file to write to.
Returns
true if succeeded, false otherwise.

Definition at line 77 of file fiff_dir_node.cpp.

◆ dir_tree_find()

QList< FiffDirNode::SPtr > FiffDirNode::dir_tree_find ( fiff_int_t p_kind) const

Find nodes of the given kind from a directory tree structure

Parameters
[in]p_kindthe given kind.
Returns
list of the found nodes.

Definition at line 163 of file fiff_dir_node.cpp.

◆ explain()

void FiffDirNode::explain ( int kind)
static

Try to explain...

Parameters
[in]kinddirectory kind.

Definition at line 276 of file fiff_dir_node.cpp.

◆ explain_block()

void FiffDirNode::explain_block ( int kind)
static

Try to explain a block...

Parameters
[in]kindBlock kind.

Definition at line 263 of file fiff_dir_node.cpp.

◆ find_tag() [1/2]

bool FIFFLIB::FiffDirNode::find_tag ( FiffStream * p_pStream,
fiff_int_t findkind,
std::unique_ptr< FiffTag > & p_pTag ) const

Definition of the find_tag function in various files e.g. fiff_read_named_matrix.m,

Founds a tag of a given kind within a tree, and reeds it from file. Note: In difference to mne-matlab this is not a static function. This is a method of the FiffDirNode class, that's why a tree object doesn't need to be handed to the function.

Parameters
[in]p_pStreamthe opened fif file.
[in]findkindthe kind which should be found.
[out]p_pTagthe found tag.
Returns
true if found, false otherwise.

◆ find_tag() [2/2]

bool FIFFLIB::FiffDirNode::find_tag ( QSharedPointer< FiffStream > & p_pStream,
fiff_int_t findkind,
std::unique_ptr< FiffTag > & p_pTag ) const
inline

Definition of the find_tag function in various files e.g. fiff_read_named_matrix.m,

Founds a tag of a given kind within a tree, and reeds it from file. Note: In difference to mne-matlab this is not a static function. This is a method of the FiffDirNode class, that's why a tree object doesn't need to be handed to the function.

Parameters
[in]p_pStreamthe opened fif file.
[in]findkindthe kind which should be found.
[out]p_pTagthe found tag.
Returns
true if found, false otherwise.

Definition at line 260 of file fiff_dir_node.h.

◆ get_tag_explanation()

const char * FiffDirNode::get_tag_explanation ( int kind)
static

Get textual explanation of a tag

Parameters
[in]kinddirectory kind.
Returns
Pointer to the static string explaining the tag, or nullptr if not found.

Definition at line 290 of file fiff_dir_node.cpp.

◆ has_kind()

bool FiffDirNode::has_kind ( fiff_int_t p_kind) const

Checks whether a FiffDirNode has a specific kind

Parameters
[in]findkindkind to find.
Returns
true when fiff_dir_node contains kind.

Definition at line 206 of file fiff_dir_node.cpp.

◆ has_tag()

bool FiffDirNode::has_tag ( fiff_int_t findkind)

Definition of the has_tag function in fiff_read_named_matrix.m

Parameters
[in]findkindkind to find.
Returns
true when fiff_dir_node contains kind.

Definition at line 196 of file fiff_dir_node.cpp.

◆ isEmpty()

bool FIFFLIB::FiffDirNode::isEmpty ( ) const
inline

Returns true if directory tree structure contains no data.

Returns
true if directory tree structure is empty.

Definition at line 124 of file fiff_dir_node.h.

◆ nchild()

fiff_int_t FiffDirNode::nchild ( ) const

Returns the number of child nodes

Returns
Number of child nodes.

Definition at line 309 of file fiff_dir_node.cpp.

◆ nent()

fiff_int_t FiffDirNode::nent ( ) const

Returns the number of entries in this node

Returns
Number of entries in this node.

Definition at line 302 of file fiff_dir_node.cpp.

◆ print()

void FiffDirNode::print ( int indent) const

Prints elements of a tree.

Parameters
[in]indentnumber of intendations.

Definition at line 221 of file fiff_dir_node.cpp.

Member Data Documentation

◆ children

QList<FiffDirNode::SPtr> FIFFLIB::FiffDirNode::children

Child nodes.

Definition at line 251 of file fiff_dir_node.h.

◆ dir

QList<FiffDirEntry::SPtr> FIFFLIB::FiffDirNode::dir

Directory of tags in this node.

Definition at line 244 of file fiff_dir_node.h.

◆ dir_tree

QList<FiffDirEntry::SPtr> FIFFLIB::FiffDirNode::dir_tree

Directory of tags within this node subtrees as well as FIFF_BLOCK_START and FIFF_BLOCK_END

Definition at line 246 of file fiff_dir_node.h.

◆ id

FiffId FIFFLIB::FiffDirNode::id

Id of this block if any.

Definition at line 243 of file fiff_dir_node.h.

◆ nent_tree

fiff_int_t FIFFLIB::FiffDirNode::nent_tree

Number of entries in the directory tree node.

Definition at line 248 of file fiff_dir_node.h.

◆ parent

FiffDirNode::SPtr FIFFLIB::FiffDirNode::parent

Parent node.

Definition at line 249 of file fiff_dir_node.h.

◆ parent_id

FiffId FIFFLIB::FiffDirNode::parent_id

Newly added to stay consistent with MATLAB implementation.

Definition at line 250 of file fiff_dir_node.h.

◆ type

fiff_int_t FIFFLIB::FiffDirNode::type

Block type for this directory.

Definition at line 242 of file fiff_dir_node.h.


The documentation for this class was generated from the following files: