OmniSciDB  eee9fa949c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TargetValueConvertersImpl.h File Reference
#include "../StringDictionary/StringDictionary.h"
#include "TargetValueConverters.h"
#include <atomic>
#include <future>
#include <thread>
+ Include dependency graph for TargetValueConvertersImpl.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  NumericValueConverter< SOURCE_TYPE, TARGET_TYPE >
 
struct  DictionaryValueConverter< TARGET_TYPE >
 
struct  StringValueConverter
 
struct  ArrayValueConverter< ELEMENT_CONVERTER >
 
struct  GeoPointValueConverter
 
struct  GeoLinestringValueConverter
 
struct  GeoPolygonValueConverter
 
struct  GeoMultiPolygonValueConverter
 

Namespaces

 Importer_NS
 

Functions

std::vector< uint8_t > Importer_NS::compress_coords (std::vector< double > &coords, const SQLTypeInfo &ti)
 
template<typename T >
get_fixed_array_null_value ()
 
std::vector< double > compute_bounds_of_coords (const std::shared_ptr< std::vector< double >> &coords)
 
template<typename ELEM_TYPE >
ArrayDatum to_array_datum (const std::vector< ELEM_TYPE > &vector)
 
template<typename ELEM_TYPE >
ArrayDatum to_array_datum (const std::shared_ptr< std::vector< ELEM_TYPE >> &vector)
 

Function Documentation

std::vector<double> compute_bounds_of_coords ( const std::shared_ptr< std::vector< double >> &  coords)
inline

Definition at line 653 of file TargetValueConvertersImpl.h.

References anonymous_namespace{geo_types.cpp}::DOUBLE_MAX, and anonymous_namespace{geo_types.cpp}::DOUBLE_MIN.

Referenced by GeoLinestringValueConverter::convertToColumnarFormat(), GeoPolygonValueConverter::convertToColumnarFormat(), and GeoMultiPolygonValueConverter::convertToColumnarFormat().

654  {
655  std::vector<double> bounds(4);
656  constexpr auto DOUBLE_MAX = std::numeric_limits<double>::max();
657  constexpr auto DOUBLE_MIN = std::numeric_limits<double>::lowest();
658  bounds[0] = DOUBLE_MAX;
659  bounds[1] = DOUBLE_MAX;
660  bounds[2] = DOUBLE_MIN;
661  bounds[3] = DOUBLE_MIN;
662  auto size_coords = coords->size();
663 
664  for (size_t i = 0; i < size_coords; i += 2) {
665  double x = (*coords)[i];
666  double y = (*coords)[i + 1];
667 
668  bounds[0] = std::min(bounds[0], x);
669  bounds[1] = std::min(bounds[1], y);
670  bounds[2] = std::max(bounds[2], x);
671  bounds[3] = std::max(bounds[3], y);
672  }
673  return bounds;
674 }

+ Here is the caller graph for this function:

template<typename T >
T get_fixed_array_null_value ( )

Definition at line 32 of file TargetValueConvertersImpl.h.

32  {
33  if (std::is_floating_point<T>::value) {
34  return static_cast<T>(inline_fp_null_array_value<T>());
35  } else {
36  return static_cast<T>(inline_int_null_array_value<T>());
37  }
38 }
template<typename ELEM_TYPE >
ArrayDatum to_array_datum ( const std::vector< ELEM_TYPE > &  vector)
inline

Definition at line 677 of file TargetValueConvertersImpl.h.

References checked_malloc().

Referenced by GeoLinestringValueConverter::convertToColumnarFormat(), GeoPolygonValueConverter::convertToColumnarFormat(), GeoMultiPolygonValueConverter::convertToColumnarFormat(), and to_array_datum().

677  {
678  ELEM_TYPE* array =
679  reinterpret_cast<ELEM_TYPE*>(checked_malloc(sizeof(ELEM_TYPE) * vector.size()));
680  memcpy(array, vector.data(), vector.size() * sizeof(ELEM_TYPE));
681 
682  return ArrayDatum(
683  (int)(vector.size() * sizeof(ELEM_TYPE)), reinterpret_cast<int8_t*>(array), false);
684 }
void * checked_malloc(const size_t size)
Definition: checked_alloc.h:40
std::conditional_t< isCudaCC(), DeviceArrayDatum, HostArrayDatum > ArrayDatum
Definition: sqltypes.h:122

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename ELEM_TYPE >
ArrayDatum to_array_datum ( const std::shared_ptr< std::vector< ELEM_TYPE >> &  vector)
inline

Definition at line 687 of file TargetValueConvertersImpl.h.

References to_array_datum().

687  {
688  return to_array_datum(*vector.get());
689 }
ArrayDatum to_array_datum(const std::vector< ELEM_TYPE > &vector)

+ Here is the call graph for this function: