OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Geo::GeoNestedArray< ItemType > Struct Template Reference

#include <heavydbTypes.h>

+ Inheritance diagram for Geo::GeoNestedArray< ItemType >:
+ Collaboration diagram for Geo::GeoNestedArray< ItemType >:

Public Member Functions

DEVICE Point2D getPoint (const int64_t index) const
 
template<typename CT , typename VT >
FlatBufferManager::Status toCoordsWorker (std::vector< VT > &result) const
 
template<typename CT >
FlatBufferManager::Status toCoords (std::vector< CT > &result) const
 
template<typename CT >
FlatBufferManager::Status toCoords (std::vector< std::vector< CT >> &result) const
 
template<typename CT >
FlatBufferManager::Status toCoords (std::vector< std::vector< std::vector< CT >>> &result) const
 
template<typename CT , typename VT >
FlatBufferManager::Status fromCoordsWorker (const VT &coords)
 
template<typename CT >
FlatBufferManager::Status fromCoords (const std::vector< CT > &coords)
 
template<typename CT >
FlatBufferManager::Status fromCoords (const std::vector< std::vector< CT >> &coords)
 
template<typename CT >
FlatBufferManager::Status fromCoords (const std::vector< std::vector< std::vector< CT >>> &coords)
 
- Public Member Functions inherited from flatbuffer::NestedArray< ItemType >
size_t size () const
 
size_t size (const int64_t index) const
 
void getValuesBuffer (ItemType *&values, int64_t &nof_values, bool &is_null, bool require_1d_item=true) const
 
void getRawBuffer (int8_t *&values, int64_t &nof_values, size_t &value_size, bool &is_null, bool require_1d_item=true) const
 
ItemType & getValue (const int64_t index) const
 
const ItemType operator[] (const int64_t index) const
 
const ItemType getItem (const int64_t index) const
 
bool isNull () const
 
bool isNull (int64_t index) const
 
DEVICE void extend (const int8_t *data, const int32_t size, bool assign=false)
 
void extend (const NestedArray< ItemType > &other, bool assign=false)
 
NestedArray< ItemType > & operator= (const NestedArray< ItemType > &other)
 
NestedArray< ItemType > & operator+= (const NestedArray< ItemType > &other)
 
const SQLTypeInfoLitegetTypeInfo () const
 
std::string toString () const
 

Additional Inherited Members

- Public Attributes inherited from flatbuffer::NestedArray< ItemType >
int8_t * flatbuffer_
 
int64_t index_ [NESTED_ARRAY_NDIM]
 
size_t n_ {0}
 

Detailed Description

template<typename ItemType>
struct Geo::GeoNestedArray< ItemType >

Definition at line 1965 of file heavydbTypes.h.

Member Function Documentation

template<typename ItemType>
template<typename CT >
FlatBufferManager::Status Geo::GeoNestedArray< ItemType >::fromCoords ( const std::vector< CT > &  coords)
inline

Definition at line 2065 of file heavydbTypes.h.

Referenced by GeoMultiPolygon_fromCoords().

2065  {
2066  return fromCoordsWorker<CT, std::vector<CT>>(coords);
2067  }

+ Here is the caller graph for this function:

template<typename ItemType>
template<typename CT >
FlatBufferManager::Status Geo::GeoNestedArray< ItemType >::fromCoords ( const std::vector< std::vector< CT >> &  coords)
inline

Definition at line 2070 of file heavydbTypes.h.

2070  {
2071  return fromCoordsWorker<CT, std::vector<std::vector<CT>>>(coords);
2072  }
template<typename ItemType>
template<typename CT >
FlatBufferManager::Status Geo::GeoNestedArray< ItemType >::fromCoords ( const std::vector< std::vector< std::vector< CT >>> &  coords)
inline

Definition at line 2075 of file heavydbTypes.h.

2076  {
2077  return fromCoordsWorker<CT, std::vector<std::vector<std::vector<CT>>>>(coords);
2078  }
template<typename ItemType>
template<typename CT , typename VT >
FlatBufferManager::Status Geo::GeoNestedArray< ItemType >::fromCoordsWorker ( const VT &  coords)
inline

Definition at line 2035 of file heavydbTypes.h.

2035  {
2037  const auto* ti = getTypeInfo();
2038  if (ti == nullptr) {
2040  }
2041  if (n_ != 1) {
2042  throw std::runtime_error(
2043  "NestedArray fromCoords failed: expected single index but got " +
2044  ::toString(n_));
2045  }
2046  if (ti->is_geoint()) {
2047  if constexpr (std::is_same<CT, double>::value) {
2048  const auto ccoords = compress_coords(coords);
2049  return m.setItem(index_[0], ccoords);
2050  } else {
2051  return m.setItem(index_[0], coords);
2052  }
2053  } else {
2054  if constexpr (std::is_same<CT, double>::value) {
2055  return m.setItem(index_[0], coords);
2056  } else {
2057  const auto dcoords = decompress_coords(coords);
2058  return m.setItem(index_[0], dcoords);
2059  }
2060  }
2061  }
std::vector< double > decompress_coords(const int8_t *data, const int64_t size, const bool is_geoint)
int64_t index_[NESTED_ARRAY_NDIM]
const SQLTypeInfoLite * getTypeInfo() const
std::vector< int32_t > compress_coords(const int8_t *data, const int64_t size, const bool is_geoint)
std::string toString() const
template<typename ItemType>
DEVICE Point2D Geo::GeoNestedArray< ItemType >::getPoint ( const int64_t  index) const
inline

Definition at line 1974 of file heavydbTypes.h.

1974  {
1975  int8_t* values;
1976  int64_t nof_values;
1977  bool is_null;
1978  size_t value_size;
1979  getRawBuffer(values, nof_values, value_size, is_null);
1980  if (is_null) {
1981  return {};
1982  }
1983  const auto* ti = getTypeInfo();
1984  return get_point(
1985  values, 2 * index, ti->get_input_srid(), ti->get_output_srid(), ti->is_geoint());
1986  }
void getRawBuffer(int8_t *&values, int64_t &nof_values, size_t &value_size, bool &is_null, bool require_1d_item=true) const
const SQLTypeInfoLite * getTypeInfo() 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)
template<typename ItemType>
template<typename CT >
FlatBufferManager::Status Geo::GeoNestedArray< ItemType >::toCoords ( std::vector< CT > &  result) const
inline

Definition at line 2019 of file heavydbTypes.h.

2019  {
2020  return toCoordsWorker<CT, CT>(result);
2021  }
template<typename ItemType>
template<typename CT >
FlatBufferManager::Status Geo::GeoNestedArray< ItemType >::toCoords ( std::vector< std::vector< CT >> &  result) const
inline

Definition at line 2024 of file heavydbTypes.h.

2024  {
2025  return toCoordsWorker<CT, std::vector<CT>>(result);
2026  }
template<typename ItemType>
template<typename CT >
FlatBufferManager::Status Geo::GeoNestedArray< ItemType >::toCoords ( std::vector< std::vector< std::vector< CT >>> &  result) const
inline

Definition at line 2029 of file heavydbTypes.h.

2030  {
2031  return toCoordsWorker<CT, std::vector<std::vector<CT>>>(result);
2032  }
template<typename ItemType>
template<typename CT , typename VT >
FlatBufferManager::Status Geo::GeoNestedArray< ItemType >::toCoordsWorker ( std::vector< VT > &  result) const
inline

Definition at line 1991 of file heavydbTypes.h.

1991  {
1992  if constexpr (std::is_same<CT, VT>::value) {
1993  int8_t* values;
1994  int64_t nof_values;
1995  bool is_null;
1996  size_t value_size;
1997  getRawBuffer(values, nof_values, value_size, is_null);
1998  const auto* ti = getTypeInfo();
1999  points_to_vector(values, nof_values, ti->is_geoint(), result);
2000  return FlatBufferManager::Status::Success;
2001  } else {
2002  auto sz = size();
2003  result.reserve(sz);
2004  for (size_t i = 0; i < sz; i++) {
2005  auto item = getItem(i);
2006  VT ritem;
2007  auto status = item.toCoords(ritem);
2008  if (status != FlatBufferManager::Status::Success) {
2009  return status;
2010  }
2011  result.push_back(ritem);
2012  }
2013  return FlatBufferManager::Status::Success;
2014  }
2015  }
const ItemType getItem(const int64_t index) const
void getRawBuffer(int8_t *&values, int64_t &nof_values, size_t &value_size, bool &is_null, bool require_1d_item=true) const
size_t size() const
const SQLTypeInfoLite * getTypeInfo() const
CONSTEXPR DEVICE bool is_null(const T &value)
void points_to_vector(const int8_t *points_buf, const int64_t nof_points, const bool is_geoint, std::vector< CT > &result)

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