# MI - Fimex: MetNoFimex::GribApiCDMWriter_ImplAbstract Class Reference

# MetNoFimex::GribApiCDMWriter_ImplAbstract Class Reference

`#include <GribApiCDMWriter_ImplAbstract.h>`

Inheritance diagram for MetNoFimex::GribApiCDMWriter_ImplAbstract:

List of all members.

## Public Member Functions

| GribApiCDMWriter_ImplAbstract (int gribVersion, const boost::shared_ptr< CDMReader > &cdmReader, const std::string &outputFile, const std::string &configFile)
virtual | ~GribApiCDMWriter_ImplAbstract ()
void | run () throw (CDMException)
| actually write the data

## Protected Member Functions

virtual void | setGlobalAttributes ()
virtual void | setData (const boost::shared_ptr< Data > &data)
virtual void | setProjection (const std::string &varName)=0 throw (CDMException)
virtual void | setParameter (const std::string &varName, const FimexTime &fTime, double levelValue)=0 throw (CDMException)
virtual void | setTime (const std::string &varName, const FimexTime &fTime)
virtual void | setLevel (const std::string &varName, double levelValue)=0
virtual std::vector< double > | getLevels (const std::string &varName) throw (CDMException)
virtual std::vector< FimexTime > | getTimes (const std::string &varName) throw (CDMException)
virtual boost::shared_ptr< Data > | handleTypeScaleAndMissingData (const std::string &varName, const FimexTime &fTime, double levelValue, boost::shared_ptr< Data > inData)=0
virtual void | writeGribHandleToFile ()
xmlNode * | getNodePtr (const std::string &varName, const FimexTime &fTime, double levelValue) throw (CDMException)

## Protected Attributes

int | gribVersion
const std::string | configFile
const boost::shared_ptr< XMLDoc > | xmlConfig
boost::shared_ptr< grib_handle > | gribHandle
LoggerPtr | logger

## Constructor & Destructor Documentation

MetNoFimex::GribApiCDMWriter_ImplAbstract::GribApiCDMWriter_ImplAbstract | ( | int | gribVersion,
|  | const boost::shared_ptr< CDMReader > & | cdmReader,
|  | const std::string & | outputFile,
|  | const std::string & | configFile |
| ) |  |  |

Constructor of the general writer. It should be called during construction of derived classes.

remember to call run to actually do something

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

## Member Function Documentation

void MetNoFimex::GribApiCDMWriter_ImplAbstract::run | ( |  | ) | throw (CDMException)

actually write the data

The run function has be to called after construction the object to actually fetch and write the data.

virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::setGlobalAttributes | ( |  | ) | `[protected, virtual]`

add the global attributes from the config to the default grib-handle

virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::setData | ( | const boost::shared_ptr< Data > & | data | ) | `[protected, virtual]`

virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::setProjection | ( | const std::string & | varName | ) | throw (CDMException)`[protected, pure virtual]`

set the projection parameters, throw an exception if none are available

Parameters:

  | varName |

Exceptions:

  | CDMException | if parameters cannot be set

Implemented in MetNoFimex::GribApiCDMWriter_Impl1, and MetNoFimex::GribApiCDMWriter_Impl2.

virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::setParameter | ( | const std::string & | varName,
|  | const FimexTime & | fTime,
|  | double | levelValue |
| ) |  |  | throw (CDMException)`[protected, pure virtual]`

Implemented in MetNoFimex::GribApiCDMWriter_Impl1, and MetNoFimex::GribApiCDMWriter_Impl2.

virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::setTime | ( | const std::string & | varName,
|  | const FimexTime & | fTime |
| ) |  |  | `[protected, virtual]`

virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::setLevel | ( | const std::string & | varName,
|  | double | levelValue |
| ) |  |  | `[protected, pure virtual]`

Implemented in MetNoFimex::GribApiCDMWriter_Impl1, and MetNoFimex::GribApiCDMWriter_Impl2.

virtual std::vector<double> MetNoFimex::GribApiCDMWriter_ImplAbstract::getLevels | ( | const std::string & | varName | ) | throw (CDMException)`[protected, virtual]`

get the levels from the cdm scaled to values used in grib (units/scale-factor) assign at least 1 level, give it a default value if none is found in the cdm

virtual std::vector<FimexTime> MetNoFimex::GribApiCDMWriter_ImplAbstract::getTimes | ( | const std::string & | varName | ) | throw (CDMException)`[protected, virtual]`

get the times from the cdm as FimexTime (including unit) assign at least 1 time, give it a default value if none is found in the cdm

virtual boost::shared_ptr<Data> MetNoFimex::GribApiCDMWriter_ImplAbstract::handleTypeScaleAndMissingData | ( | const std::string & | varName,
|  | const FimexTime & | fTime,
|  | double | levelValue,
|  | boost::shared_ptr< Data > | inData |
| ) |  |  | `[protected, pure virtual]`

add the missing value to the gribHandle, rescale the data if needed and change the datatype if needed, change the missingValue of the data if need

Returns:
  modified data

Implemented in MetNoFimex::GribApiCDMWriter_Impl1, and MetNoFimex::GribApiCDMWriter_Impl2.

virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::writeGribHandleToFile | ( |  | ) | `[protected, virtual]`

xmlNode* MetNoFimex::GribApiCDMWriter_ImplAbstract::getNodePtr | ( | const std::string & | varName,
|  | const FimexTime & | fTime,
|  | double | levelValue |
| ) |  |  | throw (CDMException)`[protected]`

get the node belonging to varName, level and time from the config file

Parameters:

  | varName | name of the variable
  | fTime | current time
  | level | curent level

## Member Data Documentation

int MetNoFimex::GribApiCDMWriter_ImplAbstract::gribVersion `[protected]`

const std::string MetNoFimex::GribApiCDMWriter_ImplAbstract::configFile `[protected]`

const boost::shared_ptr<XMLDoc> MetNoFimex::GribApiCDMWriter_ImplAbstract::xmlConfig `[protected]`

boost::shared_ptr<grib_handle> MetNoFimex::GribApiCDMWriter_ImplAbstract::gribHandle `[protected]`

LoggerPtr MetNoFimex::GribApiCDMWriter_ImplAbstract::logger `[protected]`

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

- include/fimex/GribApiCDMWriter_ImplAbstract.h