OmniSciDB  ba1bac9284
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 35 of file OmniSciTypes.h.

Constructor & Destructor Documentation

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

Definition at line 40 of file OmniSciTypes.h.

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

41  : size(size), is_null(is_null) {
42  if (!is_null) {
43  ptr = reinterpret_cast<T*>(
44  allocate_varlen_buffer(size, static_cast<int64_t>(sizeof(T))));
45  } else {
46  ptr = nullptr;
47  }
48  }
EXTENSION_NOINLINE int8_t * allocate_varlen_buffer(int64_t element_count, int64_t element_size)
int64_t size
Definition: OmniSciTypes.h:37
int8_t is_null
Definition: OmniSciTypes.h:38
T * ptr
Definition: OmniSciTypes.h:36

+ Here is the call graph for this function:

Member Function Documentation

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

Definition at line 60 of file OmniSciTypes.h.

References Array< T >::size.

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

60 { return size; }
int64_t size
Definition: OmniSciTypes.h:37

+ Here is the caller graph for this function:

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

Definition at line 62 of file OmniSciTypes.h.

References Array< T >::is_null.

62 { return is_null; }
int8_t is_null
Definition: OmniSciTypes.h:38
template<typename T>
DEVICE constexpr T Array< T >::null_value ( ) const
inline

Definition at line 64 of file OmniSciTypes.h.

64  {
65  return std::is_signed<T>::value ? std::numeric_limits<T>::min()
66  : std::numeric_limits<T>::max();
67  }
template<typename T>
DEVICE T Array< T >::operator() ( const unsigned int  index) const
inline

Definition at line 50 of file OmniSciTypes.h.

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

50  {
51  if (index < static_cast<unsigned int>(size)) {
52  return ptr[index];
53  } else {
54  return 0; // see array_at
55  }
56  }
int64_t size
Definition: OmniSciTypes.h:37
T * ptr
Definition: OmniSciTypes.h:36
template<typename T>
DEVICE T& Array< T >::operator[] ( const unsigned int  index)
inline

Definition at line 58 of file OmniSciTypes.h.

References Array< T >::ptr.

58 { return ptr[index]; }
T * ptr
Definition: OmniSciTypes.h:36

Member Data Documentation

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

Definition at line 38 of file OmniSciTypes.h.

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

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

Definition at line 37 of file OmniSciTypes.h.

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


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