FiffId
Namespace: FIFFLIB · Library: FIFF Library
#include <fiff/fiff_id.h>
class FIFFLIB::FiffId
128-bit FIFF identifier: hardware machine ID plus creation time, stamped on every file and block.
On-disk layout is a 20-byte record (version + 2x4-byte machine ID + 8-byte FiffTime). The machid is filled from the host MAC address by FiffStream::write_id when generating new identifiers, matching the Neuromag acquisition stack so file lineage stays reconstructible.
QFile structureFile(dir + "/sample_audvis-ave.fif");
FiffStream::SPtr stream(new FiffStream(&structureFile));
const bool opened = stream->open();
const QList<FiffDirNode::SPtr> measNodes = stream->dirtree()->dir_tree_find(FIFFB_MEAS_INFO);
std::unique_ptr<FiffTag> tag;
const bool hasNchan = measNodes.first()->find_tag(stream, FIFF_NCHAN, tag); // raw tag access
const int nchanTag = *tag->toInt();
const FiffId fileId = stream->id();
stream->close();
Public Methods
FiffId()
Default Constructor.
FiffId(p_FiffId)
Copy constructor.
Parameters:
- p_FiffId : const FiffId & Universially unique identifier which should be copied.
operator=(other)
Copy assignment.
Every member has value semantics, so the compiler-generated member-wise assignment is correct. It is declared explicitly because declaring a copy constructor and/or a destructor deprecates the implicitly generated one.
Parameters:
- other : const FiffId & Object to assign from.
Returns:
- FiffId & — reference to this object.
~FiffId()
Destroys the universially unique identifier.
clear()
Resets the File identifier.
print()
Prints the id.
isEmpty()
True if FIFF id is empty.
Returns:
- bool — true if FIFF id is empty.
toMachidString()
Returns the machine ID as a human-readable string.
Returns:
- QString — The machine ID formatted as a string.
toString()
Returns a human-readable string representation of this ID.
Format: "major.minor 0xMACHID1MACHID2 timestamp"
Returns:
- QString — Formatted string describing the ID.
Static Methods
new_file_id()
Constructs a (hopefully) unique file id.
Returns:
get_machid(fixed_id)
Returns the machine ID consisting of a two integer number.
Parameters:
- fixed_id : *int ** Pointer to an array of at least 2 ints to receive the machine ID.
Returns:
- bool — true if succeeded, false otherwise.
getDefault()
Returns a default FiffId object to be used as a mutable placeholder for a default instance of the class.
Returns:
storageSize()
Size of the old struct (fiffIdRec) 5int = 54 = 20.
Returns:
- qint32 — the size of the old struct
fiffIdRec.
Example
- Full source:
src/examples/ex_fiff_api/main.cpp - Build target:
ex_fiff_api(runs under CTest) - Data: mne-cpp-test-data
Used in examples
ex_fiff_api
FIFF library: measurement info, channels, digitizer, transforms, projectors, covariance, events,.
std::unique_ptr<FiffTag> tag;
const bool hasNchan = measNodes.first()->find_tag(stream, FIFF_NCHAN, tag); // raw tag access
const int nchanTag = *tag->toInt();
const FiffId fileId = stream->id();
stream->close();
ok &= expect(opened && measNodes.size() == 1 && hasNchan && nchanTag == 376 && !fileId.isEmpty() && fileId.version > 0,
"FiffStream/FiffDirNode/FiffTag/FiffId: the FIFF_NCHAN tag of the measurement block reads 376");
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>
- Christof Pieloth <pieloth@labp.htwk-leipzig.de>
- Lorenz Esch <lorenz.esch@tu-ilmenau.de>
- Juan GPC <jgarciaprieto@mgh.harvard.edu>
- Gabriel Motta <gabrielbenmotta@gmail.com>