Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::array_ptr< DATA_TYPE, SAFE > Class Template Reference

array_ptr is a non-owning (optionally) bounds-checked pointer to an array More...

#include <duckdb.hpp>

Public Types

using iterator_type = array_ptr_iterator< DATA_TYPE >
 

Public Member Functions

 array_ptr (DATA_TYPE *ptr_p, idx_t count)
 
 array_ptr (DATA_TYPE &ref)
 
const DATA_TYPEoperator[] (idx_t idx) const
 
DATA_TYPEoperator[] (idx_t idx)
 
idx_t size () const
 
array_ptr_iterator< DATA_TYPEbegin ()
 
array_ptr_iterator< DATA_TYPEbegin () const
 
array_ptr_iterator< DATA_TYPEcbegin ()
 
array_ptr_iterator< DATA_TYPEend ()
 
array_ptr_iterator< DATA_TYPEend () const
 
array_ptr_iterator< DATA_TYPEcend ()
 

Static Private Member Functions

static void AssertNotNull (const bool null)
 
static void AssertIndexInBounds (idx_t index, idx_t size)
 

Private Attributes

DATA_TYPEptr
 
idx_t count
 

Detailed Description

template<class DATA_TYPE, bool SAFE = true>
class duckdb::array_ptr< DATA_TYPE, SAFE >

array_ptr is a non-owning (optionally) bounds-checked pointer to an array

Constructor & Destructor Documentation

◆ array_ptr() [1/2]

template<class DATA_TYPE , bool SAFE = true>
duckdb::array_ptr< DATA_TYPE, SAFE >::array_ptr ( DATA_TYPE ptr_p,
idx_t  count 
)
inline
15128 : ptr(ptr_p), count(count) {
15129 if (MemorySafety<SAFE>::ENABLED) {
15130 AssertNotNull(!ptr);
15131 }
15132 }

◆ array_ptr() [2/2]

template<class DATA_TYPE , bool SAFE = true>
duckdb::array_ptr< DATA_TYPE, SAFE >::array_ptr ( DATA_TYPE ref)
inlineexplicit
15133 : ptr(&ref), count(1) {
15134 }

Member Function Documentation

◆ AssertNotNull()

template<class DATA_TYPE , bool SAFE = true>
static void duckdb::array_ptr< DATA_TYPE, SAFE >::AssertNotNull ( const bool  null)
inlinestaticprivate
15107 {
15108#if defined(DUCKDB_DEBUG_NO_SAFETY) || defined(DUCKDB_CLANG_TIDY)
15109 return;
15110#else
15111 if (DUCKDB_UNLIKELY(null)) {
15112 throw duckdb::InternalException("Attempted to construct an array_ptr from a NULL pointer");
15113 }
15114#endif
15115 }
Definition duckdb.hpp:809

◆ AssertIndexInBounds()

template<class DATA_TYPE , bool SAFE = true>
static void duckdb::array_ptr< DATA_TYPE, SAFE >::AssertIndexInBounds ( idx_t  index,
idx_t  size 
)
inlinestaticprivate
15117 {
15118#if defined(DUCKDB_DEBUG_NO_SAFETY) || defined(DUCKDB_CLANG_TIDY)
15119 return;
15120#else
15121 if (DUCKDB_UNLIKELY(index >= size)) {
15122 throw InternalException("Attempted to access index %ld within array_ptr of size %ld", index, size);
15123 }
15124#endif
15125 }

◆ operator[]() [1/2]

template<class DATA_TYPE , bool SAFE = true>
const DATA_TYPE & duckdb::array_ptr< DATA_TYPE, SAFE >::operator[] ( idx_t  idx) const
inline
15136 {
15137 if (MemorySafety<SAFE>::ENABLED) {
15138 AssertIndexInBounds(idx, count);
15139 }
15140 return ptr[idx];
15141 }

◆ operator[]() [2/2]

template<class DATA_TYPE , bool SAFE = true>
DATA_TYPE & duckdb::array_ptr< DATA_TYPE, SAFE >::operator[] ( idx_t  idx)
inline
15143 {
15144 if (MemorySafety<SAFE>::ENABLED) {
15145 AssertIndexInBounds(idx, count);
15146 }
15147 return ptr[idx];
15148 }

◆ size()

template<class DATA_TYPE , bool SAFE = true>
idx_t duckdb::array_ptr< DATA_TYPE, SAFE >::size ( ) const
inline
15150 { // NOLINT: match std naming style
15151 return count;
15152 }

◆ begin() [1/2]

template<class DATA_TYPE , bool SAFE = true>
array_ptr_iterator< DATA_TYPE > duckdb::array_ptr< DATA_TYPE, SAFE >::begin ( )
inline
15154 { // NOLINT: match std naming style
15155 return array_ptr_iterator<DATA_TYPE>(ptr, 0, count);
15156 }

◆ begin() [2/2]

template<class DATA_TYPE , bool SAFE = true>
array_ptr_iterator< DATA_TYPE > duckdb::array_ptr< DATA_TYPE, SAFE >::begin ( ) const
inline
15157 { // NOLINT: match std naming style
15158 return array_ptr_iterator<const DATA_TYPE>(ptr, 0, count);
15159 }

◆ cbegin()

template<class DATA_TYPE , bool SAFE = true>
array_ptr_iterator< DATA_TYPE > duckdb::array_ptr< DATA_TYPE, SAFE >::cbegin ( )
inline
15160 { // NOLINT: match std naming style
15161 return array_ptr_iterator<const DATA_TYPE>(ptr, 0, count);
15162 }

◆ end() [1/2]

template<class DATA_TYPE , bool SAFE = true>
array_ptr_iterator< DATA_TYPE > duckdb::array_ptr< DATA_TYPE, SAFE >::end ( )
inline
15163 { // NOLINT: match std naming style
15164 return array_ptr_iterator<DATA_TYPE>(ptr, count, count);
15165 }

◆ end() [2/2]

template<class DATA_TYPE , bool SAFE = true>
array_ptr_iterator< DATA_TYPE > duckdb::array_ptr< DATA_TYPE, SAFE >::end ( ) const
inline
15166 { // NOLINT: match std naming style
15167 return array_ptr_iterator<const DATA_TYPE>(ptr, count, count);
15168 }

◆ cend()

template<class DATA_TYPE , bool SAFE = true>
array_ptr_iterator< DATA_TYPE > duckdb::array_ptr< DATA_TYPE, SAFE >::cend ( )
inline
15169 { // NOLINT: match std naming style
15170 return array_ptr_iterator<const DATA_TYPE>(ptr, count, count);
15171 }

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