26#ifndef NIDAS_CORE_SAMPLESCANNER_H
27#define NIDAS_CORE_SAMPLESCANNER_H
34namespace nidas {
namespace core {
319 "setMessageSeparator not supported");
608 "setMessageParameters not supported");
DSMSensor provides the basic support for reading, processing and distributing samples from a sensor a...
Definition DSMSensor.h:88
Definition SampleScanner.h:594
std::list< int > _packetLengths
Definition SampleScanner.h:644
bool getNullTerminate() const
Should the SampleScanner append a null character, '\0', to the messages.
Definition SampleScanner.h:637
void setNullTerminate(bool val)
User of DatagramSampleScanner should specify if they want the samples to be null terminated.
Definition SampleScanner.h:632
Sample * nextSample(DSMSensor *sensor)
Extract the next sample from the buffer.
Definition SampleScanner.cc:945
bool _nullTerminate
Definition SampleScanner.h:648
DatagramSampleScanner(int bufsize=16384)
Definition SampleScanner.cc:882
void setMessageParameters(unsigned int, const std::string &, bool)
setMessageSeparator is not implemented in DatagramSampleScanner.
Definition SampleScanner.h:605
size_t readBuffer(DSMSensor *sensor, bool &exhausted)
Read from the sensor into the internal buffer of this SampleScanner.
Definition SampleScanner.cc:889
std::list< dsm_time_t > _packetTimes
Definition SampleScanner.h:646
A SampleScanner for reading samples that have been pre-formatted by a device driver - they already ha...
Definition SampleScanner.h:305
Sample * nextSample(DSMSensor *sensor)
Extract the next sample from the buffer.
Definition SampleScanner.cc:231
DriverSampleScanner(int bufsize=8192)
Definition SampleScanner.cc:226
void setMessageParameters(unsigned int, const std::string &, bool)
setMessageSeparator is not implemented in DriverSampleScanner.
Definition SampleScanner.h:316
A DriverSampleScanner which supports the set/get of message separation parameters.
Definition SampleScanner.h:338
unsigned int getMessageLength() const
Returns 0.
Definition SampleScanner.h:411
bool getMessageSeparatorAtEOM() const
Is the message separator at the end of the message (true), or at the beginning (false)?
Definition SampleScanner.h:406
const std::string & getMessageSeparator() const
Get message separator string.
Definition SampleScanner.h:392
const std::string getBackslashedMessageSeparator() const
Get message separator with backslash sequences added back.
Definition SampleScanner.cc:286
MessageSampleScanner(int bufsize=8192)
Definition SampleScanner.cc:281
void setMessageParameters(unsigned int len, const std::string &val, bool eom)
Set the parameters which delineate a message for this scanner.
Definition SampleScanner.cc:291
A SampleScanner which supports the set/get of message separation parameters and extracts samples from...
Definition SampleScanner.h:430
Sample * nextSample(DSMSensor *sensor)
Extract the next sample from the buffer.
Definition SampleScanner.h:474
unsigned int _outSampLengthAlloc
Number of bytes allocated in data portion of current output sample.
Definition SampleScanner.h:569
size_t readBuffer(DSMSensor *sensor, bool &exhausted)
Definition SampleScanner.cc:417
unsigned int _sampleLengthAlloc
Size of samples to allocate.
Definition SampleScanner.h:557
dsm_time_t _lastBufferTime
Definition SampleScanner.h:542
MessageStreamScanner(int bufsize=4096)
Definition SampleScanner.cc:304
void warnNonIncrTimeTag(const DSMSensor *sensor, dsm_time_t badtt, dsm_time_t cortt, unsigned int nbad)
Issue warning log message about a non-forward time tag.
Definition SampleScanner.cc:449
Sample * requestBiggerSample(unsigned int nc)
If a new sample can be allocated without exceeding MAX_MESSAGE_STREAM_SAMPLE_SIZE then get a new,...
Definition SampleScanner.cc:382
const std::string & getMessageSeparator() const
Get message separator string.
Definition SampleScanner.h:444
bool _stepBackwards
If the system time of a buffer read is earlier than the previous read.
Definition SampleScanner.h:575
unsigned int getMessageLength() const
Returns 0.
Definition SampleScanner.h:459
void warnBackwardsStepTimeTag(const DSMSensor *sensor, dsm_time_t badtt, unsigned int nbad)
Definition SampleScanner.cc:460
bool getMessageSeparatorAtEOM() const
Definition SampleScanner.h:454
Sample *(MessageStreamScanner::* _nextSampleFunc)(DSMSensor *)
Definition SampleScanner.h:523
bool getNullTerminate() const
Should the SampleScanner append a null character, '\0', to the messages.
Definition SampleScanner.h:469
dsm_time_t _bomtt
Definition SampleScanner.h:550
int _sampleOverflows
Definition SampleScanner.h:552
Sample * nextSampleByLength(DSMSensor *sensor)
Method to read input and break it into samples strictly by record length.
Definition SampleScanner.cc:818
const unsigned int MAX_MESSAGE_STREAM_SAMPLE_SIZE
Definition SampleScanner.h:546
virtual Sample * nextSampleSepBOM(DSMSensor *sensor)
Method to read input and break it into samples where the message separator occurs at the beginning of...
Definition SampleScanner.cc:592
void setMessageParameters(unsigned int len, const std::string &val, bool eom)
Definition SampleScanner.cc:323
int _nsmallSamples
Count of number of consecutive samples smaller than _sampleLengthAlloc.
Definition SampleScanner.h:564
const std::string getBackslashedMessageSeparator() const
Get message separator with backslash sequences added back.
Definition SampleScanner.cc:318
bool _nullTerminate
Definition SampleScanner.h:559
unsigned int _stepBackTimeTag
Number of time tags that were not monotonically increasing, due to backward step changes.
Definition SampleScanner.h:581
void setNullTerminate(bool val)
Definition SampleScanner.h:464
virtual Sample * nextSampleSepEOM(DSMSensor *sensor)
Method to read input and break it into samples where the message separator occurs at the end of the m...
Definition SampleScanner.cc:469
dsm_time_t _lastSampleTime
Definition SampleScanner.h:544
int _separatorCnt
Definition SampleScanner.h:548
dsm_time_t _tfirstchar
Definition SampleScanner.h:540
unsigned int _nonIncrTimeTag
Number of time tags that were not monotonically increasing, not because of backward step changes,...
Definition SampleScanner.h:589
A scanner of sample data.
Definition SampleScanner.h:74
unsigned int getBytesInBuffer() const
Definition SampleScanner.h:170
int getUsecsPerByte() const
Definition SampleScanner.h:139
virtual bool getNullTerminate() const
Should the SampleScanner append a null character, '\0', to the messages.
Definition SampleScanner.h:129
SampleScanner & operator=(const SampleScanner &)
No assignment (could be added if needed).
virtual void setMessageParameters(unsigned int len, const std::string &val, bool eom)=0
Set the parameters associated with scanning of character messages.
Sample * _osamp
Definition SampleScanner.h:231
unsigned int getMaxSampleLength() const
Definition SampleScanner.h:183
char * _buffer
Definition SampleScanner.h:225
std::string _emptyString
Definition SampleScanner.h:259
int _separatorLen
Length of messageSeparator.
Definition SampleScanner.h:255
float getObservedSamplingRate() const
Definition SampleScanner.cc:211
bool _separatorAtEOM
Definition SampleScanner.h:245
unsigned int _buftail
Definition SampleScanner.h:229
size_t _nsamples
Definition SampleScanner.h:271
struct dsm_sample _header
Definition SampleScanner.h:233
virtual const std::string getBackslashedMessageSeparator() const
Returns an empty string.
Definition SampleScanner.h:107
float _sampleRateObs
Observed number of samples per second.
Definition SampleScanner.h:280
int _reportIndex
Definition SampleScanner.h:269
char * _outSampDataPtr
Definition SampleScanner.h:239
virtual void calcStatistics(unsigned int periodUsec)
Update the sensor sampling statistics: samples/sec, bytes/sec, min/max sample size,...
Definition SampleScanner.cc:196
int _messageLength
Definition SampleScanner.h:243
virtual void init()
Initialize the scanner.
Definition SampleScanner.cc:77
unsigned int _maxSampleLength[2]
Definition SampleScanner.h:265
unsigned int getMinSampleLength() const
Definition SampleScanner.h:186
virtual void clearBuffer()
Definition SampleScanner.cc:177
SampleScanner(int bufsize=8192)
Definition SampleScanner.cc:53
float _dataRateObs
Definition SampleScanner.h:282
unsigned int _bufhead
Definition SampleScanner.h:227
std::string _messageSeparator
Definition SampleScanner.h:241
unsigned int _badTimeTags
Definition SampleScanner.h:275
int _usecsPerByte
Definition SampleScanner.h:284
void incrementBadTimeTags()
Definition SampleScanner.h:213
void addNumBytesToStats(size_t val)
Definition SampleScanner.h:202
int _currentIndex
Definition SampleScanner.h:267
unsigned int _outSampToRead
Definition SampleScanner.h:237
unsigned int _minSampleLength[2]
Definition SampleScanner.h:263
size_t _nbytes
Definition SampleScanner.h:273
SampleScanner(const SampleScanner &)
No copy (could be added if needed).
unsigned int getBadTimeTagCount() const
Definition SampleScanner.h:193
unsigned int _outSampRead
Definition SampleScanner.h:235
virtual unsigned int getMessageLength() const
Returns 0.
Definition SampleScanner.h:120
virtual size_t readBuffer(DSMSensor *sensor, bool &exhausted)
Read from the sensor into the internal buffer of this SampleScanner.
Definition SampleScanner.cc:82
virtual const std::string & getMessageSeparator() const
Returns an empty string.
Definition SampleScanner.h:99
virtual bool getMessageSeparatorAtEOM() const
Definition SampleScanner.h:112
time_t _initialTimeSecs
Definition SampleScanner.h:261
virtual ~SampleScanner()
Definition SampleScanner.cc:70
char * _separator
messageSeparator in a C string.
Definition SampleScanner.h:250
virtual Sample * nextSample(DSMSensor *sensor)=0
Extract the next sample from the buffer.
void setUsecsPerByte(int val)
Definition SampleScanner.h:134
virtual void resetStatistics()
Definition SampleScanner.cc:182
float getObservedDataRate() const
Definition SampleScanner.cc:219
void addSampleToStats(unsigned int val)
Definition SampleScanner.h:204
const unsigned int BUFSIZE
Buffer size for reading from sensor.
Definition SampleScanner.h:223
Interface to a data sample.
Definition Sample.h:190
Definition InvalidParameterException.h:35
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
long long dsm_time_t
Posix time in microseconds, the number of non-leap microseconds since 1970 Jan 1 00:00 UTC.
Definition Sample.h:62
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31
int len
Definition sing.cc:948