# MI - Fimex: MetNoFimex::CDMVariable Class Reference

# MetNoFimex::CDMVariable Class Reference

`#include <fimex/CDMVariable.h>`

Inheritance diagram for MetNoFimex::CDMVariable:

List of all members.

## Public Member Functions

| CDMVariable (std::string name, CDMDataType datatype, std::vector< std::string > shape)
virtual | ~CDMVariable ()
const std::string & | getName () const
void | setName (std::string newName)
CDMDataType | getDataType () const
void | setDataType (CDMDataType type)
const std::vector< std::string > & | getShape () const
void | setShape (std::vector< std::string > newShape)
void | setAsSpatialVector (const std::string &counterpart, const std::string &direction)
bool | isSpatialVector () const
const std::string & | getSpatialVectorCounterpart () const
| get the spatial counterpart of this vector
const std::string & | getSpatialVectorDirection () const
| get the possible directions of this spatial vector (comma-separated string)
bool | checkDimension (const std::string &dimension) const
void | toXMLStream (std::ostream &out) const
| print a xml representation to the stream without attributes
void | toXMLStream (std::ostream &out, const std::vector< CDMAttribute > &attrs) const
| print a xml representation to the stream with attributes
void | setData (boost::shared_ptr< Data > data)
| add data to the variable
const boost::shared_ptr< Data > | getData () const
| retrieve volatile data from this variable
int | hasData () const
| check if real data has been set with setData() (null-pointer reference returns false)

## Constructor & Destructor Documentation

MetNoFimex::CDMVariable::CDMVariable | ( | std::string | name,
|  | CDMDataType | datatype,
|  | std::vector< std::string > | shape |
| ) |  |  | `[explicit]`

virtual MetNoFimex::CDMVariable::~CDMVariable | ( |  | ) | `[virtual]`

## Member Function Documentation

const std::string& MetNoFimex::CDMVariable::getName | ( |  | ) | const`[inline, virtual]`

Implements MetNoFimex::CDMNamedEntity.

Referenced by MetNoFimex::CoordinateAxis::operator<().

void MetNoFimex::CDMVariable::setName | ( | std::string | newName | ) | `[inline]`

CDMDataType MetNoFimex::CDMVariable::getDataType | ( |  | ) | const`[inline]`

void MetNoFimex::CDMVariable::setDataType | ( | CDMDataType | type | ) | `[inline]`

const std::vector<std::string>& MetNoFimex::CDMVariable::getShape | ( |  | ) | const`[inline]`

void MetNoFimex::CDMVariable::setShape | ( | std::vector< std::string > | newShape | ) | `[inline]`

void MetNoFimex::CDMVariable::setAsSpatialVector | ( | const std::string & | counterpart,
|  | const std::string & | direction |
| ) |  |  |

Declare this variable to be part of a spatial vector, e.g. (x-wind, y-wind)

Parameters:

  | counterpart | name of the other variable being part of this vector
  | direction | comma-separated list of possible directions for this vector, e.g. "x,longitude"

bool MetNoFimex::CDMVariable::isSpatialVector | ( |  | ) | const`[inline]`

test if this variable has been declared to be a spatial vector

const std::string& MetNoFimex::CDMVariable::getSpatialVectorCounterpart | ( |  | ) | const`[inline]`

get the spatial counterpart of this vector

const std::string& MetNoFimex::CDMVariable::getSpatialVectorDirection | ( |  | ) | const`[inline]`

get the possible directions of this spatial vector (comma-separated string)

bool MetNoFimex::CDMVariable::checkDimension | ( | const std::string & | dimension | ) | const

check the dimension of a variable

Parameters:

  | dimension | the dimension to check for

void MetNoFimex::CDMVariable::toXMLStream | ( | std::ostream & | out | ) | const

print a xml representation to the stream without attributes

void MetNoFimex::CDMVariable::toXMLStream | ( | std::ostream & | out,
|  | const std::vector< CDMAttribute > & | attrs |
| ) |  |  | const

print a xml representation to the stream with attributes

void MetNoFimex::CDMVariable::setData | ( | boost::shared_ptr< Data > | data | ) | `[inline]`

add data to the variable

const boost::shared_ptr<Data> MetNoFimex::CDMVariable::getData | ( |  | ) | const`[inline]`

retrieve volatile data from this variable

Retrieve data, but only if it has been set previously by setData() this method will not try to read data from the disk. Use CDMReader::getData(const std::string& varName) to get the data from memory or from disk.

int MetNoFimex::CDMVariable::hasData | ( |  | ) | const`[inline]`

check if real data has been set with setData() (null-pointer reference returns false)

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

- include/fimex/CDMVariable.h