MDF Lib 2.2
Interface against MDF 3/4 files
Loading...
Searching...
No Matches
mdf::IDataGroup Class Referenceabstract

Interface to a data group (DG) block. More...

#include <idatagroup.h>

Inheritance diagram for mdf::IDataGroup:
Collaboration diagram for mdf::IDataGroup:

Public Member Functions

virtual void Description (const std::string &desc)
 Sets the descriptive text for the measurement.
 
virtual std::string Description () const
 Return the descriptive text.
 
virtual void RecordIdSize (uint8_t id_size)
 Sets size of the record ID (bytes). Note that record ID and its size, is automatically set when writing MDF files.
 
virtual uint8_t RecordIdSize () const
 Returns the record ID size in bytes.
 
virtual std::vector< IChannelGroup * > ChannelGroups () const =0
 Returns a list of channel groups.
 
virtual IChannelGroupCreateChannelGroup ()=0
 Create a new empty channel group.
 
IChannelGroupCreateChannelGroup (const std::string_view &name)
 Create a new channel group or return the existing group.
 
IChannelGroupGetChannelGroup (const std::string_view &name) const
 Returns the existing group by its name.
 
IChannelGroupGetChannelGroup (uint64_t record_id) const
 Return a channel group by its record id.
 
virtual IMetaDataCreateMetaData ()
 Create or return the existing meta-data (MD) block.
 
virtual IMetaDataMetaData () const
 Returns the existing meta-data (MD) block if it exist.
 
void AttachSampleObserver (ISampleObserver *observer) const
 Internal function that attach a sample observer to the measurement block.

 
void DetachSampleObserver (const ISampleObserver *observer) const
 Detach an observer from the measurement.
 
void DetachAllSampleObservers () const
 Detaches all observers from the measurement.
 
bool NotifySampleObservers (size_t sample, uint64_t record_id, const std::vector< uint8_t > &record) const
 Notifies the observer that a new sample record have been read.
 
virtual void ClearData ()
 Clear all temporary sample and data buffers.
 
void SetAsRead (bool mark_as_read=true) const
 Set the DG blocks data as read.
 
bool IsEmpty () const
 Returns true if no samples has been stored yet.
 
bool IsRead () const
 Return true if the DG blocks data has been read not the DG block itself.

 
virtual IChannelGroupFindParentChannelGroup (const IChannel &channel) const =0
 Support function that return the first CG block that contains a specific CN block.
 
bool IsSubscribingOnRecord (uint64_t record_id) const
 Checks if this data group subscribes on a specific record.
 
bool IsSubscribingOnChannel (const IChannel &channel) const
 Checks if this data group subscribes on a specific channel.
 
bool IsSubscribingOnChannelVlsd (const IChannel &channel) const
 Checks if this data group subscribes on a specific channels VLSD raw data.
 
- Public Member Functions inherited from mdf::IBlock
virtual ~IBlock ()=default
 Default destructor.
 
virtual int64_t Index () const =0
 File position within the file.
 
virtual std::string BlockType () const =0
 Returns the block type.
 

Protected Member Functions

 ~IDataGroup () override=default
 Default destructor.
 
void InitFastObserverList ()
 The function optimize the observer list before reading data.
 

Protected Attributes

std::vector< ISampleObserver * > observer_list_
 List of observers.
 
std::map< uint64_t, std::vector< ISampleObserver * > > fast_observer_list_
 The fast observer list is used internally when reading data.
 

Detailed Description

The data group block is the entry point for a measurement. The header (HD) block is the entry point for a test. A test consist of one or more measurements (DG).

Each measurement is defined by one or more channel groups (CG). The channel group in turn, consist of one or more channels. The group have an unique record ID.

A record is a byte array with fixed length and hold one sample for each channel in the group. The DG block also points to the data blocks (DT) which is an array of sample records.

In MDF version 3, data was always stored as raw bytes in a DT block. In version 4 the DT block may be split, reorganized and compressed.

Member Function Documentation

◆ ClearData()

virtual void mdf::IDataGroup::ClearData ( )
virtual

Clear all sample and signal data buffers. Call this function when no need of any signal data (SD) or sample reduction (SR) data are needed. This reduce memory usage if more DG blocks should read in data bytes.

◆ InitFastObserverList()

void mdf::IDataGroup::InitFastObserverList ( )
protected

The function is called before reading any data in the file. The purpose is optimize the read speed of files with many sample. The function is used internally only.

◆ IsSubscribingOnChannel()

bool mdf::IDataGroup::IsSubscribingOnChannel ( const IChannel & channel) const
nodiscard
Parameters
channelReference to the channel.
Returns
True if the observer list subscribe on this channel.

◆ IsSubscribingOnChannelVlsd()

bool mdf::IDataGroup::IsSubscribingOnChannelVlsd ( const IChannel & channel) const
nodiscard
Parameters
channelReference to the channel.
Returns
True if the observer list subscribe on this channels VLSD raw data .

◆ IsSubscribingOnRecord()

bool mdf::IDataGroup::IsSubscribingOnRecord ( uint64_t record_id) const
nodiscard
Parameters
record_idRecord ID of the channel group
Returns
True if the observer list subscribe on this channel group.

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