nidas  v1.2-1520
Public Member Functions | Private Attributes | List of all members
nidas::core::VariableIndex Class Reference

A VariableIndex associates a Variable pointer with it's index into it's SampleTag. More...

#include <VariableIndex.h>

Public Member Functions

 VariableIndex ()
 Default constructor creates an invalid VariableIndex: the Variable pointer is null and the index is -1. More...
 
 VariableIndex (Variable *var, int index)
 Construct a VariableIndex with the given Variable and index. More...
 
 VariableIndex (const VariableIndex &rhs)
 The copy constructor copies the pointer and index of the given VariableIndex. More...
 
VariableIndexoperator= (const VariableIndex &rhs)
 Assign the pointer and index of the given VariableIndex to this instance. More...
 
bool operator== (const VariableIndex &rhs) const
 
Variablevariable ()
 
int index ()
 
float get (float *fdata, float dflt)
 Return the data value at this variable's index into fdata. More...
 
void set (float *fdata, float value)
 Set value at this variable's index into fdata. More...
 
bool operator! () const
 
bool valid () const
 

Private Attributes

Variable_variable
 
int _index
 

Detailed Description

A VariableIndex associates a Variable pointer with it's index into it's SampleTag.

Sensor classes can use this to keep a pointer to a Variable and locate the Variable's data in the samples with it's SampleTag. See DSMSensor::findVariableIndex().

A variable's index into the sample tag is not necessarily the same as the offset to the variable's data inside a sample, since the preceding variables may have lengths greater than 1. So this may be a good place to store the data offset also, and then sensor code could be modified to use this class and the offset rather than using simple integer index directly.

This functionality could be rolled into the Variable class, but it would be up to the SampleTag to update the index of all the Variable's whenever the Variable list changes. For now, this class at least allows managing a Variable pointer and index after the SampleTag is finished.

Constructor & Destructor Documentation

nidas::core::VariableIndex::VariableIndex ( )
inline

Default constructor creates an invalid VariableIndex: the Variable pointer is null and the index is -1.

nidas::core::VariableIndex::VariableIndex ( Variable var,
int  index 
)
inline

Construct a VariableIndex with the given Variable and index.

nidas::core::VariableIndex::VariableIndex ( const VariableIndex rhs)
inline

The copy constructor copies the pointer and index of the given VariableIndex.

Member Function Documentation

float nidas::core::VariableIndex::get ( float *  fdata,
float  dflt 
)
inline

Return the data value at this variable's index into fdata.

If this variable does not have a valid index, then return dflt.

References _index.

int nidas::core::VariableIndex::index ( )
inline

References _index.

Referenced by nidas::dynld::isff::NCAR_TRH::process().

bool nidas::core::VariableIndex::operator! ( ) const
inline

References _index, and _variable.

VariableIndex& nidas::core::VariableIndex::operator= ( const VariableIndex rhs)
inline

Assign the pointer and index of the given VariableIndex to this instance.

References _index, and _variable.

bool nidas::core::VariableIndex::operator== ( const VariableIndex rhs) const
inline

References _index, and _variable.

void nidas::core::VariableIndex::set ( float *  fdata,
float  value 
)
inline

Set value at this variable's index into fdata.

If this variable does not have a valid index, then nothing is changed.

References _index.

bool nidas::core::VariableIndex::valid ( ) const
inline
Variable* nidas::core::VariableIndex::variable ( )
inline

Member Data Documentation

int nidas::core::VariableIndex::_index
private
Variable* nidas::core::VariableIndex::_variable
private

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