nidas v1.2.3
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
nidas::core::SampleTag Class Reference

Class describing a group of variables that are sampled and handled together. More...

#include <SampleTag.h>

Inheritance diagram for nidas::core::SampleTag:
Inheritance graph
[legend]

Public Member Functions

 SampleTag ()
 Constructor.
 
 SampleTag (const DSMSensor *sensor)
 Constructor of a sample for a given sensor.
 
 SampleTag (const SampleTag &)
 Copy constructor.
 
virtual ~SampleTag ()
 
SampleTagoperator= (const SampleTag &rhs)
 
void setSampleId (unsigned int val)
 Set the sample portion of the shortId.
 
unsigned int getSampleId () const
 Get the sample portion of the shortId.
 
void setSensorId (unsigned int val)
 Set the sensor portion of the shortId.
 
unsigned int getSensorId () const
 Get the sensor portion of the shortId.
 
void setDSMId (unsigned int val)
 Set the DSM portion of the id.
 
unsigned int getDSMId () const
 Get the DSM portion of the id.
 
dsm_sample_id_t getId () const
 Get the 26 bit id, containing the DSM id and the sensor+sample id.
 
unsigned int getSpSId () const
 Get the sensor+sample portion of the id.
 
const std::string & getSuffix () const
 Suffix, which is appended to variable names.
 
void setSuffix (const std::string &val)
 
const DSMConfiggetDSMConfig () const
 
void setDSMConfig (const DSMConfig *val)
 
const DSMSensorgetDSMSensor () const
 
void setDSMSensor (const DSMSensor *val)
 
int getStation () const
 Station number, which is also known as the Site number.
 
void setStation (int val)
 
const SitegetSite () const
 Get the Site of this SampleTag, which will be non-NULL only if getDSMConfig() returns non-NULL.
 
virtual void setRate (double val)
 Set sampling rate in samples/sec.
 
virtual double getRate () const
 Get sampling rate in samples/sec.
 
virtual void setPeriod (double val)
 Set sampling period (1/rate) in sec.
 
virtual double getPeriod () const
 Get sampling period (1/rate) in sec.
 
void setProcessed (bool val)
 Set if this sample is going to be post processed.
 
bool isProcessed () const
 Test to see if this sample is to be post processed.
 
void setScanfFormat (const std::string &val)
 
const std::string & getScanfFormat () const
 
void setPromptString (const std::string &val)
 
const std::string & getPromptString () const
 
void setPromptOffset (double val)
 
double getPromptOffset () const
 
virtual void addVariable (Variable *var)
 Add a variable to this SampleTag.
 
const std::vector< const Variable * > & getVariables () const
 
const std::vector< Variable * > & getVariables ()
 
void removeVariable (const Variable *var)
 
VariablegetVariable (int i)
 Provide a reference to a variable - allowing one to modify it.
 
void addParameter (Parameter *val)
 Add a parameter to this SampleTag.
 
const std::list< const Parameter * > & getParameters () const
 
const ParametergetParameter (const std::string &name) const
 
void setEnabled (bool val)
 
bool isEnabled () const
 
unsigned int getDataIndex (const Variable *var) const
 What is the index of a Variable into the data of a sample from this SampleTag.
 
float getTimetagAdjust () const
 Whether to enable TimetagAdjuster for this sample.
 
void setTimetagAdjust (float val)
 
VariableIterator getVariableIterator () const
 
void fromDOMElement (const xercesc::DOMElement *)
 
xercesc::DOMElement * toDOMParent (xercesc::DOMElement *parent, bool complete) const
 
xercesc::DOMElement * toDOMElement (xercesc::DOMElement *node, bool complete) const
 

Static Public Member Functions

static const XMLChgetNamespaceURI ()
 

Protected Member Functions

void setId (dsm_sample_id_t val)
 Set the full id.
 
void setSpSId (unsigned int val)
 Set the sensor + sample portions of the id.
 

Private Attributes

dsm_sample_id_t _id
 
unsigned int _sampleId
 
unsigned int _sensorId
 
std::string _suffix
 
int _station
 
double _rate
 
bool _processed
 
const DSMConfig_dsm
 
const DSMSensor_sensor
 
std::vector< const Variable * > _constVariables
 
std::vector< Variable * > _variables
 
std::vector< std::string > _variableNames
 
std::string _scanfFormat
 
std::string _promptString
 
double _promptOffset
 
std::list< Parameter * > _parameters
 List of pointers to Parameters.
 
std::list< const Parameter * > _constParameters
 List of const pointers to Parameters for providing via getParameters().
 
bool _enabled
 
float _ttAdjustVal
 If positive, enable TimetagAdjustor for these samples.
 

Static Private Attributes

static XMLChnamespaceURI = 0
 

Detailed Description

Class describing a group of variables that are sampled and handled together.

A SampleTag has an integer ID. This is the same ID that is associated with Sample objects, allowing software to map between a data sample and the meta-data associated with it.

A SampleTag/Sample ID is a 32-bit value comprised of four parts: 6-bit type_id, 10-bit DSM_id, 16-bit sensor+sample id.

The type id specifies the data type (float, int, double, etc), The type_id is only meaningful in an actual data Sample, and is not accessible in the SampleTag class.

The 26 bits of DSM_id and sensor+sample are known simply as the Id (or full id), and is accessible with the getId() method.

The DSM_id contains the id of the data acquisition system that collected the data, and can be accessed separately from the other fields with getDSMId() and setDSMId().

The 16-bit sensor+sample id is also known as the shortId. To maintain flexibility, the shortId has not been divided further into bit fields of sensor and sample id, but is a sum of the two. This means that you cannot set the shortId without losing track of the sensor and sample ids. For this reason, methods to set the shortId and fullId are protected.

To access the portions of the shortId, use getSensorId(), setSensorId(), getSampleId() and setSampleId().

Example: a DSMSensor has an id of 200, and four associated SampleTags with sample ids of 1,2,3 and 4. Therefore one should do a setSensorId(200) on each of the SampleTags, so that their shortIds become 201,202,203, and 204. The convention is that processed samples have sample ids >= 1. Raw, unprocessed Samples from this sensor have a sample id of 0, and therefore a shortId of 200.

A SampleTag also has a rate attribute, indicating the requested sampling rate for the variables.

Constructor & Destructor Documentation

◆ SampleTag() [1/3]

SampleTag::SampleTag ( )

Constructor.

◆ SampleTag() [2/3]

SampleTag::SampleTag ( const DSMSensor * sensor)

Constructor of a sample for a given sensor.

References _dsm, _sensor, setDSMId(), and setSensorId().

◆ SampleTag() [3/3]

SampleTag::SampleTag ( const SampleTag & x)

◆ ~SampleTag()

SampleTag::~SampleTag ( )
virtual

Member Function Documentation

◆ addParameter()

void SampleTag::addParameter ( Parameter * val)

Add a parameter to this SampleTag.

SampleTag will then own the pointer and will delete it in its destructor. If a Parameter already exists with the same name, that Parameter will be removed and deleted.

References _constParameters, _parameters, and nidas::core::getSample().

Referenced by fromDOMElement(), operator=(), and SampleTag().

◆ addVariable()

void SampleTag::addVariable ( Variable * var)
virtual

◆ fromDOMElement()

void SampleTag::fromDOMElement ( const xercesc::DOMElement * node)
virtual

◆ getDataIndex()

unsigned int SampleTag::getDataIndex ( const Variable * var) const

What is the index of a Variable into the data of a sample from this SampleTag.

Returns
UINT_MAX: 'tain't here

References _constVariables, and nidas::core::getSample().

◆ getDSMConfig()

const DSMConfig * nidas::core::SampleTag::getDSMConfig ( ) const
inline

References _dsm.

◆ getDSMId()

unsigned int nidas::core::SampleTag::getDSMId ( ) const
inline

◆ getDSMSensor()

const DSMSensor * nidas::core::SampleTag::getDSMSensor ( ) const
inline

◆ getId()

dsm_sample_id_t nidas::core::SampleTag::getId ( ) const
inline

Get the 26 bit id, containing the DSM id and the sensor+sample id.

References _id, and GET_FULL_ID.

Referenced by nidas::dynld::isff::WisardMote::addMoteSampleTag(), nidas::dynld::StatisticsProcessor::addRequestedSampleTag(), nidas::dynld::iss::TiltSensor::addSampleTag(), nidas::dynld::raf::CVIProcessor::attachLVInput(), nidas::dynld::isff::ATIK_Sonic::checkSampleTags(), nidas::dynld::isff::CSAT3_Sonic::checkSampleTags(), nidas::dynld::isff::CSI_IRGA_Sonic::checkSampleTags(), nidas::dynld::isff::Wind3D::checkSampleTags(), nidas::dynld::StatisticsCruncher::computeStats(), nidas::core::SamplePipeline::connect(), nidas::dynld::raf::CVIProcessor::connectSource(), DataStats::createCounters(), nidas::core::Project::findSensor(), nidas::core::Site::findSensor(), nidas::core::NearestResampler::flush(), nidas::core::SampleAverager::flush(), nidas::core::DSMSensor::fromDOMElement(), fromDOMElement(), nidas::dynld::raf::DSMMesaSensor::fromDOMElement(), nidas::dynld::raf::IRIGSensor::fromDOMElement(), nidas::core::Project::getUniqueSampleId(), nidas::core::CharacterSensor::init(), nidas::dynld::DSC_Event::init(), nidas::dynld::raf::A2DBoardTempSensor::init(), nidas::dynld::raf::DSMArincSensor::init(), nidas::dynld::raf::SyncRecordSource::init(), nidas::dynld::raf::TwoD_USB::init(), nidas::dynld::raf::TwoDS::init(), nidas::dynld::WxtSensor::init(), nidas::dynld::raf::TwoD64_USB::init_parameters(), nidas::dynld::raf::TwoD64_USB_v3::init_parameters(), nidas::dynld::iss::WICORSensor::process(), nidas::dynld::raf::DSMAnalogSensor::process(), nidas::dynld::A2DSensor::process(), nidas::dynld::isff::CU_Coldwire::process(), nidas::dynld::isff::CSAT3_Sonic::process(), nidas::dynld::isff::DAUSensor::process(), nidas::dynld::ModbusRTU::process(), nidas::dynld::raf::A2D_Serial::process(), nidas::dynld::raf::Watlow::process(), nidas::dynld::TSI_CPC3772::process(), TestSource::run(), SampleDispatcher::SampleDispatcher(), nidas::dynld::WxtSensor::scanSample(), nidas::core::CharacterSensor::searchSampleScanners(), nidas::dynld::raf::SyncRecordSource::selectVariablesFromSensor(), DumpClient::setSensors(), toDOMElement(), nidas::dynld::isff::WisardMote::unpackTsoil(), nidas::dynld::DSC_FreqCounter::validate(), nidas::dynld::DSC_PulseCounter::validate(), nidas::dynld::GPS_NMEA_Serial::validate(), nidas::dynld::GPS_Novatel_Serial::validate(), nidas::dynld::isff::CSI_CRX_Binary::validate(), nidas::dynld::isff::Wind2D::validate(), nidas::dynld::raf::PSI9116_Sensor::validate(), nidas::core::DSMConfig::validateSensorAndSampleIds(), nidas::dynld::isff::Wind2D::validateSscanfs(), and nidas::dynld::WxtSensor::wxtValidateSscanfs().

◆ getNamespaceURI()

static const XMLCh * nidas::core::DOMable::getNamespaceURI ( )
inlinestaticinherited

◆ getParameter()

const Parameter * SampleTag::getParameter ( const std::string & name) const

◆ getParameters()

const std::list< const Parameter * > & nidas::core::SampleTag::getParameters ( ) const
inline

◆ getPeriod()

virtual double nidas::core::SampleTag::getPeriod ( ) const
inlinevirtual

Get sampling period (1/rate) in sec.

A value of 0.0 means an unknown rate.

References _rate.

Referenced by nidas::dynld::StatisticsProcessor::addRequestedSampleTag().

◆ getPromptOffset()

double nidas::core::SampleTag::getPromptOffset ( ) const
inline

References _promptOffset.

◆ getPromptString()

const std::string & nidas::core::SampleTag::getPromptString ( ) const
inline

References _promptString.

◆ getRate()

virtual double nidas::core::SampleTag::getRate ( ) const
inlinevirtual

◆ getSampleId()

unsigned int nidas::core::SampleTag::getSampleId ( ) const
inline

◆ getScanfFormat()

const std::string & nidas::core::SampleTag::getScanfFormat ( ) const
inline

◆ getSensorId()

unsigned int nidas::core::SampleTag::getSensorId ( ) const
inline

Get the sensor portion of the shortId.

References _sensorId.

Referenced by nidas::dynld::isff::WisardMote::createSampleTags(), and nidas::dynld::raf::DSMMesaSensor::fromDOMElement().

◆ getSite()

const Site * SampleTag::getSite ( ) const

Get the Site of this SampleTag, which will be non-NULL only if getDSMConfig() returns non-NULL.

References _dsm, and nidas::core::getSample().

Referenced by SampleToDatabase::setSiteAndMeasurement().

◆ getSpSId()

unsigned int nidas::core::SampleTag::getSpSId ( ) const
inline

◆ getStation()

int nidas::core::SampleTag::getStation ( ) const
inline

Station number, which is also known as the Site number.

A station number of 0 is the "non" station. Otherwise positive integers are used when a project consists of more than one similar station, where one can differentiate between the variables by a station number (which maps to a station dimension in a NetCDF file). Setting the station on a SampleTag will set the: the station on all its variables.

References _station.

Referenced by nidas::dynld::StatisticsCruncher::connect(), fromDOMElement(), and PConfig::loadVariables().

◆ getSuffix()

const std::string & nidas::core::SampleTag::getSuffix ( ) const
inline

Suffix, which is appended to variable names.

References _suffix.

Referenced by SampleToDatabase::setSiteAndMeasurement().

◆ getTimetagAdjust()

float nidas::core::SampleTag::getTimetagAdjust ( ) const
inline

◆ getVariable()

Variable & nidas::core::SampleTag::getVariable ( int i)
inline

◆ getVariableIterator()

VariableIterator SampleTag::getVariableIterator ( ) const

◆ getVariables() [1/2]

const std::vector< Variable * > & nidas::core::SampleTag::getVariables ( )
inline

References _variables.

◆ getVariables() [2/2]

const std::vector< const Variable * > & SampleTag::getVariables ( ) const

References _constVariables.

Referenced by nidas::dynld::raf::CVIProcessor::addRequestedSampleTag(), nidas::dynld::iss::TiltSensor::addSampleTag(), nidas::dynld::iss::WICORSensor::addSampleTag(), nidas::dynld::StatisticsCruncher::addVariable(), nidas::core::DSMSensor::applyConversions(), nidas::dynld::isff::ATIK_Sonic::checkSampleTags(), nidas::dynld::isff::CSAT3_Sonic::checkSampleTags(), nidas::dynld::isff::CSI_IRGA_Sonic::checkSampleTags(), SampleCounter::collectMetadata(), nidas::core::SampleAverager::connect(), nidas::dynld::StatisticsCruncher::connect(), nidas::dynld::StatisticsProcessor::connectSource(), nidas::dynld::StatisticsCruncher::createCombinations(), DataStats::createCounters(), nidas::core::DSMSensor::findVariableIndex(), nidas::dynld::raf::IRIGSensor::fromDOMElement(), nidas::core::VariableIterator::hasNext(), nidas::core::CharacterSensor::init(), nidas::dynld::DSC_Event::init(), nidas::dynld::raf::DSMArincSensor::init(), nidas::dynld::raf::TwoD_USB::init(), nidas::dynld::raf::TwoDS::init(), nidas::dynld::raf::UHSAS_Serial::init(), nidas::dynld::WxtSensor::init(), nidas::dynld::StatisticsCruncher::initStats(), StatsProcess::listOutputSamples(), nidas::dynld::raf::DSMArincSensor::open(), nidas::dynld::A2DSensor::process(), nidas::dynld::isff::WisardMote::process(), nidas::dynld::isff::CU_Coldwire::process(), nidas::dynld::isff::CSAT3_Sonic::process(), nidas::dynld::isff::CSI_IRGA_Sonic::process(), nidas::dynld::isff::DAUSensor::process(), nidas::dynld::ModbusRTU::process(), nidas::dynld::raf::Watlow::process(), SampleDispatcher::SampleDispatcher(), nidas::dynld::WxtSensor::scanSample(), nidas::dynld::raf::SyncRecordSource::selectVariablesFromSensor(), nidas::dynld::StatisticsCruncher::setupCovariances(), nidas::dynld::StatisticsCruncher::setupFluxes(), nidas::dynld::StatisticsCruncher::setupMinMax(), nidas::dynld::StatisticsCruncher::setupPrunedTrivariances(), nidas::dynld::StatisticsCruncher::setupReducedFluxes(), nidas::dynld::StatisticsCruncher::setupReducedScalarFluxes(), nidas::dynld::StatisticsCruncher::setupTrivariances(), PConfig::showCalFiles(), nidas::core::DSMSensor::trimUnparsed(), nidas::dynld::isff::WisardMote::unpackTsoil(), nidas::dynld::A2DSensor::validate(), nidas::dynld::DSC_FreqCounter::validate(), nidas::dynld::DSC_PulseCounter::validate(), nidas::dynld::GPS_NMEA_Serial::validate(), nidas::dynld::GPS_Novatel_Serial::validate(), nidas::dynld::IEEE_Float::validate(), nidas::dynld::isff::CSI_CRX_Binary::validate(), nidas::dynld::isff::Licor7500::validate(), nidas::dynld::isff::NCAR_TRH::validate(), nidas::dynld::isff::Wind2D::validate(), nidas::dynld::ModbusRTU::validate(), nidas::dynld::raf::A2D_Serial::validate(), nidas::dynld::raf::PSI9116_Sensor::validate(), nidas::dynld::raf::SppSerial::validate(), nidas::dynld::raf::TwoD64_USB_v3::validate(), nidas::dynld::Uio48Sensor::validate(), nidas::core::CharacterSensor::validateSscanfs(), nidas::dynld::isff::Wind2D::validateSscanfs(), and nidas::dynld::WxtSensor::wxtValidateSscanfs().

◆ isEnabled()

bool nidas::core::SampleTag::isEnabled ( ) const
inline

◆ isProcessed()

bool nidas::core::SampleTag::isProcessed ( ) const
inline

◆ operator=()

SampleTag & SampleTag::operator= ( const SampleTag & rhs)

◆ removeVariable()

void SampleTag::removeVariable ( const Variable * var)

◆ setDSMConfig()

void nidas::core::SampleTag::setDSMConfig ( const DSMConfig * val)
inline

◆ setDSMId()

void nidas::core::SampleTag::setDSMId ( unsigned int val)
inline

◆ setDSMSensor()

void SampleTag::setDSMSensor ( const DSMSensor * val)

◆ setEnabled()

void nidas::core::SampleTag::setEnabled ( bool val)
inline

References _enabled, and nidas::core::getSample().

Referenced by fromDOMElement().

◆ setId()

void nidas::core::SampleTag::setId ( dsm_sample_id_t val)
inlineprotected

Set the full id.

We don't make this public, because when you use it you can't keep track of the sensor and sample portions of the shortID.

References _id, and SET_FULL_ID.

◆ setPeriod()

virtual void nidas::core::SampleTag::setPeriod ( double val)
inlinevirtual

Set sampling period (1/rate) in sec.

A value of 0.0 means an unknown period.

Exceptions
nidas::util::InvalidParameterException

References _rate.

Referenced by fromDOMElement().

◆ setProcessed()

void nidas::core::SampleTag::setProcessed ( bool val)
inline

Set if this sample is going to be post processed.

Exceptions
nidas::util::InvalidParameterException

References _processed, and nidas::core::getSample().

Referenced by fromDOMElement().

◆ setPromptOffset()

void nidas::core::SampleTag::setPromptOffset ( double val)
inline

References _promptOffset, and nidas::core::getSample().

Referenced by fromDOMElement().

◆ setPromptString()

void nidas::core::SampleTag::setPromptString ( const std::string & val)
inline

References _promptString, and nidas::core::getSample().

Referenced by fromDOMElement().

◆ setRate()

virtual void nidas::core::SampleTag::setRate ( double val)
inlinevirtual

Set sampling rate in samples/sec.

Derived SampleTags can override this method and throw an InvalidParameterException if they can't support the rate value. Sometimes a rate of 0.0 may mean don't sample the variables in the SampleTag.

Exceptions
nidas::util::InvalidParameterException

References _rate, and nidas::core::getSample().

Referenced by nidas::core::DSMSensor::fromDOMElement(), fromDOMElement(), nidas::dynld::raf::IRIGSensor::fromDOMElement(), DataPrep::run(), nidas::dynld::raf::SyncRecordReader::scanHeader(), nidas::core::SampleAverager::setAveragePeriodSecs(), nidas::dynld::StatisticsCruncher::StatisticsCruncher(), and nidas::dynld::raf::SyncRecordSource::SyncRecordSource().

◆ setSampleId()

void nidas::core::SampleTag::setSampleId ( unsigned int val)
inline

◆ setScanfFormat()

void nidas::core::SampleTag::setScanfFormat ( const std::string & val)
inline

References _scanfFormat, and nidas::core::getSample().

Referenced by fromDOMElement().

◆ setSensorId()

void nidas::core::SampleTag::setSensorId ( unsigned int val)
inline

◆ setSpSId()

void nidas::core::SampleTag::setSpSId ( unsigned int val)
inlineprotected

Set the sensor + sample portions of the id.

We don't make this public, because when you use it you can't keep track of the sensor and sample portions of the shortID.

References _id, and SET_SPS_ID.

◆ setStation()

void SampleTag::setStation ( int val)

◆ setSuffix()

void SampleTag::setSuffix ( const std::string & val)

◆ setTimetagAdjust()

void nidas::core::SampleTag::setTimetagAdjust ( float val)
inline

References _ttAdjustVal, and nidas::core::getSample().

Referenced by fromDOMElement().

◆ toDOMElement()

xercesc::DOMElement * SampleTag::toDOMElement ( xercesc::DOMElement * node,
bool complete ) const
virtual

◆ toDOMParent()

xercesc::DOMElement * SampleTag::toDOMParent ( xercesc::DOMElement * parent,
bool complete ) const
virtual
Exceptions
xercesc::DOMException

Reimplemented from nidas::core::DOMable.

References nidas::core::DOMable::getNamespaceURI(), and toDOMElement().

Referenced by nidas::core::DSMSensor::toDOMParent().

Member Data Documentation

◆ _constParameters

std::list<const Parameter*> nidas::core::SampleTag::_constParameters
private

List of const pointers to Parameters for providing via getParameters().

Referenced by addParameter(), getParameter(), and getParameters().

◆ _constVariables

std::vector<const Variable*> nidas::core::SampleTag::_constVariables
private

◆ _dsm

const DSMConfig* nidas::core::SampleTag::_dsm
private

◆ _enabled

bool nidas::core::SampleTag::_enabled
private

Referenced by isEnabled(), operator=(), and setEnabled().

◆ _id

dsm_sample_id_t nidas::core::SampleTag::_id
private

◆ _parameters

std::list<Parameter*> nidas::core::SampleTag::_parameters
private

List of pointers to Parameters.

Referenced by addParameter(), and ~SampleTag().

◆ _processed

bool nidas::core::SampleTag::_processed
private

◆ _promptOffset

double nidas::core::SampleTag::_promptOffset
private

◆ _promptString

std::string nidas::core::SampleTag::_promptString
private

◆ _rate

double nidas::core::SampleTag::_rate
private

◆ _sampleId

unsigned int nidas::core::SampleTag::_sampleId
private

◆ _scanfFormat

std::string nidas::core::SampleTag::_scanfFormat
private

◆ _sensor

const DSMSensor* nidas::core::SampleTag::_sensor
private

◆ _sensorId

unsigned int nidas::core::SampleTag::_sensorId
private

◆ _station

int nidas::core::SampleTag::_station
private

Referenced by getStation(), operator=(), and setStation().

◆ _suffix

std::string nidas::core::SampleTag::_suffix
private

Referenced by getSuffix(), operator=(), and setSuffix().

◆ _ttAdjustVal

float nidas::core::SampleTag::_ttAdjustVal
private

If positive, enable TimetagAdjustor for these samples.

Referenced by getTimetagAdjust(), and setTimetagAdjust().

◆ _variableNames

std::vector<std::string> nidas::core::SampleTag::_variableNames
private

◆ _variables

std::vector<Variable*> nidas::core::SampleTag::_variables
private

◆ namespaceURI

XMLCh * DOMable::namespaceURI = 0
staticprivateinherited

The documentation for this class was generated from the following files: