OmniSciDB  f17484ade4
 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 1958 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 2058 of file heavydbTypes.h.

Referenced by GeoMultiPolygon_fromCoords().

2058  {
2059  return fromCoordsWorker<CT, std::vector<CT>>(coords);
2060  }

+ 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 2063 of file heavydbTypes.h.

2063  {
2064  return fromCoordsWorker<CT, std::vector<std::vector<CT>>>(coords);
2065  }
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 2068 of file heavydbTypes.h.

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

Definition at line 2028 of file heavydbTypes.h.

2028  {
2030  const auto* ti = getTypeInfo();
2031  if (ti == nullptr) {
2033  }
2034  if (n_ != 1) {
2035  throw std::runtime_error(
2036  "NestedArray fromCoords failed: expected single index but got " +
2037  ::toString(n_));
2038  }
2039  if (ti->is_geoint()) {
2040  if constexpr (std::is_same<CT, double>::value) {
2041  const auto ccoords = compress_coords(coords);
2042  return m.setItem(index_[0], ccoords);
2043  } else {
2044  return m.setItem(index_[0], coords);
2045  }
2046  } else {
2047  if constexpr (std::is_same<CT, double>::value) {
2048  return m.setItem(index_[0], coords);
2049  } else {
2050  const auto dcoords = decompress_coords(coords);
2051  return m.setItem(index_[0], dcoords);
2052  }
2053  }
2054  }
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 1967 of file heavydbTypes.h.

1967  {
1968  int8_t* values;
1969  int64_t nof_values;
1970  bool is_null;
1971  size_t value_size;
1972  getRawBuffer(values, nof_values, value_size, is_null);
1973  if (is_null) {
1974  return {};
1975  }
1976  const auto* ti = getTypeInfo();
1977  return get_point(
1978  values, 2 * index, ti->get_input_srid(), ti->get_output_srid(), ti->is_geoint());
1979  }
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 2012 of file heavydbTypes.h.

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

Definition at line 2017 of file heavydbTypes.h.

2017  {
2018  return toCoordsWorker<CT, std::vector<CT>>(result);
2019  }
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 2022 of file heavydbTypes.h.

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

Definition at line 1984 of file heavydbTypes.h.

1984  {
1985  if constexpr (std::is_same<CT, VT>::value) {
1986  int8_t* values;
1987  int64_t nof_values;
1988  bool is_null;
1989  size_t value_size;
1990  getRawBuffer(values, nof_values, value_size, is_null);
1991  const auto* ti = getTypeInfo();
1992  points_to_vector(values, nof_values, ti->is_geoint(), result);
1993  return FlatBufferManager::Status::Success;
1994  } else {
1995  auto sz = size();
1996  result.reserve(sz);
1997  for (size_t i = 0; i < sz; i++) {
1998  auto item = getItem(i);
1999  VT ritem;
2000  auto status = item.toCoords(ritem);
2001  if (status != FlatBufferManager::Status::Success) {
2002  return status;
2003  }
2004  result.push_back(ritem);
2005  }
2006  return FlatBufferManager::Status::Success;
2007  }
2008  }
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: