nidas
v1.2-1520
|
A source of samples. More...
#include <SampleSourceSupport.h>
Public Member Functions | |
SampleSourceSupport (bool raw) | |
SampleSourceSupport (const SampleSourceSupport &x) | |
Copy OK. More... | |
virtual | ~SampleSourceSupport () |
SampleSource * | getRawSampleSource () |
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples. More... | |
SampleSource * | getProcessedSampleSource () |
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples. 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 *c) throw () |
Add a SampleClient to this SampleSource. More... | |
void | removeSampleClient (SampleClient *c) throw () |
Remove a SampleClient from this SampleSource This will also remove a SampleClient if it has been added with addSampleClientForTag(). More... | |
void | addSampleClientForTag (SampleClient *c, const SampleTag *) throw () |
Add a SampleClient to this SampleSource. More... | |
void | removeSampleClientForTag (SampleClient *c, const SampleTag *) throw () |
Add a SampleClient to this SampleSource. More... | |
int | getClientCount () const throw () |
How many SampleClients are currently in my list. More... | |
void | removeAllSampleClients () throw () |
Big cleanup. More... | |
void | distribute (const Sample *s) throw () |
Distribute a sample to my clients, calling the receive() method of each client, passing the const pointer to the Sample. More... | |
void | distribute (const std::list< const Sample * > &samps) throw () |
Distribute a list of samples to my clients. More... | |
void | flush () throw () |
This implementation of SampleSource::flush() does nothing. More... | |
const SampleStats & | getSampleStats () const |
void | setKeepStats (bool val) |
bool | getKeepStats () const |
Private Member Functions | |
SampleSourceSupport & | operator= (const SampleSourceSupport &x) |
No assignment. More... | |
Private Attributes | |
nidas::util::Mutex | _tagsMutex |
std::list< const SampleTag * > | _sampleTags |
SampleClientList | _clients |
Current clients of all samples. More... | |
std::map< dsm_sample_id_t, SampleClientList > | _clientsBySampleId |
Current clients of specific samples. More... | |
std::set< SampleClient * > | _clientSet |
nidas::util::Mutex | _clientMapLock |
SampleStats | _stats |
bool | _raw |
bool | _keepStats |
A source of samples.
A SampleSource maintains a list of SampleClients. When a SampleSource has a Sample ready, it will call the receive method of all its SampleClients. SampleClients register/unregister with a SampleSource via the addSampleClient/removeSampleClient methods.
SampleSourceSupport::SampleSourceSupport | ( | bool | raw | ) |
SampleSourceSupport::SampleSourceSupport | ( | const SampleSourceSupport & | x | ) |
Copy OK.
A shallow copy, the SampleTags are copied to the new instance, but the SampleClients are not.
|
inlinevirtual |
|
virtual |
Add a SampleClient to this SampleSource.
The pointer to the SampleClient must remain valid, until after it is removed.
Implements nidas::core::SampleSource.
Referenced by nidas::core::NearestResampler::addSampleClient(), nidas::core::SampleAverager::addSampleClient(), nidas::core::SampleBuffer::addSampleClient(), nidas::core::SampleSorter::addSampleClient(), nidas::core::NearestResamplerAtRate::addSampleClient(), nidas::core::SampleIOProcessor::addSampleClient(), nidas::dynld::SampleInputStream::addSampleClient(), nidas::core::DSMSensor::addSampleClient(), nidas::core::NearestResampler::addSampleClientForTag(), nidas::core::SampleAverager::addSampleClientForTag(), and nidas::core::NearestResamplerAtRate::addSampleClientForTag().
|
virtual |
Add a SampleClient to this SampleSource.
The pointer to the SampleClient must remain valid, until after it is removed.
Implements nidas::core::SampleSource.
References nidas::core::SampleClientList::add().
Referenced by nidas::core::SampleBuffer::addSampleClientForTag(), nidas::core::SampleSorter::addSampleClientForTag(), nidas::core::SampleIOProcessor::addSampleClientForTag(), nidas::dynld::SampleInputStream::addSampleClientForTag(), and nidas::core::DSMSensor::addSampleClientForTag().
|
virtual |
Add a SampleTag to this SampleSource.
This SampleSource does not own the SampleTag.
Implements nidas::core::SampleSource.
Referenced by nidas::core::SampleBuffer::addSampleTag(), nidas::core::SampleSorter::addSampleTag(), nidas::core::SampleAverager::addSampleTag(), nidas::core::NearestResampler::addSampleTag(), nidas::core::NearestResamplerAtRate::addSampleTag(), nidas::dynld::SampleInputStream::addSampleTag(), nidas::dynld::raf::SyncRecordSource::addSampleTag(), and nidas::core::DSMSensor::fromDOMElement().
void SampleSourceSupport::distribute | ( | const Sample * | s | ) | |
throw | ( | ||||
) |
Distribute a sample to my clients, calling the receive() method of each client, passing the const pointer to the Sample.
Does a s->freeReference() on the sample when done, which means you should assume that the pointer to the Sample is invalid after the call to distribute(), unless the owner has done an additional holdReference(). If so, it is very bad form to make any changes to Sample after the distribute() - the clients may get a half-changed Sample.
References nidas::core::SampleClientList::begin(), and nidas::core::SampleClientList::end().
Referenced by nidas::dynld::StatisticsCruncher::computeStats(), nidas::dynld::SampleInputStream::distribute(), nidas::core::DSMSensor::distributeRaw(), nidas::core::SampleAverager::flush(), nidas::core::NearestResampler::flush(), nidas::dynld::SampleInputStream::flush(), nidas::dynld::isff::PacketInputStream::readSamples(), nidas::dynld::SampleInputStream::readSamples(), nidas::core::DSMSensor::readSamples(), nidas::core::SampleBuffer::run(), nidas::core::SampleSorter::run(), nidas::dynld::raf::SyncRecordSource::sendSyncHeader(), and nidas::dynld::raf::SyncRecordSource::sendSyncRecord().
void SampleSourceSupport::distribute | ( | const std::list< const Sample * > & | samps | ) | |
throw | ( | ||||
) |
Distribute a list of samples to my clients.
Calls receive() method of each client, passing the pointer to the Sample. Does a s->freeReference() on each sample in the list.
|
inlinevirtual |
This implementation of SampleSource::flush() does nothing.
Implements nidas::core::SampleSource.
|
virtual |
How many SampleClients are currently in my list.
Implements nidas::core::SampleSource.
References _clientSet.
Referenced by nidas::dynld::SampleInputStream::flush(), nidas::core::NearestResampler::getClientCount(), nidas::core::SampleAverager::getClientCount(), nidas::core::SampleBuffer::getClientCount(), nidas::core::SampleSorter::getClientCount(), nidas::core::NearestResamplerAtRate::getClientCount(), nidas::core::SampleIOProcessor::getClientCount(), nidas::dynld::SampleInputStream::getClientCount(), and nidas::core::DSMSensor::getClientCount().
|
inline |
References _keepStats.
Referenced by nidas::core::SampleBuffer::getKeepStats(), and nidas::core::SampleSorter::getKeepStats().
|
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 _raw.
Referenced by nidas::core::SampleBuffer::getProcessedSampleSource(), nidas::core::SampleSorter::getProcessedSampleSource(), and nidas::dynld::SampleInputStream::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 raw samples.
Implements nidas::core::SampleSource.
References _raw.
Referenced by nidas::core::SampleSorter::flush(), nidas::core::SampleBuffer::getRawSampleSource(), nidas::core::SampleSorter::getRawSampleSource(), nidas::dynld::SampleInputStream::getRawSampleSource(), nidas::core::SampleBuffer::run(), and nidas::core::SampleSorter::run().
|
inlinevirtual |
Implements nidas::core::SampleSource.
References _stats.
Referenced by nidas::core::NearestResampler::getSampleStats(), nidas::core::SampleAverager::getSampleStats(), nidas::core::SampleBuffer::getSampleStats(), nidas::core::SampleSorter::getSampleStats(), nidas::core::SampleIOProcessor::getSampleStats(), nidas::core::NearestResamplerAtRate::getSampleStats(), nidas::dynld::SampleInputStream::getSampleStats(), and nidas::core::DSMSensor::getSampleStats().
|
virtual |
Implements nidas::core::SampleSource.
Referenced by nidas::core::NearestResampler::getSampleTagIterator(), nidas::core::SampleAverager::getSampleTagIterator(), nidas::core::SampleBuffer::getSampleTagIterator(), nidas::core::SampleSorter::getSampleTagIterator(), nidas::core::NearestResamplerAtRate::getSampleTagIterator(), nidas::core::SampleIOProcessor::getSampleTagIterator(), and nidas::dynld::SampleInputStream::getSampleTagIterator().
|
virtual |
What SampleTags am I a SampleSource for?
Implements nidas::core::SampleSource.
References _sampleTags, and _tagsMutex.
Referenced by nidas::core::NearestResampler::getSampleTags(), nidas::core::SampleAverager::getSampleTags(), nidas::core::SampleBuffer::getSampleTags(), nidas::core::SampleSorter::getSampleTags(), nidas::core::NearestResamplerAtRate::getSampleTags(), nidas::core::SampleIOProcessor::getSampleTags(), nidas::dynld::SampleInputStream::getSampleTags(), and nidas::core::DSMSensor::getSampleTags().
|
private |
No assignment.
|
inline |
Big cleanup.
References _clientMapLock, _clients, _clientSet, nidas::util::Mutex::lock(), nidas::core::SampleClientList::removeAll(), and nidas::util::Mutex::unlock().
|
virtual |
Remove a SampleClient from this SampleSource This will also remove a SampleClient if it has been added with addSampleClientForTag().
Implements nidas::core::SampleSource.
Referenced by nidas::core::NearestResampler::removeSampleClient(), nidas::core::SampleAverager::removeSampleClient(), nidas::core::SampleBuffer::removeSampleClient(), nidas::core::SampleSorter::removeSampleClient(), nidas::core::NearestResamplerAtRate::removeSampleClient(), nidas::core::SampleIOProcessor::removeSampleClient(), nidas::dynld::SampleInputStream::removeSampleClient(), nidas::core::DSMSensor::removeSampleClient(), nidas::core::NearestResampler::removeSampleClientForTag(), nidas::core::SampleAverager::removeSampleClientForTag(), and nidas::core::NearestResamplerAtRate::removeSampleClientForTag().
|
virtual |
Add a SampleClient to this SampleSource.
The pointer to the SampleClient must remain valid, until after it is removed.
Implements nidas::core::SampleSource.
Referenced by nidas::core::SampleBuffer::removeSampleClientForTag(), nidas::core::SampleSorter::removeSampleClientForTag(), nidas::core::SampleIOProcessor::removeSampleClientForTag(), nidas::dynld::SampleInputStream::removeSampleClientForTag(), and nidas::core::DSMSensor::removeSampleClientForTag().
|
virtual |
Implements nidas::core::SampleSource.
Referenced by nidas::core::SampleBuffer::removeSampleTag(), nidas::core::SampleSorter::removeSampleTag(), nidas::core::SampleAverager::removeSampleTag(), nidas::core::NearestResampler::removeSampleTag(), nidas::core::NearestResamplerAtRate::removeSampleTag(), and nidas::dynld::SampleInputStream::removeSampleTag().
|
inline |
References _keepStats.
Referenced by nidas::core::SampleBuffer::setKeepStats(), nidas::core::SampleSorter::setKeepStats(), and nidas::dynld::SampleInputStream::setKeepStats().
|
private |
Referenced by removeAllSampleClients().
|
private |
Current clients of all samples.
Referenced by removeAllSampleClients().
|
private |
Current clients of specific samples.
|
private |
Referenced by getClientCount(), and removeAllSampleClients().
|
private |
Referenced by getKeepStats(), and setKeepStats().
|
private |
Referenced by getProcessedSampleSource(), and getRawSampleSource().
|
private |
Referenced by getSampleTags().
|
private |
Referenced by getSampleStats().
|
mutableprivate |
Referenced by getSampleTags().