OmniSciDB  c1a53651b2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Array< T > Struct Template Reference

#include <heavydbTypes.h>

Public Member Functions

DEVICE Array (T *ptr, const int64_t size, const bool is_null=false)
 
DEVICE Array ()
 
DEVICE Array (const int64_t size, const bool is_null=false)
 
DEVICEoperator() (const unsigned int index) const
 
DEVICE T & operator[] (const unsigned int index)
 
DEVICE const T & operator[] (const unsigned int index) const
 
DEVICE int64_t getSize () const
 
DEVICE bool isNull () const
 
DEVICE constexpr T null_value () const
 
DEVICE bool isNull (const unsigned int index) const
 

Public Attributes

T * ptr
 
int64_t size
 
int8_t is_null
 

Detailed Description

template<typename T>
struct Array< T >

Definition at line 223 of file heavydbTypes.h.

Constructor & Destructor Documentation

template<typename T>
DEVICE Array< T >::Array ( T *  ptr,
const int64_t  size,
const bool  is_null = false 
)
inline

Definition at line 228 of file heavydbTypes.h.

229  : ptr(is_null ? nullptr : ptr), size(size), is_null(is_null) {}
int64_t size
Definition: heavydbTypes.h:225
int8_t is_null
Definition: heavydbTypes.h:226
T * ptr
Definition: heavydbTypes.h:224
template<typename T>
DEVICE Array< T >::Array ( )
inline

Definition at line 230 of file heavydbTypes.h.

230 : ptr(nullptr), size(0), is_null(true) {}
int64_t size
Definition: heavydbTypes.h:225
int8_t is_null
Definition: heavydbTypes.h:226
T * ptr
Definition: heavydbTypes.h:224
template<typename T>
DEVICE Array< T >::Array ( const int64_t  size,
const bool  is_null = false 
)
inline

Definition at line 232 of file heavydbTypes.h.

References allocate_varlen_buffer(), Array< T >::is_null, Array< T >::ptr, and heavydb.dtypes::T.

233  : size(size), is_null(is_null) {
234  if (!is_null) {
235  // Memory must be manually released, otherwise leaks can happen.
236  // On UDFs, if it is the return argument, memory is released with
237  // register_buffer_with_executor_rsm
238  ptr = reinterpret_cast<T*>(
239  allocate_varlen_buffer(size, static_cast<int64_t>(sizeof(T))));
240  } else {
241  ptr = nullptr;
242  }
243  }
int64_t size
Definition: heavydbTypes.h:225
EXTENSION_NOINLINE int8_t * allocate_varlen_buffer(int64_t element_count, int64_t element_size)
int8_t is_null
Definition: heavydbTypes.h:226
T * ptr
Definition: heavydbTypes.h:224

+ Here is the call graph for this function:

Member Function Documentation

template<typename T>
DEVICE bool Array< T >::isNull ( ) const
inline

Definition at line 258 of file heavydbTypes.h.

References Array< T >::is_null.

Referenced by array_first_half__t32(), anonymous_namespace{ExtensionFunctionsArray.hpp}::array_first_half_impl(), array_second_half__t32(), anonymous_namespace{ExtensionFunctionsArray.hpp}::array_second_half_impl(), Column< Array< T > >::concatItem(), Column< Array< T > >::setItem(), sum_along_row__cpu_template(), and tarray_append().

258 { return is_null; }
int8_t is_null
Definition: heavydbTypes.h:226

+ Here is the caller graph for this function:

template<typename T>
DEVICE bool Array< T >::isNull ( const unsigned int  index) const
inline

Definition at line 262 of file heavydbTypes.h.

References Array< T >::is_null, Array< T >::null_value(), and Array< T >::ptr.

262  {
263  return (is_null ? false : ptr[index] == null_value());
264  }
int8_t is_null
Definition: heavydbTypes.h:226
DEVICE constexpr T null_value() const
Definition: heavydbTypes.h:260
T * ptr
Definition: heavydbTypes.h:224

+ Here is the call graph for this function:

template<typename T>
DEVICE constexpr T Array< T >::null_value ( ) const
inline

Definition at line 260 of file heavydbTypes.h.

Referenced by Array< T >::isNull().

260 { return inline_null_value<T>(); }

+ Here is the caller graph for this function:

template<typename T>
DEVICE T Array< T >::operator() ( const unsigned int  index) const
inline

Definition at line 245 of file heavydbTypes.h.

References Array< T >::ptr, and Array< T >::size.

245  {
246  if (index < static_cast<unsigned int>(size)) {
247  return ptr[index];
248  } else {
249  return 0; // see array_at
250  }
251  }
int64_t size
Definition: heavydbTypes.h:225
T * ptr
Definition: heavydbTypes.h:224
template<typename T>
DEVICE T& Array< T >::operator[] ( const unsigned int  index)
inline

Definition at line 253 of file heavydbTypes.h.

References Array< T >::ptr.

253 { return ptr[index]; }
T * ptr
Definition: heavydbTypes.h:224
template<typename T>
DEVICE const T& Array< T >::operator[] ( const unsigned int  index) const
inline

Definition at line 254 of file heavydbTypes.h.

References Array< T >::ptr.

254 { return ptr[index]; }
T * ptr
Definition: heavydbTypes.h:224

Member Data Documentation

template<typename T>
int8_t Array< T >::is_null

Definition at line 226 of file heavydbTypes.h.

Referenced by Array< T >::Array(), and Array< T >::isNull().

template<typename T>
int64_t Array< T >::size

Definition at line 225 of file heavydbTypes.h.

Referenced by Array< T >::getSize(), and Array< T >::operator()().


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