OmniSciDB  8a228a1076
Array< T > Struct Template Reference

#include <OmniSciTypes.h>

Public Member Functions

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 int64_t getSize () const
 
DEVICE bool isNull () const
 
DEVICE constexpr T null_value () const
 

Public Attributes

T * ptr
 
int64_t size
 
int8_t is_null
 

Detailed Description

template<typename T>
struct Array< T >

Definition at line 31 of file OmniSciTypes.h.

Constructor & Destructor Documentation

◆ Array()

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

Definition at line 36 of file OmniSciTypes.h.

References allocate_varlen_buffer().

37  : size(size), is_null(is_null) {
38  if (!is_null) {
39  ptr = reinterpret_cast<T*>(
40  allocate_varlen_buffer(size, static_cast<int64_t>(sizeof(T))));
41  } else {
42  ptr = nullptr;
43  }
44  }
EXTENSION_NOINLINE int8_t * allocate_varlen_buffer(int64_t element_count, int64_t element_size)
int64_t size
Definition: OmniSciTypes.h:33
int8_t is_null
Definition: OmniSciTypes.h:34
T * ptr
Definition: OmniSciTypes.h:32
+ Here is the call graph for this function:

Member Function Documentation

◆ getSize()

template<typename T>
DEVICE int64_t Array< T >::getSize ( ) const
inline

Definition at line 56 of file OmniSciTypes.h.

References Array< T >::size.

Referenced by anonymous_namespace{ExtensionFunctionsArray.hpp}::array_append_impl().

56 { return size; }
int64_t size
Definition: OmniSciTypes.h:33
+ Here is the caller graph for this function:

◆ isNull()

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

Definition at line 58 of file OmniSciTypes.h.

References Array< T >::is_null.

58 { return is_null; }
int8_t is_null
Definition: OmniSciTypes.h:34

◆ null_value()

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

Definition at line 60 of file OmniSciTypes.h.

60  {
61  return std::is_signed<T>::value ? std::numeric_limits<T>::min()
62  : std::numeric_limits<T>::max();
63  }

◆ operator()()

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

Definition at line 46 of file OmniSciTypes.h.

46  {
47  if (index < static_cast<unsigned int>(size)) {
48  return ptr[index];
49  } else {
50  return 0; // see array_at
51  }
52  }
int64_t size
Definition: OmniSciTypes.h:33
T * ptr
Definition: OmniSciTypes.h:32

◆ operator[]()

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

Definition at line 54 of file OmniSciTypes.h.

54 { return ptr[index]; }
T * ptr
Definition: OmniSciTypes.h:32

Member Data Documentation

◆ is_null

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

Definition at line 34 of file OmniSciTypes.h.

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

◆ ptr

template<typename T>
T* Array< T >::ptr

Definition at line 32 of file OmniSciTypes.h.

◆ size

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

Definition at line 33 of file OmniSciTypes.h.

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


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