OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NumericConverterFactory< SOURCE_TYPE, TARGET_TYPE > Struct Template Reference

Public Types

using ConverterType = NumericValueConverter< SOURCE_TYPE, TARGET_TYPE >
 

Public Member Functions

std::unique_ptr< ConverterTypecreate (ConverterCreateParameter param)
 
std::unique_ptr
< TargetValueConverter
operator() (ConverterCreateParameter param)
 
template<>
std::unique_ptr
< NumericValueConverter
< double, double > > 
create (ConverterCreateParameter param)
 
template<>
std::unique_ptr
< NumericValueConverter< float,
float > > 
create (ConverterCreateParameter param)
 

Detailed Description

template<typename SOURCE_TYPE, typename TARGET_TYPE>
struct NumericConverterFactory< SOURCE_TYPE, TARGET_TYPE >

Definition at line 21 of file TargetValueConvertersFactories.cpp.

Member Typedef Documentation

template<typename SOURCE_TYPE , typename TARGET_TYPE >
using NumericConverterFactory< SOURCE_TYPE, TARGET_TYPE >::ConverterType = NumericValueConverter<SOURCE_TYPE, TARGET_TYPE>

Definition at line 22 of file TargetValueConvertersFactories.cpp.

Member Function Documentation

template<typename SOURCE_TYPE , typename TARGET_TYPE >
std::unique_ptr<ConverterType> NumericConverterFactory< SOURCE_TYPE, TARGET_TYPE >::create ( ConverterCreateParameter  param)
inline

Definition at line 24 of file TargetValueConvertersFactories.cpp.

References ConverterCreateParameter::can_be_null, CHECK(), SQLTypeInfoCore< TYPE_FACET_PACK >::get_size(), ConverterCreateParameter::num_rows, ConverterCreateParameter::target, and ConverterCreateParameter::type.

Referenced by NumericConverterFactory< SOURCE_TYPE, TARGET_TYPE >::operator()().

24  {
25  SOURCE_TYPE source_null_value =
26  static_cast<SOURCE_TYPE>(inline_int_null_value<SOURCE_TYPE>());
27 
28  switch (param.type.get_size()) {
29  case 8:
30  source_null_value = static_cast<SOURCE_TYPE>(inline_int_null_value<int64_t>());
31  break;
32  case 4:
33  source_null_value = static_cast<SOURCE_TYPE>(inline_int_null_value<int32_t>());
34  break;
35  case 2:
36  source_null_value = static_cast<SOURCE_TYPE>(inline_int_null_value<int16_t>());
37  break;
38  case 1:
39  source_null_value = static_cast<SOURCE_TYPE>(inline_int_null_value<int8_t>());
40  break;
41  default:
42  CHECK(false);
43  }
44 
45  TARGET_TYPE target_null_value =
46  static_cast<TARGET_TYPE>(inline_int_null_value<TARGET_TYPE>());
47 
48  return std::make_unique<NumericValueConverter<SOURCE_TYPE, TARGET_TYPE>>(
49  param.target,
50  param.num_rows,
51  source_null_value,
52  target_null_value,
53  param.can_be_null);
54  }
HOST DEVICE int get_size() const
Definition: sqltypes.h:336
CHECK(cgen_state)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<>
std::unique_ptr< NumericValueConverter< double, double > > NumericConverterFactory< double, double >::create ( ConverterCreateParameter  param)

Definition at line 63 of file TargetValueConvertersFactories.cpp.

References ConverterCreateParameter::can_be_null, inline_fp_null_value< double >(), ConverterCreateParameter::num_rows, and ConverterCreateParameter::target.

63  {
64  double null_value = inline_fp_null_value<double>();
65  return std::make_unique<NumericValueConverter<double, double>>(
66  param.target, param.num_rows, null_value, null_value, param.can_be_null);
67 }
constexpr double inline_fp_null_value< double >()

+ Here is the call graph for this function:

template<>
std::unique_ptr< NumericValueConverter< float, float > > NumericConverterFactory< float, float >::create ( ConverterCreateParameter  param)

Definition at line 71 of file TargetValueConvertersFactories.cpp.

References ConverterCreateParameter::can_be_null, inline_fp_null_value< float >(), ConverterCreateParameter::num_rows, and ConverterCreateParameter::target.

71  {
72  float null_value = inline_fp_null_value<float>();
73  return std::make_unique<NumericValueConverter<float, float>>(
74  param.target, param.num_rows, null_value, null_value, param.can_be_null);
75 }
constexpr float inline_fp_null_value< float >()

+ Here is the call graph for this function:

template<typename SOURCE_TYPE , typename TARGET_TYPE >
std::unique_ptr<TargetValueConverter> NumericConverterFactory< SOURCE_TYPE, TARGET_TYPE >::operator() ( ConverterCreateParameter  param)
inline

Definition at line 56 of file TargetValueConvertersFactories.cpp.

References NumericConverterFactory< SOURCE_TYPE, TARGET_TYPE >::create().

56  {
57  return create(param);
58  }
std::unique_ptr< ConverterType > create(ConverterCreateParameter param)

+ Here is the call graph for this function:


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