34 #ifndef CARTOBASE_TYPE_CONVERTER_H 
   35 #define CARTOBASE_TYPE_CONVERTER_H 
   78   template<
typename INP, 
typename OUTP>
 
   82     void convert( 
const INP &in, OUTP & out ) 
const;
 
   86   template <
typename OUTP>
 
   97   template <
typename INP>
 
  116   template<
typename INP, 
typename OUTP>
 
  130     double getscale() 
const;
 
  141   template<
typename INP, 
typename OUTP>
 
  147     void convert( 
const INP &in, OUTP & out ) 
const;
 
  157   template<
typename INP, 
typename OUTP, 
bool MODE>
 
  163   template<
typename INP, 
typename OUTP>
 
  167     static OUTP* 
alloc( 
const INP &in );
 
  172   template<
typename INP, 
typename OUTP>
 
  191   template<
typename INP, 
typename OUTP>
 
  204   template<
typename INP, 
typename OUTP>
 
  207                              std::numeric_limits<INP>::is_specialized
 
  208   && std::numeric_limits<OUTP>::is_bounded >
 
  213                         std::numeric_limits<INP>::is_specialized
 
  214                         && std::numeric_limits<OUTP>::is_bounded >( info ) {}
 
  219   template <
class INP,
class OUTP>
 
  243     virtual void convert( 
const INP &in, OUTP & out ) 
const;
 
  256   template <
typename INP, 
typename OUTP>
 
  263       : 
Converter<INP, OUTP>( rescale, info ) {}
 
  267   template<
typename INP, 
typename OUTP>
 
  273   template<
typename INP, 
typename OUTP>
 
  276       _defaulted_info(info)
 
  280   template<
typename INP, 
typename OUTP>
 
  286     out = _defaulted_info.getScaledValue(in);
 
  290 #define CARTO_SPECIALIZED_RAWCONVERTER_ROUNDED_CONVERT( INP , OUTP ) \ 
  293 void RawConverter< INP , OUTP >::convert( const INP &in, OUTP & out ) const \ 
  295    out = static_cast<OUTP>( rint( in ) ); \ 
  312 #undef CARTO_SPECIALIZED_RAWCONVERTER_ROUNDED_CONVERT 
  315   template<
typename INP, 
typename OUTP>
 
  319     out = 
static_cast<OUTP
>( in );
 
  322   template<
class INP, 
class OUTP>
 
  329   template<
class INP, 
class OUTP>
 
  337   template<
class INP, 
class OUTP>
 
  344         sc.convert( in, out );
 
  353 #if __cplusplus >= 201103L 
  365     template <typename T, bool is_min=std::numeric_limits<T>::is_integer>
 
  375     template <
typename T>
 
  397     return ( value == carto::min_limit<T>() );
 
  405   template<
typename TYPE, 
typename TEST>
 
  408     return ( 
static_cast<TYPE
>(carto::min_limit<TEST>()) <= value )
 
  412   template<
typename TYPE>
 
  414     return ( carto::isvalidvalue<double, TYPE>( min ) ?
 
  415              static_cast<TYPE
>( min ) :
 
  416              carto::min_limit<TYPE>() );
 
  419   template<
typename TYPE>
 
  421     return ( carto::isvalidvalue<double, TYPE>( max ) ?
 
  422              static_cast<TYPE
>( max ) :
 
  430   template<
typename INP, 
typename OUTP>
 
  437     scaledvalue = ( value - this->_defaultedvmin ) * _scale
 
  438       + this->_defaultedomin;
 
  440     if ( scaledvalue < 
static_cast<double>(carto::min_limit<OUTP>())) {
 
  441       result = carto::min_limit<OUTP>();
 
  445       doubleconverter.
convert( scaledvalue, result );
 
Void does not contain anything.
This allocator is used by the top-level Converter to allocate a new object depending on the input: it...
static OUTP * alloc(const INP &in)
ConverterSwitch(const RescalerInfo &)
ConverterSwitch(const RescalerInfo &info)
This converter is a bit higher-level than RawConverter and Rescaler, it switches to the one or the ot...
High-level converter, reimplementation of aims::Converter.
virtual void convert(const INP &in, OUTP &out) const
Converts INP into an existing OUTP object.
Converter(bool rescale, const RescalerInfo &info)
Converter(bool rescale=false)
OUTP * operator()(const INP &in) const
Converts an INP type data to an OUTP data.
OUTP getScaledValue(INP value) const
void convert(const INP &, Void &) const
void convert(const Void &, OUTP &out) const
void convert(const Void &, Void &) const
Low-level raw converter (not rescaling)
void convert(const INP &in, OUTP &out) const
Low level rescaler info used for rescaling.
bool usevtypelimits
Use limits of the input type instead of effective input min-max.
RescalerInfo()
Construct object requesting default rescaling.
bool explicitRescale() const
Test if any explicit rescaling parameters has been specified.
Low-level rescaling converter.
void convert(const INP &in, OUTP &out) const
ShallowConverter only differs from the "standard" Converter in the way that it may make shallow copie...
ShallowConverter(bool rescale, RescalerInfo &info)
ShallowConverter(bool rescale=false)
SmartConverter(const RescalerInfo &info)
#define CARTO_SPECIALIZED_RAWCONVERTER_ROUNDED_CONVERT(INP, OUTP)
bool ismin_limit(T value)
TYPE getcheckedmax(double max)
TYPE getcheckedmin(double min)
bool ismax_limit(T value)
bool isvalidvalue(TYPE value)