cartobase  5.0.5
carto::Converter< INP, OUTP > Class Template Reference

High-level converter, reimplementation of aims::Converter. More...

#include <cartobase/type/converter.h>

Inheritance diagram for carto::Converter< INP, OUTP >:
Collaboration diagram for carto::Converter< INP, OUTP >:

Public Member Functions

 Converter (bool rescale=false)
 
 Converter (bool rescale, const RescalerInfo &info)
 
virtual ~Converter ()
 
OUTP * operator() (const INP &in) const
 Converts an INP type data to an OUTP data. More...
 
virtual void convert (const INP &in, OUTP &out) const
 Converts INP into an existing OUTP object. More...
 

Protected Attributes

bool _rescale
 
RescalerInfo _info
 

Detailed Description

template<class INP, class OUTP>
class carto::Converter< INP, OUTP >

High-level converter, reimplementation of aims::Converter.

Definition at line 220 of file converter.h.

Constructor & Destructor Documentation

◆ Converter() [1/2]

template<class INP , class OUTP >
carto::Converter< INP, OUTP >::Converter ( bool  rescale = false)
inline

Definition at line 223 of file converter.h.

◆ Converter() [2/2]

template<class INP , class OUTP >
carto::Converter< INP, OUTP >::Converter ( bool  rescale,
const RescalerInfo info 
)
inline

Definition at line 224 of file converter.h.

◆ ~Converter()

template<class INP , class OUTP >
virtual carto::Converter< INP, OUTP >::~Converter ( )
inlinevirtual

Definition at line 226 of file converter.h.

Member Function Documentation

◆ convert()

template<class INP , class OUTP >
void carto::Converter< INP, OUTP >::convert ( const INP &  in,
OUTP &  out 
) const
inlinevirtual

Converts INP into an existing OUTP object.

The output object must be already allocated with correct size: its contents will be replaced, but no reallocation or resizing will take place. To actually trigger allocation, use the operator () instead.

Definition at line 339 of file converter.h.

References carto::RawConverter< INP, OUTP >::convert(), and carto::min_limit().

◆ operator()()

template<class INP , class OUTP >
OUTP * carto::Converter< INP, OUTP >::operator() ( const INP &  in) const
inline

Converts an INP type data to an OUTP data.

If rescale mode is on, the conversion uses the parameters provided as a RescalerInfo object. If no such object is provided, it tries to use the whole dynamics of the OUTP type (int types).

In any case, all quantification info will be lost, unless put as a scale factor in the header (used for AimsData).

Definition at line 330 of file converter.h.

References carto::ConverterAllocator< INP, OUTP >::alloc(), and carto::Rescaler< INP, OUTP >::convert().

Member Data Documentation

◆ _info

template<class INP , class OUTP >
RescalerInfo carto::Converter< INP, OUTP >::_info
protected

Definition at line 247 of file converter.h.

◆ _rescale

template<class INP , class OUTP >
bool carto::Converter< INP, OUTP >::_rescale
protected

Definition at line 246 of file converter.h.


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