nidas  v1.2-1520
Public Member Functions | Static Public Member Functions | Protected Member Functions | 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. More...
 
 SampleTag (const DSMSensor *sensor)
 Constructor of a sample for a given sensor. More...
 
 SampleTag (const SampleTag &)
 Copy constructor. More...
 
virtual ~SampleTag ()
 
SampleTagoperator= (const SampleTag &rhs)
 
void setSampleId (unsigned int val)
 Set the sample portion of the shortId. More...
 
unsigned int getSampleId () const
 Get the sample portion of the shortId. More...
 
void setSensorId (unsigned int val)
 Set the sensor portion of the shortId. More...
 
unsigned int getSensorId () const
 Get the sensor portion of the shortId. More...
 
void setDSMId (unsigned int val)
 Set the DSM portion of the id. More...
 
unsigned int getDSMId () const
 Get the DSM portion of the id. More...
 
dsm_sample_id_t getId () const
 Get the 26 bit id, containing the DSM id and the sensor+sample id. More...
 
unsigned int getSpSId () const
 Get the sensor+sample portion of the id. More...
 
const std::string & getSuffix () const
 Suffix, which is appended to variable names. More...
 
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. More...
 
void setStation (int val)
 
const SitegetSite () const
 Get the Site of this SampleTag, which will be non-NULL only if getDSMConfig() returns non-NULL. More...
 
virtual void setRate (double val) throw (nidas::util::InvalidParameterException)
 Set sampling rate in samples/sec. More...
 
virtual double getRate () const
 Get sampling rate in samples/sec. More...
 
virtual void setPeriod (double val) throw (nidas::util::InvalidParameterException)
 Set sampling period (1/rate) in sec. More...
 
virtual double getPeriod () const
 Get sampling period (1/rate) in sec. More...
 
void setProcessed (bool val) throw (nidas::util::InvalidParameterException)
 Set if this sample is going to be post processed. More...
 
bool isProcessed () const
 Test to see if this sample is to be post processed. More...
 
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) throw (nidas::util::InvalidParameterException)
 Add a variable to this SampleTag. More...
 
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. More...
 
void addParameter (Parameter *val)
 Add a parameter to this SampleTag. More...
 
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. More...
 
float getTimetagAdjust () const
 Whether to enable TimetagAdjuster for this sample. More...
 
void setTimetagAdjust (float val)
 
VariableIterator getVariableIterator () const
 
void fromDOMElement (const xercesc::DOMElement *) throw (nidas::util::InvalidParameterException)
 Initialize myself from a xercesc::DOMElement. More...
 
xercesc::DOMElement * toDOMParent (xercesc::DOMElement *parent, bool complete) const throw (xercesc::DOMException)
 Create a DOMElement and append it to the parent. More...
 
xercesc::DOMElement * toDOMElement (xercesc::DOMElement *node, bool complete) const throw (xercesc::DOMException)
 Add my content into a DOMElement. More...
 

Static Public Member Functions

static const XMLCh * getNamespaceURI ()
 

Protected Member Functions

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

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. More...
 
std::list< const Parameter * > _constParameters
 List of const pointers to Parameters for providing via getParameters(). More...
 
bool _enabled
 
float _ttAdjustVal
 If positive, enable TimetagAdjustor for these samples. More...
 

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::SampleTag ( )

Constructor.

SampleTag::SampleTag ( const DSMSensor sensor)

Constructor of a sample for a given sensor.

References _dsm, _sensor, nidas::core::DSMConfig::getId(), nidas::core::DSMSensor::getId(), setDSMId(), and setSensorId().

SampleTag::SampleTag ( const SampleTag x)
SampleTag::~SampleTag ( )
virtual

References _parameters, and _variables.

Member Function Documentation

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::Parameter::getName().

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

void SampleTag::addVariable ( Variable var)
throw (nidas::util::InvalidParameterException
)
virtual
void SampleTag::fromDOMElement ( const xercesc::DOMElement *  )
throw (nidas::util::InvalidParameterException
)
virtual
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.

Referenced by nidas::dynld::StatisticsCruncher::attach(), nidas::core::NearestResampler::connect(), nidas::core::SampleAverager::connect(), and nidas::core::NearestResamplerAtRate::connect().

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

References _dsm.

unsigned int nidas::core::SampleTag::getDSMId ( ) const
inline
const DSMSensor* nidas::core::SampleTag::getDSMSensor ( ) const
inline
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::StatisticsCruncher::attach(), nidas::dynld::isff::ATIK_Sonic::checkSampleTags(), nidas::dynld::isff::CSI_IRGA_Sonic::checkSampleTags(), nidas::dynld::isff::CSAT3_Sonic::checkSampleTags(), nidas::dynld::isff::Wind3D::checkSampleTags(), nidas::dynld::StatisticsCruncher::computeStats(), nidas::core::SamplePipeline::connect(), nidas::core::NearestResampler::connect(), nidas::core::SampleAverager::connect(), nidas::dynld::StatisticsCruncher::connect(), nidas::core::NearestResamplerAtRate::connect(), nidas::dynld::isff::GOESOutput::connected(), nidas::dynld::raf::CVIProcessor::connectSource(), nidas::dynld::StatisticsProcessor::connectSource(), DataStats::createCounters(), nidas::core::NearestResampler::ctorCommon(), nidas::core::NearestResamplerAtRate::ctorCommon(), nidas::core::Project::findSensor(), nidas::core::Site::findSensor(), nidas::core::SampleAverager::flush(), nidas::core::NearestResampler::flush(), nidas::dynld::raf::IRIGSensor::fromDOMElement(), nidas::core::DSMSensor::fromDOMElement(), nidas::core::Project::getUniqueSampleId(), nidas::dynld::isff::GOESProject::GOESProject(), nidas::dynld::raf::A2DBoardTempSensor::init(), nidas::dynld::DSC_Event::init(), nidas::dynld::WxtSensor::init(), nidas::dynld::raf::TwoD_USB::init(), nidas::core::CharacterSensor::init(), nidas::dynld::raf::DSMArincSensor::init(), nidas::dynld::raf::SyncRecordSource::init(), nidas::dynld::raf::TwoD64_USB::init_parameters(), nidas::dynld::raf::TwoD64_USB_v3::init_parameters(), nidas::dynld::raf::SortByRateThenLabel::operator()(), nidas::dynld::raf::Watlow::process(), nidas::dynld::isff::CU_Coldwire::process(), nidas::dynld::iss::WICORSensor::process(), nidas::dynld::A2DSensor::process(), nidas::dynld::isff::CSAT3_Sonic::process(), nidas::dynld::raf::DSMAnalogSensor::process(), nidas::dynld::isff::PacketInputStream::readSamples(), TestSource::run(), nidas::dynld::isff::GOESOutput::run(), SampleDispatcher::SampleDispatcher(), nidas::dynld::WxtSensor::scanSample(), nidas::core::CharacterSensor::searchSampleScanners(), nidas::dynld::raf::SyncRecordSource::selectVariablesFromSensor(), DumpClient::setSensors(), nidas::dynld::isff::WisardMote::unpackTsoil(), nidas::dynld::GPS_Novatel_Serial::validate(), nidas::dynld::GPS_NMEA_Serial::validate(), nidas::dynld::isff::CSI_CRX_Binary::validate(), nidas::dynld::raf::PSI9116_Sensor::validate(), nidas::dynld::isff::Wind2D::validate(), nidas::dynld::DSC_PulseCounter::validate(), nidas::dynld::DSC_FreqCounter::validate(), nidas::core::DSMConfig::validateSensorAndSampleIds(), nidas::dynld::isff::Wind2D::validateSscanfs(), and nidas::dynld::WxtSensor::wxtValidateSscanfs().

static const XMLCh* nidas::core::DOMable::getNamespaceURI ( )
inlinestaticinherited
const Parameter * SampleTag::getParameter ( const std::string &  name) const
const std::list<const Parameter*>& nidas::core::SampleTag::getParameters ( ) const
inline
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::isff::GOESOutput::connected(), and nidas::dynld::isff::GOESOutput::run().

double nidas::core::SampleTag::getPromptOffset ( ) const
inline
const std::string& nidas::core::SampleTag::getPromptString ( ) const
inline
virtual double nidas::core::SampleTag::getRate ( ) const
inlinevirtual
unsigned int nidas::core::SampleTag::getSampleId ( ) const
inline
const std::string& nidas::core::SampleTag::getScanfFormat ( ) const
inline
unsigned int nidas::core::SampleTag::getSensorId ( ) const
inline

Get the sensor portion of the shortId.

References _sensorId.

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::DSMConfig::getSite().

Referenced by nidas::core::Variable::setSampleTag(), and SampleToDatabase::setSiteAndMeasurement().

unsigned int nidas::core::SampleTag::getSpSId ( ) const
inline
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 PConfig::loadVariables(), and nidas::core::Variable::setSampleTag().

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

Suffix, which is appended to variable names.

References _suffix.

Referenced by SampleToDatabase::setSiteAndMeasurement().

float nidas::core::SampleTag::getTimetagAdjust ( ) const
inline
Variable& nidas::core::SampleTag::getVariable ( int  i)
inline
VariableIterator SampleTag::getVariableIterator ( ) const
const std::vector< const Variable * > & SampleTag::getVariables ( ) const

References _constVariables.

Referenced by nidas::dynld::StatisticsCruncher::addVariable(), nidas::core::DSMSensor::applyConversions(), nidas::dynld::isff::ATIK_Sonic::checkSampleTags(), nidas::dynld::isff::CSI_IRGA_Sonic::checkSampleTags(), nidas::dynld::isff::CSAT3_Sonic::checkSampleTags(), SampleCounter::collectMetadata(), nidas::dynld::psql::PSQLProcessor::connect(), nidas::dynld::isff::GOESOutput::connected(), nidas::dynld::StatisticsProcessor::connectSource(), nidas::dynld::StatisticsCruncher::createCombinations(), DataStats::createCounters(), nidas::dynld::isff::WisardMote::createSampleTags(), nidas::dynld::psql::PSQLSampleOutput::createTables(), nidas::core::DSMSensor::findVariableIndex(), nidas::dynld::raf::IRIGSensor::fromDOMElement(), nidas::dynld::isff::GOESProject::GOESProject(), nidas::core::VariableIterator::hasNext(), nidas::dynld::raf::UHSAS_Serial::init(), nidas::dynld::DSC_Event::init(), nidas::dynld::WxtSensor::init(), nidas::dynld::raf::TwoD_USB::init(), nidas::core::CharacterSensor::init(), nidas::dynld::raf::DSMArincSensor::init(), nidas::dynld::StatisticsCruncher::initStats(), StatsProcess::listOutputSamples(), nidas::dynld::raf::DSMArincSensor::open(), operator=(), nidas::dynld::raf::Watlow::process(), nidas::dynld::isff::CU_Coldwire::process(), nidas::dynld::isff::CSI_IRGA_Sonic::process(), nidas::dynld::A2DSensor::process(), nidas::dynld::isff::CSAT3_Sonic::process(), nidas::dynld::raf::DSMAnalogSensor::process(), nidas::dynld::isff::WisardMote::process(), nidas::dynld::isff::PacketInputStream::readSamples(), nidas::dynld::isff::GOESOutput::run(), SampleDispatcher::SampleDispatcher(), SampleTag(), 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::GPS_Novatel_Serial::validate(), nidas::dynld::GPS_NMEA_Serial::validate(), nidas::dynld::isff::Licor7500::validate(), nidas::dynld::raf::TwoD64_USB_v3::validate(), nidas::dynld::isff::CSI_CRX_Binary::validate(), nidas::dynld::raf::PSI9116_Sensor::validate(), nidas::dynld::isff::NCAR_TRH::validate(), nidas::dynld::isff::Wind2D::validate(), nidas::dynld::DSC_PulseCounter::validate(), nidas::dynld::DSC_FreqCounter::validate(), nidas::dynld::A2DSensor::validate(), nidas::dynld::raf::A2D_Serial::validate(), nidas::dynld::raf::SppSerial::validate(), nidas::dynld::isff::Wind2D::validateSscanfs(), nidas::core::CharacterSensor::validateSscanfs(), and nidas::dynld::WxtSensor::wxtValidateSscanfs().

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

References _variables.

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

References _enabled.

bool nidas::core::SampleTag::isProcessed ( ) const
inline
SampleTag & SampleTag::operator= ( const SampleTag rhs)
void SampleTag::removeVariable ( const Variable var)
void nidas::core::SampleTag::setDSMConfig ( const DSMConfig val)
inline

References _dsm.

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

void nidas::core::SampleTag::setDSMId ( unsigned int  val)
inline
void SampleTag::setDSMSensor ( const DSMSensor val)
void nidas::core::SampleTag::setEnabled ( bool  val)
inline

References _enabled.

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.

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

Set sampling period (1/rate) in sec.

A value of 0.0 means an unknown period.

References _rate.

Referenced by nidas::dynld::isff::GOESProject::GOESProject().

void nidas::core::SampleTag::setProcessed ( bool  val)
throw (nidas::util::InvalidParameterException
)
inline

Set if this sample is going to be post processed.

References _processed.

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

References _promptOffset.

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

References _promptString.

virtual void nidas::core::SampleTag::setRate ( double  val)
throw (nidas::util::InvalidParameterException
)
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.

References _rate.

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

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

References _scanfFormat.

void nidas::core::SampleTag::setSensorId ( unsigned int  val)
inline
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.

void SampleTag::setStation ( int  val)
void SampleTag::setSuffix ( const std::string &  val)
void nidas::core::SampleTag::setTimetagAdjust ( float  val)
inline

References _ttAdjustVal.

xercesc::DOMElement * SampleTag::toDOMElement ( xercesc::DOMElement *  node,
bool  complete 
) const
throw (xercesc::DOMException
)
virtual
xercesc::DOMElement * SampleTag::toDOMParent ( xercesc::DOMElement *  parent,
bool  complete 
) const
throw (xercesc::DOMException
)
virtual

Create a DOMElement and append it to the parent.

Reimplemented from nidas::core::DOMable.

References nidas::core::DOMable::getNamespaceURI().

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

Member Data Documentation

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().

std::vector<const Variable*> nidas::core::SampleTag::_constVariables
private
const DSMConfig* nidas::core::SampleTag::_dsm
private
bool nidas::core::SampleTag::_enabled
private

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

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

List of pointers to Parameters.

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

bool nidas::core::SampleTag::_processed
private
double nidas::core::SampleTag::_promptOffset
private
std::string nidas::core::SampleTag::_promptString
private
double nidas::core::SampleTag::_rate
private
unsigned int nidas::core::SampleTag::_sampleId
private
std::string nidas::core::SampleTag::_scanfFormat
private
const DSMSensor* nidas::core::SampleTag::_sensor
private
unsigned int nidas::core::SampleTag::_sensorId
private
int nidas::core::SampleTag::_station
private

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

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

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

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

If positive, enable TimetagAdjustor for these samples.

Referenced by getTimetagAdjust(), and setTimetagAdjust().

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

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