OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Column< GeoPoint > Struct Template Reference

#include <heavydbTypes.h>

Public Member Functions

DEVICE Geo::Point2D getItem (const int64_t index, const int32_t output_srid=0) const
 
DEVICE Geo::Point2D operator[] (const unsigned int index) const
 
DEVICE int64_t size () const
 
DEVICE bool isNull (int64_t index) const
 
DEVICE void setNull (int64_t index)
 
DEVICE void setItem (int64_t index, const Geo::Point2D &other)
 
std::string toString () const
 

Public Attributes

int8_t * flatbuffer_
 
int64_t num_rows_
 

Detailed Description

template<>
struct Column< GeoPoint >

Definition at line 2232 of file heavydbTypes.h.

Member Function Documentation

DEVICE Geo::Point2D Column< GeoPoint >::getItem ( const int64_t  index,
const int32_t  output_srid = 0 
) const
inline

Definition at line 2237 of file heavydbTypes.h.

References Geo::get_input_srid(), Geo::get_is_geoint(), Geo::get_output_srid(), Geo::get_point(), is_null(), and toString().

Referenced by ColumnGeoPoint_getItem().

2237  {
2238  /*
2239  output_srid != 0 enables transformation from input_srid to the
2240  specified output_srid. If output_srid < 0, the column's
2241  output_srid will be used, otherwise, the user specified
2242  output_srid is used.
2243  */
2245  int8_t* ptr;
2246  int64_t size;
2247  bool is_null;
2248  auto status = m.getItemOld(index, size, ptr, is_null);
2249  if (status != FlatBufferManager::Status::Success) {
2250 #ifndef __CUDACC__
2251  throw std::runtime_error("getItem failed: " + ::toString(status));
2252 #endif
2253  }
2254  bool is_geoint = Geo::get_is_geoint(flatbuffer_);
2255  int32_t this_input_srid = Geo::get_input_srid(flatbuffer_);
2256  int32_t this_output_srid = Geo::get_output_srid(flatbuffer_);
2257  return Geo::get_point(ptr,
2258  0,
2259  this_input_srid,
2260  (output_srid < 0 ? this_output_srid : output_srid),
2261  is_geoint);
2262  }
std::string toString() const
int32_t get_output_srid(const int8_t *flatbuffer)
int32_t get_input_srid(const int8_t *flatbuffer)
DEVICE int64_t size() const
DEVICE Point2D get_point(const int8_t *data, const int64_t index, const int32_t input_srid, const int32_t output_srid, const bool is_geoint)
CONSTEXPR DEVICE bool is_null(const T &value)
bool get_is_geoint(const int8_t *flatbuffer)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DEVICE bool Column< GeoPoint >::isNull ( int64_t  index) const
inline

Definition at line 2274 of file heavydbTypes.h.

References is_null(), and toString().

Referenced by ColumnGeoPoint_isNull(), ct_coords__cpu_(), and ct_shift__cpu_().

2274  {
2276  bool is_null = false;
2277  auto status = m.isNull(index, is_null);
2278 #ifndef __CUDACC__
2279  if (status != FlatBufferManager::Status::Success) {
2280  throw std::runtime_error("isNull failed: " + ::toString(status));
2281  }
2282 #endif
2283  return is_null;
2284  }
std::string toString() const
CONSTEXPR DEVICE bool is_null(const T &value)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DEVICE Geo::Point2D Column< GeoPoint >::operator[] ( const unsigned int  index) const
inline

Definition at line 2264 of file heavydbTypes.h.

2264  {
2265  /* Use getItem(index, output_srid) to enable user-specified
2266  transformation. */
2267  return getItem(static_cast<int64_t>(index), /*output_srid=*/0);
2268  }
DEVICE Geo::Point2D getItem(const int64_t index, const int32_t output_srid=0) const
DEVICE void Column< GeoPoint >::setItem ( int64_t  index,
const Geo::Point2D other 
)
inline

Definition at line 2296 of file heavydbTypes.h.

References Geospatial::compress_latitude_coord_geoint32(), Geospatial::compress_longitude_coord_geoint32(), run_benchmark_import::dest, toString(), Geo::Point2D::x, and Geo::Point2D::y.

Referenced by ColumnGeoPoint_setItem(), and ct_shift__cpu_().

2296  {
2298  const auto* metadata = m.getGeoPointMetadata();
2299  int8_t* dest = nullptr;
2300  int64_t sz = 2 * (metadata->is_geoint ? sizeof(int32_t) : sizeof(double));
2301  FlatBufferManager::Status status = m.setItemOld(index, nullptr, sz, &dest);
2302  if (status != FlatBufferManager::Status::Success) {
2303 #ifndef __CUDACC__
2304  throw std::runtime_error("setItem failed: " + ::toString(status));
2305 #endif
2306  }
2307  if (dest == nullptr) {
2308 #ifndef __CUDACC__
2309  throw std::runtime_error("setItem failed: dest is not set?!");
2310 #endif
2311  }
2312  if (metadata->is_geoint) {
2313  // TODO: check other.x/y ranges
2314  int32_t* ptr = reinterpret_cast<int32_t*>(dest);
2317  } else {
2318  double* ptr = reinterpret_cast<double*>(dest);
2319  ptr[0] = other.x;
2320  ptr[1] = other.y;
2321  }
2322  }
std::string toString() const
DEVICE uint64_t compress_longitude_coord_geoint32(const double coord)
DEVICE uint64_t compress_latitude_coord_geoint32(const double coord)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DEVICE void Column< GeoPoint >::setNull ( int64_t  index)
inline

Definition at line 2286 of file heavydbTypes.h.

References FlatBufferManager::setNull(), and toString().

Referenced by ColumnGeoPoint_setNull(), and ct_shift__cpu_().

2286  {
2288  auto status = m.setNull(index);
2289 #ifndef __CUDACC__
2290  if (status != FlatBufferManager::Status::Success) {
2291  throw std::runtime_error("setNull failed: " + ::toString(status));
2292  }
2293 #endif
2294  }
std::string toString() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DEVICE int64_t Column< GeoPoint >::size ( ) const
inline

Definition at line 2270 of file heavydbTypes.h.

Referenced by ct_coords__cpu_(), and ct_shift__cpu_().

2270  {
2271  return num_rows_;
2272  }

+ Here is the caller graph for this function:

std::string Column< GeoPoint >::toString ( ) const
inline

Definition at line 2325 of file heavydbTypes.h.

References to_string(), and typeName().

2325  {
2327  return ::typeName(this) + "(" + m.toString() +
2328  ", num_rows=" + std::to_string(num_rows_) + ")";
2329  }
std::string to_string(char const *&&v)
std::string typeName(const T *v)
Definition: toString.h:106

+ Here is the call graph for this function:

Member Data Documentation

int8_t* Column< GeoPoint >::flatbuffer_

Definition at line 2233 of file heavydbTypes.h.

int64_t Column< GeoPoint >::num_rows_

Definition at line 2235 of file heavydbTypes.h.


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