Class HDF5Meas

Class Documentation

class eCAL::eh5::HDF5Meas

eCAL HDF5 measurement API

Public Types

typedef std::function<void(void)> CallbackFunction

Callback function type for pre file split notification.

Public Functions

HDF5Meas()

Constructor.

HDF5Meas(const std::string &path, eAccessType access = eAccessType::RDONLY)

Constructor.

Parameters
  • path: Input file path / measurement directory path (see meas directory structure description bellow, in Open method).

  • access: Access type

~HDF5Meas()

Destructor.

bool Open(const std::string &path, eAccessType access = eAccessType::RDONLY)

Open file.

Return

true if output (eAccessType::CREATE) measurement directory structure can be accessed/created, false otherwise. true if input (eAccessType::RDONLY) measurement/file path was opened, false otherwise.

Parameters
  • path: Input file path / measurement directory path.

                Default measurement directory structure:
                 - root directory e.g.: M:\measurement_directory\measurement01
                 - documents directory:                                |_doc
                 - hosts directories:                                  |_Host1 (e.g.: CARPC01)
                                                                       |_Host2 (e.g.: CARPC02)
    
                File path as input (eAccessType::RDONLY):
                 - root directory (e.g.: M:\measurement_directory\measurement01) in this case all hosts subdirectories will be iterated,
                 - host directory (e.g.: M:\measurement_directory\measurement01\CARPC01),
                 - file path, path to file from measurement (e.g.: M:\measurement_directory\measurement01\CARPC01\meas01_05.hdf5).
    
                File path as output (eAccessType::CREATE):
                 - full path to  measurement directory (recommended with host name) (e.g.: M:\measurement_directory\measurement01\CARPC01),
                 - to set the name of the actual hdf5 file use SetFileBaseName method.
    

  • access: Access type

bool Close()

Close file.

Return

true if succeeds, false if it fails

bool IsOk() const

Checks if file/measurement is ok.

Return

true if meas can be opened(read) or location is accessible(write), false otherwise

std::string GetFileVersion() const

Get the File Type Version of the current opened file.

Return

file version

size_t GetMaxSizePerFile() const

Gets maximum allowed size for an individual file.

Return

maximum size in MB

void SetMaxSizePerFile(size_t size)

Sets maximum allowed size for an individual file.

Parameters
  • size: maximum size in MB

std::set<std::string> GetChannelNames() const

Get the available channel names of the current opened file / measurement.

Return

channel names

bool HasChannel(const std::string &channel_name) const

Check if channel exists in measurement.

Return

true if exists, false otherwise

Parameters
  • channel_name: name of the channel

std::string GetChannelDescription(const std::string &channel_name) const

Get the channel description for the given channel.

Return

channel description

Parameters
  • channel_name: channel name

void SetChannelDescription(const std::string &channel_name, const std::string &description)

Set description of the given channel.

Parameters
  • channel_name: channel name

  • description: description of the channel

std::string GetChannelType(const std::string &channel_name) const

Gets the channel type of the given channel.

Return

channel type

Parameters
  • channel_name: channel name

void SetChannelType(const std::string &channel_name, const std::string &type)

Set type of the given channel.

Parameters
  • channel_name: channel name

  • type: type of the channel

long long GetMinTimestamp(const std::string &channel_name) const

Gets minimum timestamp for specified channel.

Return

minimum timestamp value

Parameters
  • channel_name: channel name

long long GetMaxTimestamp(const std::string &channel_name) const

Gets maximum timestamp for specified channel.

Return

maximum timestamp value

Parameters
  • channel_name: channel name

bool GetEntriesInfo(const std::string &channel_name, EntryInfoSet &entries) const

Gets the header info for all data entries for the given channel Header = timestamp + entry id.

Return

true if succeeds, false if it fails

Parameters
  • [in] channel_name: channel name

  • [out] entries: header info for all data entries

bool GetEntriesInfoRange(const std::string &channel_name, long long begin, long long end, EntryInfoSet &entries) const

Gets the header info for data entries for the given channel included in given time range (begin->end) Header = timestamp + entry id.

Return

true if succeeds, false if it fails

Parameters
  • [in] channel_name: channel name

  • [in] begin: time range begin timestamp

  • [in] end: time range end timestamp

  • [out] entries: header info for data entries in given range

bool GetEntryDataSize(long long entry_id, size_t &size) const

Gets data size of a specific entry.

Return

true if succeeds, false if it fails

Parameters
  • [in] entry_id: Entry ID

  • [out] size: Entry data size

bool GetEntryData(long long entry_id, void *data) const

Gets data from a specific entry.

Return

true if succeeds, false if it fails

Parameters
  • [in] entry_id: Entry ID

  • [out] data: Entry data

void SetFileBaseName(const std::string &base_name)

Set measurement file base name (desired name for the actual hdf5 files that will be created)

Parameters
  • base_name: Name of the hdf5 files that will be created.

bool AddEntryToFile(const void *data, const unsigned long long &size, const long long &snd_timestamp, const long long &rcv_timestamp, const std::string &channel_name, long long id, long long clock)

Add entry to file.

Return

true if succeeds, false if it fails

Parameters
  • data: data to be added

  • size: size of the data

  • snd_timestamp: send time stamp

  • rcv_timestamp: receive time stamp

  • channel_name: channel name

  • id: message id

  • clock: message clock

void ConnectPreSplitCallback(CallbackFunction cb)

Connect callback for pre file split notification.

Parameters
  • cb: callback function

void DisconnectPreSplitCallback()

Disconnect pre file split callback.