nidas  v1.2-1520
Public Member Functions | Private Member Functions | Private Attributes | List of all members
nidas::core::SamplePipeline Class Reference

SamplePipeline sorts samples that are coming from one or more inputs. More...

#include <SamplePipeline.h>

Inheritance diagram for nidas::core::SamplePipeline:
Inheritance graph
[legend]

Public Member Functions

 SamplePipeline ()
 
virtual ~SamplePipeline ()
 
std::string getName () const
 
SampleSourcegetRawSampleSource ()
 Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples. More...
 
SampleSourcegetProcessedSampleSource ()
 Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples. More...
 
void connect (SampleSource *src) throw ()
 Add an input to be merged and sorted. More...
 
void disconnect (SampleSource *src) throw ()
 Remove a SampleSource from the SamplePipeline. More...
 
void addSampleTag (const SampleTag *tag) throw ()
 Add a SampleTag to this SampleSource. More...
 
void removeSampleTag (const SampleTag *tag) throw ()
 
std::list< const SampleTag * > getSampleTags () const
 What SampleTags am I a SampleSource for? More...
 
SampleTagIterator getSampleTagIterator () const
 
void addSampleClient (SampleClient *client) throw ()
 Add a SampleClient that wants all processed samples. More...
 
void removeSampleClient (SampleClient *client) throw ()
 Remove a SampleClient from this SampleSource. More...
 
void addSampleClientForTag (SampleClient *, const SampleTag *) throw ()
 Add a SampleClient that wants samples which have been merged from various inputs, sorted, processed through a certain DSMSensor, and then re-sorted again. More...
 
void removeSampleClientForTag (SampleClient *, const SampleTag *) throw ()
 Remove a SampleClient for a given SampleTag from this SampleSource. More...
 
int getClientCount () const throw ()
 How many SampleClients are currently in my list. More...
 
void flush () throw ()
 Purge samples from the SampleSorters in this pipeline. More...
 
void interrupt ()
 Interrupt the SampleSorters in this pipeline. More...
 
void join () throw ()
 Join the SampleSorters in this pipeline. More...
 
void setRealTime (bool val)
 
bool getRealTime () const
 
const SampleStatsgetSampleStats () const
 
size_t getSorterNumRawSamples () const
 Number of raw samples currently in the sorter. More...
 
size_t getSorterNumProcSamples () const
 Number of processed samples currently in the sorter. More...
 
size_t getSorterNumRawBytes () const
 Current size in bytes of the raw sample sorter. More...
 
size_t getSorterNumProcBytes () const
 Current size in bytes of the processed sample sorter. More...
 
size_t getSorterNumRawBytesMax () const
 Current size in bytes of the raw sample sorter. More...
 
size_t getSorterNumProcBytesMax () const
 Current size in bytes of the processed sample sorter. More...
 
size_t getNumDiscardedRawSamples () const
 Number of raw samples discarded because sorter was getting too big. More...
 
size_t getNumDiscardedProcSamples () const
 Number of processed samples discarded because sorter was getting too big. More...
 
size_t getNumFutureRawSamples () const
 Number of raw samples discarded because their timetags were in the future. More...
 
size_t getNumFutureProcSamples () const
 Number of processed samples discarded because their timetags were in the future. More...
 
void setRawSorterLength (float val)
 Set length of raw SampleSorter, in seconds. More...
 
float getRawSorterLength () const
 
void setProcSorterLength (float val)
 Set length of processed SampleSorter, in seconds. More...
 
float getProcSorterLength () const
 
void setRawHeapMax (size_t val)
 Set the maximum amount of heap memory to use for sorting samples. More...
 
size_t getRawHeapMax () const
 
void setProcHeapMax (size_t val)
 Set the maximum amount of heap memory to use for sorting samples. More...
 
size_t getProcHeapMax () const
 
void setHeapBlock (bool val)
 
bool getHeapBlock () const
 
void setKeepStats (bool val)
 
void setRawLateSampleCacheSize (unsigned int val)
 Get the size of the late sample cache in the raw sample sorter. More...
 
unsigned int getRawLateSampleCacheSize () const
 Cache this number of samples with potentially anomalous, late time tags in the raw sample sorter. More...
 
void setProcLateSampleCacheSize (unsigned int val)
 Get the size of the late sample cache in the processed sample sorter. More...
 
unsigned int getProcLateSampleCacheSize () const
 Cache this number of samples with potentially anomalous, late time tags in the processed sample sorter. More...
 

Private Member Functions

void rawinit ()
 
void procinit ()
 
 SamplePipeline (const SamplePipeline &x)
 No copying. More...
 
SamplePipelineoperator= (const SamplePipeline &x)
 No assignment. More...
 

Private Attributes

std::string _name
 
nidas::util::Mutex _rawMutex
 
SampleThread_rawSorter
 
nidas::util::Mutex _procMutex
 
SampleThread_procSorter
 
std::list< const SampleTag * > _sampleTags
 
std::list< const DSMConfig * > _dsmConfigs
 
bool _realTime
 
float _rawSorterLength
 seconds More...
 
float _procSorterLength
 seconds More...
 
size_t _rawHeapMax
 
size_t _procHeapMax
 
bool _heapBlock
 
bool _keepStats
 
unsigned int _rawLateSampleCacheSize
 
unsigned int _procLateSampleCacheSize
 

Detailed Description

SamplePipeline sorts samples that are coming from one or more inputs.

SamplePipeline makes use of two SampleSorters, one called rawSorter and procSorter.

rawSorter is a client of one or more inputs (the text arrows show the sample flow):

input -—v input –> _rawSorter input -—^

After sorting the samples, rawSorter passes them on to the two types of SampleClients that have registered with SamplePipeline. SampleClients that have registered with SamplePipeline::addSampleClient will receive their raw samples directly from rawSorter.

rawSorter -> sampleClients

SampleClients that have registered with SamplePipeline::addProcessedSampleClient will receive their samples indirectly:

rawSorter -> sensor -> procSorter -> processedSampleClients

rawSorter provides sorting of the samples from the various inputs.

procSorter provides sorting of the processed samples. DSMSensors are apt to create processed samples with different time-tags than the input raw samples, therefore they need to be sorted again.

Multiple threads can be passing samples to the sorters. Thread exclusion is enforced when passing the samples to the SampleClient::receive() methods from either sorter, so the SampleClient::receive() methods don't have to worry about being re-entrant.

Constructor & Destructor Documentation

SamplePipeline::SamplePipeline ( )
SamplePipeline::~SamplePipeline ( )
virtual
nidas::core::SamplePipeline::SamplePipeline ( const SamplePipeline x)
private

No copying.

Member Function Documentation

void SamplePipeline::addSampleClient ( SampleClient client)
throw (
)
virtual
void SamplePipeline::addSampleClientForTag ( SampleClient client,
const SampleTag stag 
)
throw (
)
virtual

Add a SampleClient that wants samples which have been merged from various inputs, sorted, processed through a certain DSMSensor, and then re-sorted again.

Implementation of SampleSource::addSampleClient().

Implements nidas::core::SampleSource.

References nidas::core::DSMSensor::addSampleClient(), nidas::core::DSMSensor::addSampleClientForTag(), and nidas::core::DSMSensor::getRawSampleTag().

void nidas::core::SamplePipeline::addSampleTag ( const SampleTag )
throw (
)
inlinevirtual
void SamplePipeline::connect ( SampleSource src)
throw (
)
void SamplePipeline::disconnect ( SampleSource src)
throw (
)
void nidas::core::SamplePipeline::flush ( )
throw (
)
inlinevirtual

Purge samples from the SampleSorters in this pipeline.

This call will block, until both sorters are empty.

Implements nidas::core::SampleSource.

References _procSorter, _rawSorter, and nidas::core::SampleThread::flush().

Referenced by nidas::core::DSMEngine::interrupt(), StatsProcess::run(), DataPrep::run(), DataDump::run(), and DataStats::run().

int nidas::core::SamplePipeline::getClientCount ( ) const
throw (
)
inlinevirtual

How many SampleClients are currently in my list.

Implements nidas::core::SampleSource.

References _procSorter, and nidas::core::SampleSource::getClientCount().

bool nidas::core::SamplePipeline::getHeapBlock ( ) const
inline

References _heapBlock.

Referenced by procinit(), and rawinit().

std::string nidas::core::SamplePipeline::getName ( ) const
inline

References _name.

size_t nidas::core::SamplePipeline::getNumDiscardedProcSamples ( ) const
inline

Number of processed samples discarded because sorter was getting too big.

References _procSorter, and nidas::core::SampleThread::getNumDiscardedSamples().

Referenced by nidas::dynld::RawSampleService::printStatus().

size_t nidas::core::SamplePipeline::getNumDiscardedRawSamples ( ) const
inline

Number of raw samples discarded because sorter was getting too big.

References _rawSorter, and nidas::core::SampleThread::getNumDiscardedSamples().

Referenced by nidas::dynld::RawSampleService::printStatus().

size_t nidas::core::SamplePipeline::getNumFutureProcSamples ( ) const
inline

Number of processed samples discarded because their timetags were in the future.

References _procSorter, and nidas::core::SampleThread::getNumFutureSamples().

Referenced by nidas::dynld::RawSampleService::printStatus().

size_t nidas::core::SamplePipeline::getNumFutureRawSamples ( ) const
inline

Number of raw samples discarded because their timetags were in the future.

References _rawSorter, and nidas::core::SampleThread::getNumFutureSamples().

Referenced by nidas::dynld::RawSampleService::printStatus().

SampleSource* nidas::core::SamplePipeline::getProcessedSampleSource ( )
inlinevirtual

Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples.

SampleClients use this method to get a pointer to whatever sample source they are interested in. Derived classes can return NULL if they are not a SampleSource of processed samples.

Implements nidas::core::SampleSource.

References procinit().

Referenced by nidas::core::DSMEngine::closeOutputs(), nidas::core::DSMEngine::connectOutputs(), nidas::dynld::raf::SyncServer::init(), nidas::dynld::RawSampleService::printStatus(), StatsProcess::run(), DataPrep::run(), DataDump::run(), DataStats::run(), and nidas::dynld::raf::SyncServer::stop().

size_t nidas::core::SamplePipeline::getProcHeapMax ( ) const
inline

References _procHeapMax.

Referenced by procinit().

unsigned int nidas::core::SamplePipeline::getProcLateSampleCacheSize ( ) const
inline

Cache this number of samples with potentially anomalous, late time tags in the processed sample sorter.

See SampleSorter::setLateSampleCacheSize(val).

References _procLateSampleCacheSize.

Referenced by procinit().

float nidas::core::SamplePipeline::getProcSorterLength ( ) const
inline

References _procSorterLength.

Referenced by procinit().

size_t nidas::core::SamplePipeline::getRawHeapMax ( ) const
inline

References _rawHeapMax.

Referenced by rawinit().

unsigned int nidas::core::SamplePipeline::getRawLateSampleCacheSize ( ) const
inline

Cache this number of samples with potentially anomalous, late time tags in the raw sample sorter.

See SampleSorter::setLateSampleCacheSize(val).

References _rawLateSampleCacheSize.

Referenced by rawinit().

SampleSource* nidas::core::SamplePipeline::getRawSampleSource ( )
inlinevirtual

Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples.

SampleClients use this method to get a pointer to whatever sample source they are interested in. Derived classes can return NULL if they are not a SampleSource of raw samples.

Implements nidas::core::SampleSource.

References _rawSorter, and rawinit().

Referenced by nidas::core::DSMEngine::closeOutputs(), nidas::core::DSMEngine::connectOutputs(), nidas::dynld::RawSampleService::printClock(), nidas::dynld::RawSampleService::printStatus(), and DataDump::run().

float nidas::core::SamplePipeline::getRawSorterLength ( ) const
inline

References _rawSorterLength.

Referenced by rawinit().

bool nidas::core::SamplePipeline::getRealTime ( ) const
inline

References _realTime.

Referenced by procinit(), and rawinit().

const SampleStats& nidas::core::SamplePipeline::getSampleStats ( ) const
inlinevirtual
SampleTagIterator nidas::core::SamplePipeline::getSampleTagIterator ( ) const
inlinevirtual
std::list<const SampleTag*> nidas::core::SamplePipeline::getSampleTags ( ) const
inlinevirtual

What SampleTags am I a SampleSource for?

Implements nidas::core::SampleSource.

References _procSorter, and nidas::core::SampleSource::getSampleTags().

size_t nidas::core::SamplePipeline::getSorterNumProcBytes ( ) const
inline

Current size in bytes of the processed sample sorter.

References _procSorter, and nidas::core::SampleThread::getHeapSize().

Referenced by nidas::dynld::RawSampleService::printStatus().

size_t nidas::core::SamplePipeline::getSorterNumProcBytesMax ( ) const
inline

Current size in bytes of the processed sample sorter.

References _procSorter, and nidas::core::SampleThread::getHeapMax().

Referenced by nidas::dynld::RawSampleService::printStatus().

size_t nidas::core::SamplePipeline::getSorterNumProcSamples ( ) const
inline

Number of processed samples currently in the sorter.

References _procSorter, and nidas::core::SampleThread::size().

Referenced by nidas::dynld::RawSampleService::printStatus().

size_t nidas::core::SamplePipeline::getSorterNumRawBytes ( ) const
inline

Current size in bytes of the raw sample sorter.

References _rawSorter, and nidas::core::SampleThread::getHeapSize().

Referenced by nidas::dynld::RawSampleService::printStatus().

size_t nidas::core::SamplePipeline::getSorterNumRawBytesMax ( ) const
inline

Current size in bytes of the raw sample sorter.

References _rawSorter, and nidas::core::SampleThread::getHeapMax().

Referenced by nidas::dynld::RawSampleService::printStatus().

size_t nidas::core::SamplePipeline::getSorterNumRawSamples ( ) const
inline

Number of raw samples currently in the sorter.

References _rawSorter, and nidas::core::SampleThread::size().

Referenced by nidas::dynld::RawSampleService::printStatus().

void SamplePipeline::interrupt ( )
void SamplePipeline::join ( )
throw (
)
SamplePipeline& nidas::core::SamplePipeline::operator= ( const SamplePipeline x)
private

No assignment.

void SamplePipeline::procinit ( )
private
void SamplePipeline::rawinit ( )
private
void SamplePipeline::removeSampleClient ( SampleClient c)
throw (
)
virtual
void SamplePipeline::removeSampleClientForTag ( SampleClient c,
const SampleTag  
)
throw (
)
virtual
void nidas::core::SamplePipeline::removeSampleTag ( const SampleTag tag)
throw (
)
inlinevirtual
void nidas::core::SamplePipeline::setHeapBlock ( bool  val)
inline
Parameters
valIf true, and heapSize exceeds heapMax, then wait for heapSize to be less then heapMax, which will block any SampleSources that are inserting samples into the raw buffer. If false, then discard any samples that are received while heapSize exceeds heapMax.
See Also
SampleSorter::setHeapBlock().

References _heapBlock.

Referenced by setRealTime().

void nidas::core::SamplePipeline::setKeepStats ( bool  val)
inline
void nidas::core::SamplePipeline::setProcHeapMax ( size_t  val)
inline

Set the maximum amount of heap memory to use for sorting samples.

Parameters
valMaximum size of heap in bytes.
See Also
SampleSorter::setHeapMax().

References _procHeapMax.

Referenced by nidas::dynld::raf::SyncServer::init(), nidas::core::DSMEngine::openSensors(), StatsProcess::run(), and DataPrep::run().

void nidas::core::SamplePipeline::setProcLateSampleCacheSize ( unsigned int  val)
inline

Get the size of the late sample cache in the processed sample sorter.

See SampleSorter::getLateSampleCacheSize(). Default: 0.

References _procLateSampleCacheSize.

Referenced by nidas::core::DSMEngine::openSensors(), and DataPrep::run().

void nidas::core::SamplePipeline::setProcSorterLength ( float  val)
inline
void nidas::core::SamplePipeline::setRawHeapMax ( size_t  val)
inline

Set the maximum amount of heap memory to use for sorting samples.

Parameters
valMaximum size of heap in bytes.
See Also
SampleSorter::setHeapMax().

References _rawHeapMax.

Referenced by nidas::dynld::raf::SyncServer::init(), nidas::core::DSMEngine::openSensors(), StatsProcess::run(), and DataPrep::run().

void nidas::core::SamplePipeline::setRawLateSampleCacheSize ( unsigned int  val)
inline

Get the size of the late sample cache in the raw sample sorter.

See SampleSorter::getLateSampleCacheSize(). Default: 0.

References _rawLateSampleCacheSize.

Referenced by nidas::core::DSMEngine::openSensors(), and DataPrep::run().

void nidas::core::SamplePipeline::setRawSorterLength ( float  val)
inline
void nidas::core::SamplePipeline::setRealTime ( bool  val)
inline

Member Data Documentation

std::list<const DSMConfig*> nidas::core::SamplePipeline::_dsmConfigs
private
bool nidas::core::SamplePipeline::_heapBlock
private

Referenced by getHeapBlock(), and setHeapBlock().

bool nidas::core::SamplePipeline::_keepStats
private

Referenced by procinit(), rawinit(), and setKeepStats().

std::string nidas::core::SamplePipeline::_name
private

Referenced by getName(), procinit(), and rawinit().

size_t nidas::core::SamplePipeline::_procHeapMax
private

Referenced by getProcHeapMax(), and setProcHeapMax().

unsigned int nidas::core::SamplePipeline::_procLateSampleCacheSize
private
nidas::util::Mutex nidas::core::SamplePipeline::_procMutex
private
SampleThread* nidas::core::SamplePipeline::_procSorter
private
float nidas::core::SamplePipeline::_procSorterLength
private

seconds

Referenced by getProcSorterLength(), and setProcSorterLength().

size_t nidas::core::SamplePipeline::_rawHeapMax
private

Referenced by getRawHeapMax(), and setRawHeapMax().

unsigned int nidas::core::SamplePipeline::_rawLateSampleCacheSize
private
nidas::util::Mutex nidas::core::SamplePipeline::_rawMutex
private
SampleThread* nidas::core::SamplePipeline::_rawSorter
private
float nidas::core::SamplePipeline::_rawSorterLength
private

seconds

Referenced by getRawSorterLength(), and setRawSorterLength().

bool nidas::core::SamplePipeline::_realTime
private

Referenced by getRealTime(), and setRealTime().

std::list<const SampleTag*> nidas::core::SamplePipeline::_sampleTags
private

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