CEBL  2.1
Public Member Functions | Protected Member Functions | Protected Attributes
EEGDataStream Class Reference

#include <EEGDataStream.hpp>

Public Member Functions

 EEGDataStream ()
virtual ~EEGDataStream ()
void start ()
void stop ()
void setSampleRate (int sr)
bool isStarted ()
int getSamplesAvailable ()
EEGData read (int samples)
 read and remove n samples from the buffer
EEGData readAll ()
 read all samples from the buffer and clear the buffer
- Public Member Functions inherited from TimeoutThread
 TimeoutThread ()
virtual ~TimeoutThread ()
bool isHalted ()
double getTimeoutLength ()
 get length of timeout in milliseconds
void setTimeoutLength (double l)
 set length of timeotu in milliseconds

Protected Member Functions

virtual void updater ()=0
virtual void onStart ()
virtual void onStop ()
- Protected Member Functions inherited from TimeoutThread
void timeoutStart ()
 start the thread
void haltAndJoin ()
 halt the thread and wait for it to finish
void sleep (double stime)
 sleep for stime in milliseconds

Protected Attributes

EEGData buffer
int sample_rate
- Protected Attributes inherited from TimeoutThread
boost::thread * updater_thread
 the thread object
bool is_started
 flag to indicate whether or not the thread is started
bool halt
 flag to order thread to halt on next iteration
bool halted
 flag to indicate whether or not thread has hlated
boost::mutex thread_lock
 mutex to lock the thread
double timeout_length
 how often updater is called

Detailed Description

EEGDataStream.cpp

Author:
Jeshua Bratman

Provides threaded buffer interface to a data source.

Definition at line 34 of file EEGDataStream.hpp.


Constructor & Destructor Documentation

EEGDataStream::EEGDataStream ( )

Definition at line 20 of file EEGDataStream.cpp.

EEGDataStream::~EEGDataStream ( )
virtual

Definition at line 27 of file EEGDataStream.cpp.


Member Function Documentation

int EEGDataStream::getSamplesAvailable ( )
inline

Definition at line 58 of file EEGDataStream.hpp.

References buffer, and EEGData::numSamples().

Referenced by DataSource::samplesAvailable().

bool EEGDataStream::isStarted ( )
inline

Reimplemented from TimeoutThread.

Definition at line 57 of file EEGDataStream.hpp.

References TimeoutThread::is_started.

Referenced by DataSource::isStarted(), and DataSource::sourceReady().

virtual void EEGDataStream::onStart ( )
inlineprotectedvirtual

Definition at line 45 of file EEGDataStream.hpp.

virtual void EEGDataStream::onStop ( )
inlineprotectedvirtual

Definition at line 46 of file EEGDataStream.hpp.

EEGData EEGDataStream::read ( int  samples)

read and remove n samples from the buffer

Definition at line 36 of file EEGDataStream.cpp.

References cppR::submatrix().

Referenced by DataSource::read().

EEGData EEGDataStream::readAll ( )

read all samples from the buffer and clear the buffer

Definition at line 58 of file EEGDataStream.cpp.

References EEGData::clear().

Referenced by DataSource::clearSamples(), and DataSource::readAll().

void EEGDataStream::setSampleRate ( int  sr)
inline

Definition at line 55 of file EEGDataStream.hpp.

References sample_rate.

void EEGDataStream::start ( )

Definition at line 74 of file EEGDataStream.cpp.

Referenced by DataSource::start().

void EEGDataStream::stop ( )

Definition at line 88 of file EEGDataStream.cpp.

Referenced by DataSource::stop().

virtual void EEGDataStream::updater ( )
protectedpure virtual

Field Documentation

EEGData EEGDataStream::buffer
protected

Definition at line 40 of file EEGDataStream.hpp.

Referenced by getSamplesAvailable().

int EEGDataStream::sample_rate
protected

Definition at line 42 of file EEGDataStream.hpp.

Referenced by setSampleRate().


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