nidas v1.2.3
|
Interface to a data sample. More...
#include <Sample.h>
Public Member Functions | |
Sample (sampleType t=CHAR_ST) | |
virtual | ~Sample () |
void | setTimeTag (dsm_time_t val) |
dsm_time_t | getTimeTag () const |
Time-tag in non-leap microseconds since Jan 1, 1970 00:00 GMT. | |
void | setId (dsm_sample_id_t val) |
Set the id portion of the sample header. | |
dsm_sample_id_t | getId () const |
Get the id portion of the sample header. | |
void | setRawId (dsm_sample_id_t val) |
Set the full, raw id portion of the sample header. | |
dsm_sample_id_t | getRawId () const |
void | setSpSId (unsigned int val) |
Set the short id portion of the sample header, containing the sensor + sample ids. | |
unsigned int | getSpSId () const |
Get the short id portion of the sample header. | |
void | setDSMId (unsigned int val) |
Set the DSM (data system) id portion of the sample header. | |
unsigned int | getDSMId () const |
Get the DSM (data system) id portion of the sample header. | |
unsigned int | getDataByteLength () const |
Get the number of bytes in data portion of sample. | |
virtual void | setDataLength (unsigned int val)=0 |
Set the number of elements in data portion of sample. | |
virtual unsigned int | getDataLength () const =0 |
Get the number of elements in data portion of sample. | |
virtual sampleType | getType () const =0 |
Get the type of the sample. | |
unsigned int | getHeaderLength () const |
Number of bytes in header. | |
const void * | getHeaderPtr () const |
Get a pointer to the header portion of the sample. | |
virtual void * | getVoidDataPtr ()=0 |
Get a void* pointer to the data portion of the sample. | |
virtual const void * | getConstVoidDataPtr () const =0 |
Get a const void* pointer to the data portion of the sample. | |
virtual double | getDataValue (unsigned int i) const =0 |
Get the numeric value of data element i. | |
virtual void | setDataValue (unsigned int i, double val)=0 |
Set the value of data element i to a double. | |
virtual void | setDataValue (unsigned int i, float val)=0 |
Set the value of data element i to a float. | |
virtual unsigned int | getAllocLength () const =0 |
Get number of elements allocated in data portion of sample. | |
virtual unsigned int | getAllocByteLength () const =0 |
Get number of bytes allocated in data portion of sample. | |
virtual void | allocateData (unsigned int val)=0 |
Allocate a number of bytes of data. | |
virtual void | reallocateData (unsigned int val)=0 |
Re-allocate a number of bytes of data, saving old contents. | |
void | holdReference () const |
Increment the reference count for this sample. | |
virtual void | freeReference () const =0 |
Decrement the reference count for this sample. | |
Protected Attributes | |
SampleHeader | _header |
int | _refCount |
The reference count. | |
nidas::util::Mutex | _refLock |
Static Protected Attributes | |
static int | _nsamps |
Global count of the number of samples in use by a process. | |
Interface to a data sample.
A Sample contains a SampleHeader and some data.
|
inline |
References _nsamps.
Allocate a number of bytes of data.
Implemented in nidas::core::SampleT< DataT >, nidas::core::SampleT< char >, nidas::core::SampleT< double >, and nidas::core::SampleT< float >.
Referenced by nidas::core::SamplePool< SampleType >::getSample().
Decrement the reference count for this sample.
Implemented in nidas::core::SampleT< DataT >, nidas::core::SampleT< char >, nidas::core::SampleT< double >, and nidas::core::SampleT< float >.
Referenced by DataStats::clearSampleQueue(), nidas::dynld::SampleInputStream::nextSample(), nidas::core::DriverSampleScanner::nextSample(), nidas::dynld::SampleInputStream::parseInputHeader(), nidas::dynld::raf::CVI_LV_Input::process(), nidas::core::MessageStreamScanner::requestBiggerSample(), DmdA2dCk::run(), MergeVerifier::run(), nidas::core::SampleBuffer::run(), nidas::core::SampleSorter::run(), nidas::dynld::SampleInputStream::~SampleInputStream(), nidas::core::SampleScanner::~SampleScanner(), nidas::dynld::raf::SyncRecordReader::~SyncRecordReader(), and nidas::dynld::raf::SyncServer::~SyncServer().
Get number of bytes allocated in data portion of sample.
Implemented in nidas::core::SampleT< DataT >, nidas::core::SampleT< char >, nidas::core::SampleT< double >, and nidas::core::SampleT< float >.
Referenced by nidas::core::MessageStreamScanner::nextSampleByLength(), nidas::core::MessageStreamScanner::nextSampleSepBOM(), nidas::core::MessageStreamScanner::nextSampleSepEOM(), and nidas::core::MessageStreamScanner::requestBiggerSample().
Get number of elements allocated in data portion of sample.
Implemented in nidas::core::SampleT< DataT >, nidas::core::SampleT< char >, nidas::core::SampleT< double >, and nidas::core::SampleT< float >.
Get a const void* pointer to the data portion of the sample.
Implemented in nidas::core::SampleT< DataT >, nidas::core::SampleT< char >, nidas::core::SampleT< double >, and nidas::core::SampleT< float >.
Referenced by nidas::dynld::raf::LamsNetSensor::process(), nidas::dynld::raf::LamsSensor::process(), nidas::dynld::raf::UHSAS_Serial::process(), and nidas::dynld::AsciiOutput::receive().
Get the number of bytes in data portion of sample.
References _header, and nidas::core::SampleHeader::getDataByteLength().
Referenced by SampleCounter::accumulateSample(), nidas::dynld::SampleInputStream::checkUnexpectedEOF(), nidas::core::SampleT< DataT >::getDataLength(), nidas::dynld::SampleInputStream::nextSample(), nidas::core::DriverSampleScanner::nextSample(), nidas::dynld::AsciiOutput::receive(), nidas::core::SampleBuffer::run(), and nidas::core::SampleSorter::run().
Get the number of elements in data portion of sample.
Implemented in nidas::core::SampleT< DataT >, nidas::core::SampleT< char >, nidas::core::SampleT< double >, and nidas::core::SampleT< float >.
Referenced by nidas::dynld::isff::NCAR_TRH::ifanFilter(), nidas::dynld::isff::Licor7500::process(), nidas::dynld::isff::Wind2D::process(), nidas::dynld::isff::Wind3D::process(), nidas::dynld::WxtSensor::process(), and nidas::dynld::raf::CVIProcessor::receive().
Get the numeric value of data element i.
No range checking of i is done.
Implemented in nidas::core::SampleT< DataT >, nidas::core::SampleT< char >, nidas::core::SampleT< double >, and nidas::core::SampleT< float >.
Referenced by nidas::dynld::isff::Wind2D::process(), nidas::dynld::StatisticsCruncher::receive(), and nidas::dynld::AsciiOutput::receive().
Get the DSM (data system) id portion of the sample header.
References _header, and nidas::core::SampleHeader::getDSMId().
Referenced by nidas::core::NearestResamplerAtRate::connect().
Number of bytes in header.
References nidas::core::SampleHeader::getSizeOf().
Get a pointer to the header portion of the sample.
References _header.
Referenced by nidas::core::operator<<().
|
inline |
Get the id portion of the sample header.
References _header, and nidas::core::SampleHeader::getId().
Referenced by nidas::dynld::StatisticsCruncher::attach(), nidas::core::NearestResamplerAtRate::connect(), nidas::core::SampleAverager::connect(), nidas::core::NearestResampler::connect(), nidas::core::NearestResampler::ctorCommon(), nidas::core::Site::fromDOMElement(), nidas::core::NearestResamplerAtRate::NearestResamplerAtRate(), nidas::core::MessageStreamScanner::requestBiggerSample(), ExtractFast2D::run(), ExtractDMT::run(), SensorExtract::run(), and nidas::core::Site::validate().
|
inline |
References _header, and nidas::core::SampleHeader::getRawId().
Get the short id portion of the sample header.
This is the portion of the id without the DSM id.
References _header, and nidas::core::SampleHeader::getSpSId().
|
inline |
Time-tag in non-leap microseconds since Jan 1, 1970 00:00 GMT.
References _header, and nidas::core::SampleHeader::getTimeTag().
Referenced by nidas::core::SampleSorter::flush(), nidas::dynld::SampleInputStream::nextSample(), nidas::dynld::raf::SyncServer::openStream(), nidas::dynld::isff::WisardMote::process(), nidas::dynld::raf::PSI9116_Sensor::process(), nidas::dynld::raf::SidsNetSensor::process(), nidas::core::MessageStreamScanner::requestBiggerSample(), DataStats::restartStats(), NidsMerge::run(), nidas::core::SampleSorter::run(), nidas::dynld::raf::SyncRecordSource::sendSyncRecord(), nidas::dynld::raf::Extract2D::setTimeStamp(), nidas::dynld::raf::Extract2D::setTimeStamp(), and nidas::dynld::isff::WisardMote::unpackTsoil().
|
pure virtual |
Get the type of the sample.
Implemented in nidas::core::SampleT< DataT >, nidas::core::SampleT< char >, nidas::core::SampleT< double >, and nidas::core::SampleT< float >.
Referenced by nidas::dynld::raf::SyncRecordSource::selectVariablesFromSensor(), and nidas::dynld::IEEE_Float::validate().
Get a void* pointer to the data portion of the sample.
Implemented in nidas::core::SampleT< DataT >, nidas::core::SampleT< char >, nidas::core::SampleT< double >, and nidas::core::SampleT< float >.
Referenced by nidas::dynld::SampleInputStream::nextSample(), nidas::core::DriverSampleScanner::nextSample(), nidas::core::MessageStreamScanner::nextSampleByLength(), nidas::core::MessageStreamScanner::nextSampleSepBOM(), nidas::core::MessageStreamScanner::nextSampleSepEOM(), nidas::dynld::raf::A2D_Serial::process(), and nidas::core::MessageStreamScanner::requestBiggerSample().
|
inline |
Increment the reference count for this sample.
Sample supports a form of reference counting. See freeReference. We have to use a hack-like cast of the this pointer to a const so that holdReference can be used on a const Sample. The SamplePool class supports Sample reference counting.
References _refCount, _refLock, nidas::core::getSample(), nidas::util::Mutex::lock(), and nidas::util::Mutex::unlock().
Referenced by nidas::core::SamplePool< SampleType >::getSample(), and nidas::dynld::raf::LamsNetSensor::process().
Re-allocate a number of bytes of data, saving old contents.
Implemented in nidas::core::SampleT< DataT >, nidas::core::SampleT< char >, nidas::core::SampleT< double >, and nidas::core::SampleT< float >.
Set the number of elements in data portion of sample.
Implemented in nidas::core::SampleT< DataT >, nidas::core::SampleT< char >, nidas::core::SampleT< double >, and nidas::core::SampleT< float >.
Referenced by nidas::core::DriverSampleScanner::nextSample(), nidas::core::MessageStreamScanner::nextSampleSepBOM(), nidas::core::MessageStreamScanner::nextSampleSepEOM(), nidas::dynld::isff::MOSMote::process(), nidas::dynld::raf::PPT_Serial::process(), and nidas::core::MessageStreamScanner::requestBiggerSample().
Set the value of data element i to a double.
No range checking of i is done.
Implemented in nidas::core::SampleT< DataT >, nidas::core::SampleT< char >, nidas::core::SampleT< double >, and nidas::core::SampleT< float >.
Set the value of data element i to a float.
No range checking is of i done.
Implemented in nidas::core::SampleT< DataT >, nidas::core::SampleT< char >, nidas::core::SampleT< double >, and nidas::core::SampleT< float >.
Set the DSM (data system) id portion of the sample header.
References _header, and nidas::core::SampleHeader::setDSMId().
|
inline |
Set the id portion of the sample header.
The id typically identifies the data system and sensor of origin of the sample.
References _header, and nidas::core::SampleHeader::setId().
Referenced by nidas::core::DriverSampleScanner::nextSample(), nidas::core::MessageStreamScanner::nextSampleByLength(), nidas::core::MessageStreamScanner::nextSampleSepBOM(), nidas::core::MessageStreamScanner::nextSampleSepEOM(), nidas::dynld::raf::DSMArincSensor::process(), and nidas::dynld::raf::DSMArincSensor::processAlta().
|
inline |
Set the full, raw id portion of the sample header.
This method is not typically used except when doing raw IO on a sample. The raw id contains an enumeration of the sample type, along with the fields returned by getId().
References _header, and nidas::core::SampleHeader::setRawId().
Set the short id portion of the sample header, containing the sensor + sample ids.
This is the portion of the id without the DSM id.
References _header, and nidas::core::SampleHeader::setSpSId().
|
inline |
References _header, and nidas::core::SampleHeader::setTimeTag().
Referenced by nidas::core::DriverSampleScanner::nextSample(), nidas::core::MessageStreamScanner::nextSampleByLength(), nidas::core::MessageStreamScanner::nextSampleSepBOM(), nidas::core::MessageStreamScanner::nextSampleSepEOM(), nidas::dynld::raf::CVI_LV_Input::process(), nidas::dynld::raf::UHSAS_Serial::process(), and nidas::core::SampleSorter::run().
|
protected |
|
staticprotected |
|
mutableprotected |
The reference count.
Referenced by holdReference().
|
mutableprotected |
Referenced by holdReference().