OmniSciDB  04ee39c94c
anonymous_namespace{ResultSetGeoSerialization.h} Namespace Reference

Functions

template<typename T >
void unpack_geo_vector (std::vector< T > &output, const int8_t *input_ptr, const size_t sz)
 
template<typename T >
void decompress_geo_coords_geoint32 (std::vector< T > &dec, const int8_t *enc, const size_t sz)
 
template<typename T >
std::shared_ptr< std::vector< T > > decompress_coords (const SQLTypeInfo &geo_ti, const int8_t *coords, const size_t coords_sz)
 
template<>
std::shared_ptr< std::vector< double > > decompress_coords< double > (const SQLTypeInfo &geo_ti, const int8_t *coords, const size_t coords_sz)
 

Function Documentation

◆ decompress_coords()

template<typename T >
std::shared_ptr<std::vector<T> > anonymous_namespace{ResultSetGeoSerialization.h}::decompress_coords ( const SQLTypeInfo geo_ti,
const int8_t *  coords,
const size_t  coords_sz 
)

Referenced by decompress_geo_coords_geoint32().

+ Here is the caller graph for this function:

◆ decompress_coords< double >()

template<>
std::shared_ptr<std::vector<double> > anonymous_namespace{ResultSetGeoSerialization.h}::decompress_coords< double > ( const SQLTypeInfo geo_ti,
const int8_t *  coords,
const size_t  coords_sz 
)

Definition at line 108 of file ResultSetGeoSerialization.h.

References CHECK_EQ, decompress_geo_coords_geoint32(), kENCODING_GEOINT, kENCODING_NONE, and unpack_geo_vector().

Referenced by GeoTargetValueSerializer< kPOINT >::serialize(), GeoWktSerializer< kPOINT >::serialize(), GeoTargetValueSerializer< kLINESTRING >::serialize(), GeoWktSerializer< kLINESTRING >::serialize(), GeoTargetValueSerializer< kPOLYGON >::serialize(), GeoWktSerializer< kPOLYGON >::serialize(), GeoTargetValueSerializer< kMULTIPOLYGON >::serialize(), and GeoWktSerializer< kMULTIPOLYGON >::serialize().

110  {
111  auto decompressed_coords_ptr = std::make_shared<std::vector<double>>();
112  if (geo_ti.get_compression() == kENCODING_GEOINT) {
113  if (geo_ti.get_comp_param() == 32) {
114  decompress_geo_coords_geoint32(*decompressed_coords_ptr, coords, coords_sz);
115  }
116  } else {
118  unpack_geo_vector(*decompressed_coords_ptr, coords, coords_sz);
119  }
120  return decompressed_coords_ptr;
121 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
void unpack_geo_vector(std::vector< T > &output, const int8_t *input_ptr, const size_t sz)
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:331
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:332
void decompress_geo_coords_geoint32(std::vector< T > &dec, const int8_t *enc, const size_t sz)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ decompress_geo_coords_geoint32()

template<typename T >
void anonymous_namespace{ResultSetGeoSerialization.h}::decompress_geo_coords_geoint32 ( std::vector< T > &  dec,
const int8_t *  enc,
const size_t  sz 
)

Definition at line 89 of file ResultSetGeoSerialization.h.

References decompress_coords(), Geo_namespace::decompress_lattitude_coord_geoint32(), and Geo_namespace::decompress_longitude_coord_geoint32().

Referenced by decompress_coords< double >().

91  {
92  const auto compressed_coords = reinterpret_cast<const int32_t*>(enc);
93  const auto num_coords = sz / sizeof(int32_t);
94  dec.resize(num_coords);
95  for (size_t i = 0; i < num_coords; i += 2) {
96  dec[i] = Geo_namespace::decompress_longitude_coord_geoint32(compressed_coords[i]);
97  dec[i + 1] =
99  }
100 }
int64_t const int32_t sz
DEVICE double decompress_lattitude_coord_geoint32(const int32_t compressed)
DEVICE double decompress_longitude_coord_geoint32(const int32_t compressed)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unpack_geo_vector()

template<typename T >
void anonymous_namespace{ResultSetGeoSerialization.h}::unpack_geo_vector ( std::vector< T > &  output,
const int8_t *  input_ptr,
const size_t  sz 
)

Definition at line 77 of file ResultSetGeoSerialization.h.

References CHECK, and CHECK_EQ.

Referenced by decompress_coords< double >(), GeoTargetValueSerializer< kPOLYGON >::serialize(), GeoWktSerializer< kPOLYGON >::serialize(), GeoTargetValueSerializer< kMULTIPOLYGON >::serialize(), and GeoWktSerializer< kMULTIPOLYGON >::serialize().

77  {
78  auto elems = reinterpret_cast<const T*>(input_ptr);
79  CHECK(elems);
80  CHECK_EQ(size_t(0), sz % sizeof(T));
81  const size_t num_elems = sz / sizeof(T);
82  output.resize(num_elems);
83  for (size_t i = 0; i < num_elems; i++) {
84  output[i] = elems[i];
85  }
86 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
int64_t const int32_t sz
#define CHECK(condition)
Definition: Logger.h:187
+ Here is the caller graph for this function: