27#ifndef NIDAS_CORE_SAMPLESORTER_H
28#define NIDAS_CORE_SAMPLESORTER_H
34namespace nidas {
namespace core {
158 void flush() throw();
Pure virtual interface of a client of Samples.
Definition SampleClient.h:38
A SampleClient that sorts its received samples, using an STL multiset, and then sends the sorted samp...
Definition SampleSorter.h:52
bool getKeepStats() const
Definition SampleSorter.h:71
long long _maxSorterLengthUsec
Definition SampleSorter.h:374
SampleT< char > _dummy
Definition SampleSorter.h:365
void flush()
Implementation of SampleSource::flush().
Definition SampleSorter.cc:431
unsigned int _lateSampleCacheSize
Definition SampleSorter.h:376
size_t _heapSize
Current heap size, in bytes.
Definition SampleSorter.h:311
void interrupt()
Interrupt sorting thread.
Definition SampleSorter.cc:364
size_t getHeapMax() const
Definition SampleSorter.h:195
void setHeapMax(size_t val)
Set the maximum amount of heap memory to use for sorting samples.
Definition SampleSorter.h:193
int getClientCount() const
How many SampleClients are currently in my list.
Definition SampleSorter.h:143
size_t size() const
Current number of samples in the sorter.
Definition SampleSorter.h:177
bool _flushed
Definition SampleSorter.h:363
SortedSampleSet _samples
Definition SampleSorter.h:289
nidas::util::Cond _sampleSetCond
Definition SampleSorter.h:298
int run()
Thread run function.
Definition SampleSorter.cc:141
void addSampleClientForTag(SampleClient *client, const SampleTag *tag)
Add a Client for a given SampleTag.
Definition SampleSorter.h:133
bool _realTime
Is this sorter running in real-time? If so then we can screen for bad time-tags by checking against t...
Definition SampleSorter.h:372
size_t _heapMax
Limit on the maximum size of memory to use while buffering samples.
Definition SampleSorter.h:306
size_t getHeapSize() const
Get the current amount of heap being used for sorting.
Definition SampleSorter.h:200
nidas::util::Cond _heapCond
Definition SampleSorter.h:326
unsigned int _discardedSamples
Number of samples discarded because of _heapSize > _heapMax and heapBlock == true.
Definition SampleSorter.h:334
void removeSampleClientForTag(SampleClient *client, const SampleTag *tag)
Remove a SampleClient for a given SampleTag from this SampleSource.
Definition SampleSorter.h:138
float getLengthSecs() const
Definition SampleSorter.h:184
SampleTagIterator getSampleTagIterator() const
Implementation of SampleSource::getSampleTagIterator().
Definition SampleSorter.h:111
std::list< const SampleTag * > getSampleTags() const
Implementation of SampleSource::getSampleTags().
Definition SampleSorter.h:103
int _discardWarningCount
How often to log warnings about discardedSamples.
Definition SampleSorter.h:354
bool receive(const Sample *s)
Implementation of SampleClient::receive().
Definition SampleSorter.cc:504
size_t getNumFutureSamples() const
Number of samples discarded because their timetags were in the future.
Definition SampleSorter.h:226
int _earlyWarningCount
How often to log warnings about early samples.
Definition SampleSorter.h:359
SampleSorter & operator=(const SampleSorter &)
No assignment.
SampleSource * getRawSampleSource()
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples.
Definition SampleSorter.h:76
nidas::util::Cond _flushCond
Definition SampleSorter.h:300
unsigned int _earlySamples
Samples which are earlier than the current latest sample in the sorter minus the sorter length.
Definition SampleSorter.h:349
bool _heapBlock
_heapBlock controls what happens when the number of bytes in _samples exceeds _heapMax.
Definition SampleSorter.h:324
void setHeapBlock(bool val)
Definition SampleSorter.h:209
void setLateSampleCacheSize(unsigned int val)
When aging-off samples, cache this number of samples with the latest time tags.
Definition SampleSorter.h:263
void setLengthSecs(float val)
Definition SampleSorter.h:179
void heapDecrement(size_t bytes)
Utility function to decrement the heap size after writing one or more samples.
Definition SampleSorter.cc:403
bool getRealTime() const
Definition SampleSorter.h:248
void addSampleTag(const SampleTag *tag)
How to tell this SampleSorter what sample tags it will be sorting.
Definition SampleSorter.h:90
SampleSorter(const std::string &name, bool raw)
Constructor.
Definition SampleSorter.cc:83
unsigned int _realTimeFutureSamples
Number of samples discarded because getRealTime() is true and the samples have timetags later than th...
Definition SampleSorter.h:340
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 SampleSorter.h:243
void removeSampleTag(const SampleTag *tag)
Definition SampleSorter.h:95
void addSampleClient(SampleClient *client)
Implementation of SampleSource::addSampleClient().
Definition SampleSorter.h:119
void removeSampleClient(SampleClient *client)
Remove a SampleClient from this SampleSource.
Definition SampleSorter.h:124
const SampleStats & getSampleStats() const
Definition SampleSorter.h:148
size_t getNumDiscardedSamples() const
Number of samples discarded because of _heapSize > _heapMax and heapBlock == true.
Definition SampleSorter.h:217
bool _heapExceeded
Definition SampleSorter.h:328
SampleSource * getProcessedSampleSource()
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples.
Definition SampleSorter.h:81
SampleSorter(const SampleSorter &)
No copy.
bool getHeapBlock() const
Definition SampleSorter.h:211
void setKeepStats(bool val)
Definition SampleSorter.h:66
unsigned int _sorterLengthUsec
Length of SampleSorter, in micro-seconds.
Definition SampleSorter.h:287
size_t getNumEarlySamples() const
Number of early samples, which may not be sorted.
Definition SampleSorter.h:234
SampleSourceSupport _source
Definition SampleSorter.h:275
bool _doFlush
Definition SampleSorter.h:361
virtual ~SampleSorter()
Definition SampleSorter.cc:103
unsigned int getLateSampleCacheSize() const
Definition SampleSorter.h:268
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
std::multiset< const Sample *, SampleTimetagComparator > SortedSampleSet
A multiset for storing samples sorted by timetag.
Definition SortedSampleSet.h:107
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
#define USECS_PER_SEC
Definition ublox.cc:59