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

Why isn't this a sublcass of Polynomial which sets MAX_NUM_COEFFS to 2? More...

#include <VariableConverter.h>

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

Public Member Functions

 Linear ()
 
Linearclone () const
 
void setSlope (float val)
 
float getSlope () const
 
void setIntercept (float val)
 
float getIntercept () const
 
double convert (dsm_time_t t, double val)
 
void reset ()
 Reset the converter to invalid or default settings, such as after an error occurs parsing a CalFile. More...
 
void parseFields (CalFile *cf)
 Parse the fields in the current CalFile record for the particular settings and coefficients needed by this converter. More...
 
std::string toString () const
 Generate a string description of this VariableConverter. More...
 
void fromString (const std::string &) throw (nidas::util::InvalidParameterException)
 
void fromDOMElement (const xercesc::DOMElement *) throw (nidas::util::InvalidParameterException)
 Initialize myself from a xercesc::DOMElement. More...
 
virtual void readCalFile (dsm_time_t) throw ()
 Before a VariableConverter can be used for a conversion, the converter's CalFile, if it exists, needs to be advanced to the right record for the current sample time. More...
 
void setCalFileHandler (CalFileHandler *)
 Set the instance of CalFileHandler which will be called and given first option to handle new CalFile records. More...
 
void setUnits (const std::string &val)
 
virtual const std::string & getUnits () const
 
void setVariable (const Variable *val)
 
const VariablegetVariable () const
 
const DSMSensorgetDSMSensor () const
 
const DSMConfiggetDSMConfig () const
 
void addParameter (Parameter *val)
 Add a parameter to this VariableConverter. More...
 
const std::list< const
Parameter * > & 
getParameters () const
 Get list of parameters. More...
 
const ParametergetParameter (const std::string &name) const
 Fetch a parameter by name. More...
 
void setCalFile (CalFile *)
 
CalFilegetCalFile ()
 
const CalFilegetCalFile () const
 
virtual xercesc::DOMElement * toDOMParent (xercesc::DOMElement *parent, bool complete) const throw (xercesc::DOMException)
 Create a DOMElement and append it to the parent. More...
 
virtual xercesc::DOMElement * toDOMElement (xercesc::DOMElement *node, bool complete) const throw (xercesc::DOMException)
 Add my content into a DOMElement. More...
 

Static Public Member Functions

static VariableConvertercreateVariableConverter (XDOMElement &child)
 
static VariableConvertercreateFromString (const std::string &) throw (nidas::util::InvalidParameterException)
 
static const XMLCh * getNamespaceURI ()
 

Protected Member Functions

void abortCalFile (const std::string &what)
 

Protected Attributes

CalFile_calFile
 
CalFileHandler_handler
 

Private Attributes

float _slope
 
float _intercept
 

Detailed Description

Why isn't this a sublcass of Polynomial which sets MAX_NUM_COEFFS to 2?

Constructor & Destructor Documentation

Linear::Linear ( )

Referenced by clone().

Member Function Documentation

void VariableConverter::abortCalFile ( const std::string &  what)
protectedinherited
void VariableConverter::addParameter ( Parameter val)
inherited

Add a parameter to this VariableConverter.

VariableConverter will then own the pointer and will delete it in its destructor. If a Parameter exists with the same name, it will be replaced with the new Parameter.

References nidas::core::VariableConverter::_constParameters, nidas::core::VariableConverter::_parameters, and nidas::core::Parameter::getName().

Referenced by nidas::core::VariableConverter::operator=(), and nidas::core::VariableConverter::VariableConverter().

Linear * Linear::clone ( ) const
virtual

Implements nidas::core::VariableConverter.

References Linear().

double Linear::convert ( dsm_time_t  t,
double  val 
)
virtual
VariableConverter * VariableConverter::createFromString ( const std::string &  str)
throw (nidas::util::InvalidParameterException
)
staticinherited
VariableConverter * VariableConverter::createVariableConverter ( XDOMElement child)
staticinherited
void Linear::fromDOMElement ( const xercesc::DOMElement *  )
throw (nidas::util::InvalidParameterException
)
virtual

Initialize myself from a xercesc::DOMElement.

Reimplemented from nidas::core::VariableConverter.

References nidas::core::VariableConverter::fromDOMElement(), and nidas::core::XDOMAttr::getName().

void Linear::fromString ( const std::string &  str)
throw (nidas::util::InvalidParameterException
)
virtual

Reimplemented from nidas::core::VariableConverter.

CalFile* nidas::core::VariableConverter::getCalFile ( )
inlineinherited
const CalFile* nidas::core::VariableConverter::getCalFile ( ) const
inlineinherited
const DSMConfig * VariableConverter::getDSMConfig ( ) const
inherited
const DSMSensor * VariableConverter::getDSMSensor ( ) const
inherited
float nidas::core::Linear::getIntercept ( ) const
inline
static const XMLCh* nidas::core::DOMable::getNamespaceURI ( )
inlinestaticinherited
const Parameter * VariableConverter::getParameter ( const std::string &  name) const
inherited

Fetch a parameter by name.

Returns a NULL pointer if no such parameter exists.

References nidas::core::VariableConverter::_parameters.

const std::list<const Parameter*>& nidas::core::VariableConverter::getParameters ( ) const
inlineinherited
float nidas::core::Linear::getSlope ( ) const
inline
virtual const std::string& nidas::core::VariableConverter::getUnits ( ) const
inlinevirtualinherited
const Variable* nidas::core::VariableConverter::getVariable ( ) const
inlineinherited
void Linear::parseFields ( CalFile cf)
virtual

Parse the fields in the current CalFile record for the particular settings and coefficients needed by this converter.

Implements nidas::core::VariableConverter.

References nidas::core::CalFile::getFields(), setIntercept(), and setSlope().

void VariableConverter::readCalFile ( dsm_time_t  t)
throw (
)
virtualinherited

Before a VariableConverter can be used for a conversion, the converter's CalFile, if it exists, needs to be advanced to the right record for the current sample time.

As records are read, this method calls parseFields() so the VariableConverter subclass can extract the particular information it needs from the CalFile fields, typically coefficients.

For sensors which need to extend the kind of conversions which can be specified by a CalFile, there is a callback function available. See setCalFileHandler().

References DLOG, nidas::util::UTime::format(), and nidas::util::Exception::what().

Referenced by convert(), nidas::core::Polynomial::convert(), nidas::dynld::isff::NCAR_TRH::convertVariable(), and nidas::dynld::raf::SyncRecordSource::preLoadCalibrations().

void Linear::reset ( )
virtual

Reset the converter to invalid or default settings, such as after an error occurs parsing a CalFile.

Implements nidas::core::VariableConverter.

References nidas::core::floatNAN, setIntercept(), and setSlope().

void VariableConverter::setCalFile ( CalFile val)
inherited
void VariableConverter::setCalFileHandler ( CalFileHandler cfh)
inherited

Set the instance of CalFileHandler which will be called and given first option to handle new CalFile records.

Pass null to disable the callbacks.

References nidas::core::VariableConverter::_handler.

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

void nidas::core::Linear::setIntercept ( float  val)
inline

References _intercept.

Referenced by parseFields(), and reset().

void nidas::core::Linear::setSlope ( float  val)
inline

References _slope.

Referenced by parseFields(), and reset().

void nidas::core::VariableConverter::setUnits ( const std::string &  val)
inlineinherited
void nidas::core::VariableConverter::setVariable ( const Variable val)
inlineinherited
xercesc::DOMElement * DOMable::toDOMElement ( xercesc::DOMElement *  node,
bool  complete 
) const
throw (xercesc::DOMException
)
virtualinherited
xercesc::DOMElement * DOMable::toDOMParent ( xercesc::DOMElement *  parent,
bool  complete 
) const
throw (xercesc::DOMException
)
virtualinherited
std::string Linear::toString ( ) const
virtual

Generate a string description of this VariableConverter.

May be used in meta-data, for example Netcdf comment.

Implements nidas::core::VariableConverter.

References _intercept, _slope, and nidas::core::VariableConverter::getUnits().

Member Data Documentation

CalFile* nidas::core::VariableConverter::_calFile
protectedinherited
CalFileHandler* nidas::core::VariableConverter::_handler
protectedinherited
float nidas::core::Linear::_intercept
private
float nidas::core::Linear::_slope
private

Referenced by convert(), getSlope(), setSlope(), and toString().


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