libGDF
gdf::RecordBuffer Class Reference

Buffers incomplete records before they are written to disk. More...

#include <RecordBuffer.h>

Data Structures

class  RecordFullHandler

Public Member Functions

 RecordBuffer (const GDFHeaderAccess *gdfh)
 Constructor.
virtual ~RecordBuffer ()
 Destructor.
void clearBuffers ()
 Clear all buffers.
void reset ()
 Resets the buffer to a valid initial state.
void handleChannelFull (const size_t channel_idx)
 Called when a channel becomes full.
void handleRecordFull ()
 Called when a record becomes full.
void registerRecordFullCallback (RecordFullHandler *h)
 Register Callback for record full event.
void unregisterRecordFullCallback (RecordFullHandler *h)
 Unegister Callback for record full event.
void addSamplePhys (const size_t channel_idx, const double value)
 Add a physical sample to the channel specified by channel_idx.
template<typename T >
void addSampleRaw (const size_t channel_idx, const T rawval)
 Add a raw sample to the channel specified by channel_idx.
void blitSamplesPhys (const size_t channel_idx, const double *values, size_t num)
 Blit a number of physical samples into channel specified by channel_idx.
template<typename T >
void blitSamplesRaw (const size_t channel_idx, const T *values, size_t num)
 Blit a number of raw samples into channel specified by channel_idx.
void fillPhys (const size_t channel_idx, const double value, size_t num)
 Fill a number of samples with the same physical value.
template<typename T >
void fillRaw (const size_t channel_idx, const T value, size_t num)
 Fill a number of samples with the same raw value.
void addRecord (Record *r)
 Add a complete Record.
RecordacquireRecord ()
 Returns a reference to a free record.
std::list< Record * >::iterator createNewRecord ()
 Put a new record to the end of the list.
RecordgetFirstFullRecord ()
 Reference to first (oldest) full record in list. This is also the first record that gets filled.
void removeFirstFullRecord ()
 Remove first full record in list.
size_t getNumFullRecords () const
 Get number of full records in the buffer.
size_t getNumPartialRecords () const
 Get number of partially filled records currently in the list.
ChannelgetValidChannel (const size_t channel_idx)
 Returns reference to channel specified by channel_idx.
size_t getNumFreeAlloc (const size_t channel_idx)
 Gets number of free samples currently allocated for this channel.
void flood ()
 Fills all partial records with default values.

Detailed Description

Buffers incomplete records before they are written to disk.

When saving data, one or more channels can be ahead of the others, and may even extend over multiple records. RecordBuffer takes care of this by creating a new record as soon a channel exceeds it's capacity.

Definition at line 37 of file RecordBuffer.h.


Member Function Documentation

Returns a reference to a free record.

Use this instead of 'new Record()'.

Definition at line 168 of file RecordBuffer.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Add a complete Record.

There may not be any partial records in the buffer in order to add a complete record.

Definition at line 153 of file RecordBuffer.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Channel * gdf::RecordBuffer::getValidChannel ( const size_t  channel_idx)

Returns reference to channel specified by channel_idx.

If channel does not exist gdf::nonexistent_channel_access::nonexistent_channel_access is thrown. A new record is created if the channelhead points to the end of the record list.

Definition at line 210 of file RecordBuffer.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void gdf::RecordBuffer::handleChannelFull ( const size_t  channel_idx)

Called when a channel becomes full.

This function advances the write pointer m_channelhead for this channel to the next record. If there is no next record, a new one is created. Also checks if the current record is full and performs calls the respective handler.

Definition at line 82 of file RecordBuffer.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Called when a record becomes full.

Definition at line 94 of file RecordBuffer.cpp.

+ Here is the caller graph for this function:


The documentation for this class was generated from the following files:
 All Data Structures Functions Variables Friends