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

Public Member Functions | Protected Member Functions | Protected Attributes

gdf::Reader Class Reference

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

#include <Reader.h>

Inheritance diagram for gdf::Reader:
Inheritance graph
Collaboration diagram for gdf::Reader:
Collaboration graph

List of all members.

Public Member Functions

void close ()
 Close file.
void enableCache (bool b)
 Enable or disable cache.
size_t findRecord (uint16 channel_idx, size_t sample_idx)
 Find Record index to which a sample belongs.
EventHeadergetEventHeader ()
 get reference to event header
const GDFHeaderAccessgetHeaderAccess_readonly () const
 get Constant reference to header access
const MainHeadergetMainHeader_readonly () const
 get Constant reference to main header
RecordgetRecordPtr (size_t index)
 Returns a reference to Record.
double getSample (uint16 channel_idx, size_t sample_idx)
 Read a single Sample (physical units)
void getSignal (uint16 channel_idx, double *buffer, size_t start=0, size_t end=0)
 Read a single channel from file into buffer.
const SignalHeadergetSignalHeader_readonly (size_t idx) const
 get constant reference to a signal's header
void getSignals (std::vector< std::vector< double > > &buffer, double start_time=0, double end_time=-1, std::vector< uint16 > signal_indices=std::vector< uint16 >())
 Read Signals from file into buffer (physical units)
virtual void initCache ()
 Set cache to the correct size.
void open (const std::string filename)
 Opens file for reading.
void precacheRecords (size_t start, size_t end)
 Precache a range of Records.
 Reader ()
void readRecord (size_t index, Record *rec)
 Read directly into Record rec.
virtual void resetCache ()
 Reset cache to empty state.
virtual ~Reader ()

Protected Member Functions

void readEvents ()

Protected Attributes

bool m_cache_enabled
std::list< size_t > m_cache_entries
size_t m_event_offset
 Where data records start in the file.
std::ifstream m_file
std::string m_filename
GDFHeaderAccess m_header
std::vector< Record * > m_record_cache
size_t m_record_length
size_t m_record_offset
 Record length in bytes.

Detailed Description

Class for reading GDF files to disc.

Data Records are only read on demand and stay in memory until another file is opened or the Reader object is destroyed. This cache can be disabled. Then each data record is loaded from disk everytime it is accessed. This saves memory, but may severly decrease performance.

Definition at line 38 of file Reader.h.

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

Generated by  Doxygen 1.6.0   Back to index