OmniSciDB  04ee39c94c
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)
 
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

◆ compute_bounds_of_coords()

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

Definition at line 572 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().

573  {
574  std::vector<double> bounds(4);
575  constexpr auto DOUBLE_MAX = std::numeric_limits<double>::max();
576  constexpr auto DOUBLE_MIN = std::numeric_limits<double>::lowest();
577  bounds[0] = DOUBLE_MAX;
578  bounds[1] = DOUBLE_MAX;
579  bounds[2] = DOUBLE_MIN;
580  bounds[3] = DOUBLE_MIN;
581  auto size_coords = coords->size();
582 
583  for (size_t i = 0; i < size_coords; i += 2) {
584  double x = (*coords)[i];
585  double y = (*coords)[i + 1];
586 
587  bounds[0] = std::min(bounds[0], x);
588  bounds[1] = std::min(bounds[1], y);
589  bounds[2] = std::max(bounds[2], x);
590  bounds[3] = std::max(bounds[3], y);
591  }
592  return bounds;
593 }
+ Here is the caller graph for this function:

◆ to_array_datum() [1/2]

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

Definition at line 596 of file TargetValueConvertersImpl.h.

References checked_malloc().

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

596  {
597  ELEM_TYPE* array =
598  reinterpret_cast<ELEM_TYPE*>(checked_malloc(sizeof(ELEM_TYPE) * vector.size()));
599  memcpy(array, vector.data(), vector.size() * sizeof(ELEM_TYPE));
600 
601  return ArrayDatum(
602  (int)(vector.size() * sizeof(ELEM_TYPE)), reinterpret_cast<int8_t*>(array), false);
603 }
void * checked_malloc(const size_t size)
Definition: checked_alloc.h:40
std::conditional_t< isCudaCC(), DeviceArrayDatum, HostArrayDatum > ArrayDatum
Definition: sqltypes.h:119
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ to_array_datum() [2/2]

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

Definition at line 606 of file TargetValueConvertersImpl.h.

References to_array_datum().

606  {
607  return to_array_datum(*vector.get());
608 }
ArrayDatum to_array_datum(const std::vector< ELEM_TYPE > &vector)
+ Here is the call graph for this function: