Logo Search packages:      
Sourcecode: libgdf version File versions  Download package

Public Member Functions | Private Member Functions | Private Attributes

gdf::Writer Class Reference

Class for writing GDF files to disc. More...

#include <Writer.h>

Inheritance diagram for gdf::Writer:
Inheritance graph
[legend]
Collaboration diagram for gdf::Writer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

RecordacquireRecord ()
 Get pointer to a fresh Record.
void addEvent (const Mode1Event &ev)
 Add a Mode 1 Event.
void addEvent (uint32 position, uint16 type)
 Add a Mode 1 Event.
void addEvent (const Mode3Event &ev)
 Add a Mode 3 Event.
void addEvent (uint32 position, uint16 type, uint16 channel, uint32 duration)
 Add a Mode 3 Event.
void addEvent (uint32 position, uint16 type, uint16 channel, float32 value)
 Add a Mode 3 Event.
void addRecord (Record *r)
 Add a complete Record.
void addSamplePhys (const size_t channel_idx, const float64 value)
 Add sample in physical units to a channel.
template<typename T >
void addSampleRaw (const size_t channel_idx, const T value)
 Add a raw sample to channel.
void blitFromSerialBufferPhys (const double *buf, const std::vector< size_t > &samples_per_channel)
 Blit data from a serial buffer.
void blitSamplesPhys (const size_t channel_idx, const std::vector< float64 > &values)
 Blit a number of samples in physical units to channel.
void blitSamplesPhys (const size_t channel_idx, const float64 *values, size_t num)
 Blit a number of samples in physical units to channel.
template<typename T >
void blitSamplesRaw (const size_t channel_idx, const T *values, size_t num)
 Blit a number of raw samples to channel.
template<typename T >
void blitSamplesRaw (const size_t channel_idx, const std::vector< T > &values)
 Blit a number of raw samples to channel.
void close ()
 Close file.
bool createSignal (size_t index, bool throwexc=false)
 Create a signal.
void flush ()
 writes all full records from buffer to disc
size_t getFirstFreeSignalIndex ()
 get lowest signal index that can be created
GDFHeaderAccessgetHeaderAccess ()
 get reference to main header
const GDFHeaderAccessgetHeaderAccess_readonly () const
 get Constant reference to header access
MainHeadergetMainHeader ()
 get reference to main header
const MainHeadergetMainHeader_readonly () const
 get Constant reference to main header
size_t getNumSignals () const
SignalHeadergetSignalHeader (size_t idx)
 get reference to a signal's header
const SignalHeadergetSignalHeader_readonly (size_t idx) const
 get constant reference to a signal's header
bool isOpen ()
 Check if file is open.
void open (const std::string filename, const int flags=writer_ev_file)
 Opens file for writing and writes Header.
void open (const int flags=writer_ev_file)
 Opens file for writing and writes Header.
void relocateSignal (size_t src, size_t dst)
 Change signal index.
void setEventMode (uint8 mode)
 Set Event Mode.
void setEventSamplingRate (float32 fs=-1)
 Set Sampling Rate associated with event positions.
void setFilename (std::string filename)
 set filename for later opening
void setMaxFullRecords (size_t num)
 Set number of full records that are kept in memory before the buffer is flushed.
void swapSignals (size_t a, size_t b)
 Swap to signals.
 Writer ()
 Constructor.
void writeRecordDirect (Record *r)
 writes record to disc
virtual ~Writer ()
 Destructor.

Private Member Functions

virtual void triggerRecordFull (Record *rec)
 record full handler
void writeEvents ()
 write events from buffer to file
void writeRecord ()
 write first full record from record buffer to disk

Private Attributes

std::fstream m_evbuf_file
std::stringstream m_evbuf_memory
std::iostream m_eventbuffer
int m_eventbuffermemory
std::fstream m_file
std::string m_filename
GDFHeaderAccess m_header
int64 m_num_datarecords
RecordBuffer m_recbuf
size_t max_full_records

Detailed Description

Class for writing GDF files to disc.

Events are buffered and appended to the file when calling close( ). By default events are buffered in a separate file named filename.events. Thus, information may be recovered after computer crashes during long online recordings. The user may chose to buffer events in memory instead (see open()).

Definition at line 44 of file Writer.h.


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

Generated by  Doxygen 1.6.0   Back to index