# MI - Fimex: MetNoFimex::DataImpl< C > Class Template Reference

# MetNoFimex::DataImpl< C > Class Template Reference

`#include <DataImpl.h>`

Inheritance diagram for MetNoFimex::DataImpl< C >:

List of all members.

## Public Member Functions

| DataImpl (long length)
| constructor where the array will be automatically allocated
| DataImpl (boost::shared_array< C > array, long length)
virtual | ~DataImpl ()
virtual size_t | size () const
| size of the data
virtual int | bytes_for_one () const
| sizeof the data-impl datatype
virtual void * | getDataPtr ()
virtual void | toStream (std::ostream &os, std::string separator="") const
| printing of the current data to ostream, with optional separator
virtual const boost::shared_array< C > | asBase () const
| get the datapointer of the data
template<typename T>
const boost::shared_array< T > | as () const
template<typename T>
boost::shared_array< T > | as ()
virtual const boost::shared_array< char > | asConstChar () const
| retrieve data as char
virtual boost::shared_array< char > | asChar ()
| retrieve data as char
virtual const boost::shared_array< short > | asConstShort () const
| retrieve data as short
virtual boost::shared_array < short > | asShort ()
| retrieve data as short
virtual const boost::shared_array< int > | asConstInt () const
| retrieve data as int
virtual boost::shared_array< int > | asInt ()
| retrieve data as int
virtual const boost::shared_array< float > | asConstFloat () const
| retrieve data as float
virtual boost::shared_array < float > | asFloat ()
| retrieve data as float (eventually copy)
virtual const boost::shared_array< double > | asConstDouble () const
| retrieve data as double
virtual boost::shared_array < double > | asDouble ()
| retrieve data as double
virtual std::string | asString (std::string separator="") const
| retrieve the whole array as a string (with possible separator)
virtual void | setValue (long pos, double val)
| set a value at the desired position
virtual void | setValues (size_t startPos, const Data &data, size_t first=0, size_t last=-1) throw (CDMException)
virtual void | setAllValues (double val)
virtual boost::shared_ptr< Data > | slice (std::vector< size_t > orgDimSize, std::vector< size_t > startDims, std::vector< size_t > outputDimSize) throw (CDMException)
| get a multi-dimensional slice of the data
virtual boost::shared_ptr< Data > | convertDataType (double oldFill, double oldScale, double oldOffset, CDMDataType newType, double newFill, double newScale, double newOffset) throw (CDMException)
| convert the datatype from one type,fill,scale,offset to another
virtual CDMDataType | getDataType () const
template<class InputIterator>
void | setValues (InputIterator begin, InputIterator end, size_t dataStartPos=0) throw (CDMException)
template<>
void | setValues (size_t startPos, const Data &data, size_t first, size_t last) throw(CDMException)
template<>
void | setValues (size_t startPos, const Data &data, size_t first, size_t last) throw(CDMException)
template<>
void | setValues (size_t startPos, const Data &data, size_t first, size_t last) throw(CDMException)
template<>
void | setValues (size_t startPos, const Data &data, size_t first, size_t last) throw(CDMException)
template<>
void | setValues (size_t startPos, const Data &data, size_t first, size_t last) throw(CDMException)

### template<typename C>
class MetNoFimex::DataImpl< C >

## Constructor & Destructor Documentation

template<typename C>

MetNoFimex::DataImpl< C >::DataImpl | ( | long | length | ) | `[inline, explicit]`

constructor where the array will be automatically allocated

template<typename C>

MetNoFimex::DataImpl< C >::DataImpl | ( | boost::shared_array< C > | array,
|  | long | length |
| ) |  |  | `[inline, explicit]`

template<typename C>

virtual MetNoFimex::DataImpl< C >::~DataImpl | ( |  | ) | `[inline, virtual]`

## Member Function Documentation

template<typename C>

virtual size_t MetNoFimex::DataImpl< C >::size | ( |  | ) | const`[inline, virtual]`

size of the data

Implements MetNoFimex::Data.

template<typename C>

virtual int MetNoFimex::DataImpl< C >::bytes_for_one | ( |  | ) | const`[inline, virtual]`

sizeof the data-impl datatype

Implements MetNoFimex::Data.

template<typename C>

virtual void* MetNoFimex::DataImpl< C >::getDataPtr | ( |  | ) | `[inline, virtual]`

Implements MetNoFimex::Data.

template<typename C>

void MetNoFimex::DataImpl< C >::toStream | ( | std::ostream & | ,
|  | std::string | separator = `""` |
| ) |  |  | const`[inline, virtual]`

printing of the current data to ostream, with optional separator

Implements MetNoFimex::Data.

Referenced by MetNoFimex::DataImpl< C >::asString().

template<typename C>

virtual const boost::shared_array<C> MetNoFimex::DataImpl< C >::asBase | ( |  | ) | const`[inline, virtual]`

get the datapointer of the data

template<typename C>
template<typename T>

const boost::shared_array<T> MetNoFimex::DataImpl< C >::as | ( |  | ) | const`[inline]`

general conversion function, not in base since template methods not allowed

template<typename C>
template<typename T>

boost::shared_array<T> MetNoFimex::DataImpl< C >::as | ( |  | ) | `[inline]`

template<typename C>

virtual const boost::shared_array<char> MetNoFimex::DataImpl< C >::asConstChar | ( |  | ) | const`[inline, virtual]`

retrieve data as char

Implements MetNoFimex::Data.

template<typename C>

virtual boost::shared_array<char> MetNoFimex::DataImpl< C >::asChar | ( |  | ) | `[inline, virtual]`

retrieve data as char

Implements MetNoFimex::Data.

template<typename C>

virtual const boost::shared_array<short> MetNoFimex::DataImpl< C >::asConstShort | ( |  | ) | const`[inline, virtual]`

retrieve data as short

Implements MetNoFimex::Data.

template<typename C>

virtual boost::shared_array<short> MetNoFimex::DataImpl< C >::asShort | ( |  | ) | `[inline, virtual]`

retrieve data as short

Implements MetNoFimex::Data.

template<typename C>

virtual const boost::shared_array<int> MetNoFimex::DataImpl< C >::asConstInt | ( |  | ) | const`[inline, virtual]`

retrieve data as int

Implements MetNoFimex::Data.

template<typename C>

virtual boost::shared_array<int> MetNoFimex::DataImpl< C >::asInt | ( |  | ) | `[inline, virtual]`

retrieve data as int

Implements MetNoFimex::Data.

template<typename C>

virtual const boost::shared_array<float> MetNoFimex::DataImpl< C >::asConstFloat | ( |  | ) | const`[inline, virtual]`

retrieve data as float

Implements MetNoFimex::Data.

template<typename C>

virtual boost::shared_array<float> MetNoFimex::DataImpl< C >::asFloat | ( |  | ) | `[inline, virtual]`

retrieve data as float (eventually copy)

Implements MetNoFimex::Data.

template<typename C>

virtual const boost::shared_array<double> MetNoFimex::DataImpl< C >::asConstDouble | ( |  | ) | const`[inline, virtual]`

retrieve data as double

Implements MetNoFimex::Data.

template<typename C>

virtual boost::shared_array<double> MetNoFimex::DataImpl< C >::asDouble | ( |  | ) | `[inline, virtual]`

retrieve data as double

Implements MetNoFimex::Data.

template<typename C>

std::string MetNoFimex::DataImpl< C >::asString | ( | std::string | separator = `""` | ) | const`[inline, virtual]`

retrieve the whole array as a string (with possible separator)

Implements MetNoFimex::Data.

References std::basic_ostringstream< _CharT, _Traits, _Alloc >::str(), and MetNoFimex::DataImpl< C >::toStream().

template<typename C>

virtual void MetNoFimex::DataImpl< C >::setValue | ( | long | pos,
|  | double | val |
| ) |  |  | `[inline, virtual]`

set a value at the desired position

Implements MetNoFimex::Data.

template<typename C>

virtual void MetNoFimex::DataImpl< C >::setValues | ( | size_t | startPos,
|  | const Data & | data,
|  | size_t | first = `0`,
|  | size_t | end = `-1` |
| ) |  |  | throw (CDMException)`[virtual]`

set the values from another Data implementation

Parameters:

  | startPos | the first position the data should be written to
  | data | the other data-source
  | first | the first data-entry
  | end | the last (excluded) data-entry, defaults to MAX size_t, automatically shrunken to fit size

Implements MetNoFimex::Data.

template<typename C>

virtual void MetNoFimex::DataImpl< C >::setAllValues | ( | double | val | ) | `[inline, virtual]`

set all values to the submitted value

Parameters:

  | val | value to set

Implements MetNoFimex::Data.

template<typename C>

boost::shared_ptr< Data > MetNoFimex::DataImpl< C >::slice | ( | std::vector< size_t > | orgDimSize,
|  | std::vector< size_t > | startDims,
|  | std::vector< size_t > | outputDimSize |
| ) |  |  | throw (CDMException)`[inline, virtual]`

get a multi-dimensional slice of the data

This slices a multidimensional chunk out of the data. All parameters must be vectors of the same size (dimension of array). The first dimension is the fastest moving index (fortran arrays)

Parameters:

  | orgDimSize | the dimensions of this vector. The product of all orgDimSizes must equal to data.size.
  | startDims | The start-position in the original data to fetch data from
  | outputDimSize | the size of the output data

Returns:
  a Data of the size of outputDimSize with the same datatype as the original type

Exceptions:

  | CDMException | on dimension mismatch: (start+size > orgDimSize) or (Product(orgDimSize) != size)

Implements MetNoFimex::Data.

References MetNoFimex::recursiveCopyMultiDimData(), std::vector< _Tp, _Alloc >::size(), and MetNoFimex::type2string().

template<typename C>

boost::shared_ptr< Data > MetNoFimex::DataImpl< C >::convertDataType | ( | double | oldFill,
|  | double | oldScale,
|  | double | oldOffset,
|  | CDMDataType | newType,
|  | double | newFill,
|  | double | newScale,
|  | double | newOffset |
| ) |  |  | throw (CDMException)`[inline, virtual]`

convert the datatype from one type,fill,scale,offset to another

Implements MetNoFimex::Data.

References MetNoFimex::CDM_CHAR, MetNoFimex::CDM_DOUBLE, MetNoFimex::CDM_FLOAT, MetNoFimex::CDM_INT, MetNoFimex::CDM_NAT, MetNoFimex::CDM_SHORT, and MetNoFimex::CDM_STRING.

template<typename C>

virtual CDMDataType MetNoFimex::DataImpl< C >::getDataType | ( |  | ) | const`[inline, virtual]`

return the CDMDataType of this data

Implements MetNoFimex::Data.

References MetNoFimex::CDM_NAT.

template<typename C>
template<class InputIterator>

void MetNoFimex::DataImpl< C >::setValues | ( | InputIterator | begin,
|  | InputIterator | end,
|  | size_t | dataStartPos = `0` |
| ) |  |  | throw (CDMException)`[inline]`

set the values of the data by the input-iterator

References std::distance(), std::transform(), and MetNoFimex::type2string().

template<>

void MetNoFimex::DataImpl< char >::setValues | ( | size_t | startPos,
|  | const Data & | data,
|  | size_t | first,
|  | size_t | end |
| ) |  |  | throw(CDMException)`[inline, virtual]`

set the values from another Data implementation

Parameters:

  | startPos | the first position the data should be written to
  | data | the other data-source
  | first | the first data-entry
  | end | the last (excluded) data-entry, defaults to MAX size_t, automatically shrunken to fit size

Implements MetNoFimex::Data.

template<>

void MetNoFimex::DataImpl< short >::setValues | ( | size_t | startPos,
|  | const Data & | data,
|  | size_t | first,
|  | size_t | end |
| ) |  |  | throw(CDMException)`[inline, virtual]`

set the values from another Data implementation

Parameters:

  | startPos | the first position the data should be written to
  | data | the other data-source
  | first | the first data-entry
  | end | the last (excluded) data-entry, defaults to MAX size_t, automatically shrunken to fit size

Implements MetNoFimex::Data.

template<>

void MetNoFimex::DataImpl< int >::setValues | ( | size_t | startPos,
|  | const Data & | data,
|  | size_t | first,
|  | size_t | end |
| ) |  |  | throw(CDMException)`[inline, virtual]`

set the values from another Data implementation

Parameters:

  | startPos | the first position the data should be written to
  | data | the other data-source
  | first | the first data-entry
  | end | the last (excluded) data-entry, defaults to MAX size_t, automatically shrunken to fit size

Implements MetNoFimex::Data.

template<>

void MetNoFimex::DataImpl< float >::setValues | ( | size_t | startPos,
|  | const Data & | data,
|  | size_t | first,
|  | size_t | end |
| ) |  |  | throw(CDMException)`[inline, virtual]`

set the values from another Data implementation

Parameters:

  | startPos | the first position the data should be written to
  | data | the other data-source
  | first | the first data-entry
  | end | the last (excluded) data-entry, defaults to MAX size_t, automatically shrunken to fit size

Implements MetNoFimex::Data.

template<>

void MetNoFimex::DataImpl< double >::setValues | ( | size_t | startPos,
|  | const Data & | data,
|  | size_t | first,
|  | size_t | end |
| ) |  |  | throw(CDMException)`[inline, virtual]`

set the values from another Data implementation

Parameters:

  | startPos | the first position the data should be written to
  | data | the other data-source
  | first | the first data-entry
  | end | the last (excluded) data-entry, defaults to MAX size_t, automatically shrunken to fit size

Implements MetNoFimex::Data.

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

- include/fimex/DataImpl.h