CEBL
2.1
|
#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 | |
![]() | |
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 () |
![]() | |
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 |
![]() | |
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 |
Provides threaded buffer interface to a data source.
Definition at line 34 of file EEGDataStream.hpp.
EEGDataStream::EEGDataStream | ( | ) |
Definition at line 20 of file EEGDataStream.cpp.
|
virtual |
Definition at line 27 of file EEGDataStream.cpp.
|
inline |
Definition at line 58 of file EEGDataStream.hpp.
References buffer, and EEGData::numSamples().
Referenced by DataSource::samplesAvailable().
|
inline |
Reimplemented from TimeoutThread.
Definition at line 57 of file EEGDataStream.hpp.
References TimeoutThread::is_started.
Referenced by DataSource::isStarted(), and DataSource::sourceReady().
|
inlineprotectedvirtual |
Definition at line 45 of file EEGDataStream.hpp.
|
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().
|
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().
|
protectedpure virtual |
|
protected |
Definition at line 40 of file EEGDataStream.hpp.
Referenced by getSamplesAvailable().
|
protected |
Definition at line 42 of file EEGDataStream.hpp.
Referenced by setSampleRate().