OmniSciDB  b24e664e58
 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)
 
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 601 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().

602  {
603  std::vector<double> bounds(4);
604  constexpr auto DOUBLE_MAX = std::numeric_limits<double>::max();
605  constexpr auto DOUBLE_MIN = std::numeric_limits<double>::lowest();
606  bounds[0] = DOUBLE_MAX;
607  bounds[1] = DOUBLE_MAX;
608  bounds[2] = DOUBLE_MIN;
609  bounds[3] = DOUBLE_MIN;
610  auto size_coords = coords->size();
611 
612  for (size_t i = 0; i < size_coords; i += 2) {
613  double x = (*coords)[i];
614  double y = (*coords)[i + 1];
615 
616  bounds[0] = std::min(bounds[0], x);
617  bounds[1] = std::min(bounds[1], y);
618  bounds[2] = std::max(bounds[2], x);
619  bounds[3] = std::max(bounds[3], y);
620  }
621  return bounds;
622 }

+ Here is the caller graph for this function:

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

Definition at line 625 of file TargetValueConvertersImpl.h.

References checked_malloc().

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

625  {
626  ELEM_TYPE* array =
627  reinterpret_cast<ELEM_TYPE*>(checked_malloc(sizeof(ELEM_TYPE) * vector.size()));
628  memcpy(array, vector.data(), vector.size() * sizeof(ELEM_TYPE));
629 
630  return ArrayDatum(
631  (int)(vector.size() * sizeof(ELEM_TYPE)), reinterpret_cast<int8_t*>(array), false);
632 }
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 635 of file TargetValueConvertersImpl.h.

References to_array_datum().

635  {
636  return to_array_datum(*vector.get());
637 }
ArrayDatum to_array_datum(const std::vector< ELEM_TYPE > &vector)

+ Here is the call graph for this function: