27#ifndef NIDAS_CORE_SAMPLEBUFFER_H
28#define NIDAS_CORE_SAMPLEBUFFER_H
36namespace nidas {
namespace core {
144 void flush() throw();
A SampleClient that buffers its received samples, using a pair of STL vectors, and then sends the buf...
Definition SampleBuffer.h:44
SampleTagIterator getSampleTagIterator() const
Implementation of SampleSource::getSampleTagIterator().
Definition SampleBuffer.h:99
bool _doFlush
Definition SampleBuffer.h:313
void addSampleClient(SampleClient *client)
Implementation of SampleSource::addSampleClient().
Definition SampleBuffer.h:107
bool _heapBlock
_heapBlock controls what happens when the number of bytes in _samples exceeds _heapMax.
Definition SampleBuffer.h:292
size_t getNumFutureSamples() const
Number of samples discarded because their timetags were in the future.
Definition SampleBuffer.h:215
unsigned int getLateSampleCacheSize() const
Definition SampleBuffer.h:239
SampleSourceSupport _source
Definition SampleBuffer.h:257
void interrupt()
Interrupt this thread.
Definition SampleBuffer.cc:294
std::vector< const Sample * > * _inserterBuf
Definition SampleBuffer.h:253
void addSampleTag(const SampleTag *tag)
How to tell this SampleBuffer what sample tags it will be sorting.
Definition SampleBuffer.h:78
nidas::util::Cond _sampleBufCond
Definition SampleBuffer.h:266
int getClientCount() const
How many SampleClients are currently in my list.
Definition SampleBuffer.h:131
SampleBuffer(const std::string &name, bool raw)
Constructor.
Definition SampleBuffer.cc:41
SampleSource * getProcessedSampleSource()
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples.
Definition SampleBuffer.h:69
size_t _heapMax
Limit on the maximum size of memory to use while buffering samples.
Definition SampleBuffer.h:274
bool getRealTime() const
Definition SampleBuffer.h:230
void addSampleClientForTag(SampleClient *client, const SampleTag *tag)
Add a Client for a given SampleTag.
Definition SampleBuffer.h:121
std::vector< const Sample * > * _consumerBuf
Definition SampleBuffer.h:255
size_t _heapSize
Current heap size, in bytes.
Definition SampleBuffer.h:279
size_t _realTimeFutureSamples
Number of samples discarded because getRealTime() is true and the samples have timetags later than th...
Definition SampleBuffer.h:306
void setKeepStats(bool val)
Definition SampleBuffer.h:54
virtual ~SampleBuffer()
Definition SampleBuffer.cc:55
bool emptyNoLock() const
Definition SampleBuffer.cc:82
void removeSampleClientForTag(SampleClient *client, const SampleTag *tag)
Remove a SampleClient for a given SampleTag from this SampleSource.
Definition SampleBuffer.h:126
size_t _discardedSamples
Number of samples discarded because of _heapSize > _heapMax and heapBlock == true.
Definition SampleBuffer.h:300
void heapDecrement(size_t bytes)
Utility function to decrement the heap size after writing one or more samples.
Definition SampleBuffer.cc:317
std::list< const SampleTag * > getSampleTags() const
Implementation of SampleSource::getSampleTags().
Definition SampleBuffer.h:91
int _discardWarningCount
How often to log warnings about discardedSamples.
Definition SampleBuffer.h:311
bool receive(const Sample *s)
Insert a sample in the buffer, where it is then passed on to SampleClients.
Definition SampleBuffer.cc:334
bool _realTime
Is this sorter running in real-time? If so then we can screen for bad time-tags by checking against t...
Definition SampleBuffer.h:322
nidas::util::Cond _flushCond
Definition SampleBuffer.h:268
size_t sizeNoLock() const
Definition SampleBuffer.cc:77
size_t getHeapSize() const
Get the current amount of heap being used for sorting.
Definition SampleBuffer.h:187
void setHeapBlock(bool val)
Definition SampleBuffer.h:196
void setHeapMax(size_t val)
Set the maximum amount of heap memory to use for sorting samples.
Definition SampleBuffer.h:180
void setLengthSecs(float)
Definition SampleBuffer.h:167
const SampleStats & getSampleStats() const
Definition SampleBuffer.h:136
size_t size() const
Current number of samples in the buffer.
Definition SampleBuffer.cc:71
size_t getNumDiscardedSamples() const
Number of samples discarded because of _heapSize > _heapMax and heapBlock == true.
Definition SampleBuffer.h:206
void setLateSampleCacheSize(unsigned int)
Definition SampleBuffer.h:235
SampleBuffer(const SampleBuffer &)
No copy.
SampleBuffer & operator=(const SampleBuffer &)
No assignment.
std::vector< const Sample * > _sampleBufs[2]
Definition SampleBuffer.h:251
void setRealTime(bool val)
Is this sorter running in real-time? If so then we can screen for bad time-tags by checking against t...
Definition SampleBuffer.h:225
nidas::util::Cond _heapCond
Definition SampleBuffer.h:294
SampleSource * getRawSampleSource()
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples.
Definition SampleBuffer.h:64
float getLengthSecs() const
Definition SampleBuffer.h:171
int run()
Thread run function.
Definition SampleBuffer.cc:90
bool getKeepStats() const
Definition SampleBuffer.h:59
bool _flushed
Definition SampleBuffer.h:315
void flush()
flush all samples from buffer, distributing them to SampleClients.
Definition SampleBuffer.cc:348
size_t getHeapMax() const
Definition SampleBuffer.h:182
bool getHeapBlock() const
Definition SampleBuffer.h:198
void removeSampleClient(SampleClient *client)
Remove a SampleClient from this SampleSource.
Definition SampleBuffer.h:112
void removeSampleTag(const SampleTag *tag)
Definition SampleBuffer.h:83
Pure virtual interface of a client of Samples.
Definition SampleClient.h:38
A source of samples.
Definition SampleSourceSupport.h:47
bool getKeepStats() const
Definition SampleSourceSupport.h:159
void removeSampleClient(SampleClient *c)
Remove a SampleClient from this SampleSource This will also remove a SampleClient if it has been adde...
Definition SampleSourceSupport.cc:88
SampleSource * getRawSampleSource()
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples.
Definition SampleSourceSupport.h:60
void removeSampleClientForTag(SampleClient *c, const SampleTag *)
Add a SampleClient to this SampleSource.
Definition SampleSourceSupport.cc:121
void addSampleClientForTag(SampleClient *c, const SampleTag *)
Add a SampleClient to this SampleSource.
Definition SampleSourceSupport.cc:101
void addSampleClient(SampleClient *c)
Add a SampleClient to this SampleSource.
Definition SampleSourceSupport.cc:80
SampleSource * getProcessedSampleSource()
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples.
Definition SampleSourceSupport.h:66
void setKeepStats(bool val)
Definition SampleSourceSupport.h:154
SampleTagIterator getSampleTagIterator() const
Definition SampleSourceSupport.cc:75
int getClientCount() const
How many SampleClients are currently in my list.
Definition SampleSourceSupport.cc:136
void removeSampleTag(const SampleTag *tag)
Definition SampleSourceSupport.cc:67
const SampleStats & getSampleStats() const
Definition SampleSourceSupport.h:149
void addSampleTag(const SampleTag *tag)
Add a SampleTag to this SampleSource.
Definition SampleSourceSupport.cc:60
std::list< const SampleTag * > getSampleTags() const
What SampleTags am I a SampleSource for?
Definition SampleSourceSupport.cc:54
Pure virtual interface for a source of Samples.
Definition SampleSource.h:48
A source of samples.
Definition SampleStats.h:41
Class for iterating over the SampleTags of a Project, Site, DSMConfig, or a SampleSource.
Definition NidsIterators.h:218
Class describing a group of variables that are sampled and handled together.
Definition SampleTag.h:88
Interface for a Thread for buffering samples.
Definition SampleThread.h:54
Interface to a data sample.
Definition Sample.h:190
A wrapper class for a Posix condition variable.
Definition ThreadSupport.h:258
Sample * getSample(sampleType type, unsigned int len)
A convienence method for getting a sample of an enumerated type from a pool.
Definition Sample.cc:70
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31