template <typename T>
class PointerList
Defined at line 38 of file ../../src/camera/lib/raw_formats/pointer_list.h
A list of pointers. Depending on the constructor used, the memory which contains the list of
pointers as well as the memory those pointers point to can be owned by either this object or
owned externally.
The "non-owning" constructor allows a PointerList to be initialized from static arrays and used
at compile time. The "owning" constructor dynamically allocates space to store a number of
pointers up to the given capacity. Then emplace_back can be used to dynamically construct a new
element and store its pointer in the list. The memory for the element will be freed when the
PointerList is destroyed.
Copying a PointerList which owns the list and element memory will result in a deep copy (and thus
further heap allocation).
This class provides no thread safety guarantees for accessors. However the "non-owning"
functionality allows instances to be created as constexpr constants which can be used safely
from anywhere (provided the pointers stored are truly to constant data).
Hopefully this can be replaced once the implementation of c++20 constexpr STL containers is done.
Public Methods
void PointerList<T> ()
Defined at line 40 of file ../../src/camera/lib/raw_formats/pointer_list.h
void PointerList<T> (const T *const * ptr_list, uint64_t size)
"Non-owning" constructor for static arrays of pointers to scalar values. Caller must ensure
provided pointers remain valid.
Defined at line 50 of file ../../src/camera/lib/raw_formats/pointer_list.h
void PointerList<T> (const T *const * ptr_list, uint64_t size, uint64_t element_array_size)
"Non-owning" constructor for static arrays of pointers to arrays of trivially copyable types.
Caller must ensure provided pointers remain valid.
Defined at line 60 of file ../../src/camera/lib/raw_formats/pointer_list.h
void PointerList<T> (uint64_t capacity)
"Owning" constructor dynamically allocates space for 'capacity' T pointers.
Defined at line 69 of file ../../src/camera/lib/raw_formats/pointer_list.h
void PointerList<T> (uint64_t capacity, uint64_t element_array_size)
"Owning" constructor dynamically allocates space for 'capacity' pointers to arrays of T. Those
arrays of T are not allocated until an element is added.
Defined at line 79 of file ../../src/camera/lib/raw_formats/pointer_list.h
void PointerList<T> (const PointerList<T> & o)
Copy constructor does a deep copy if the object we're copying owns it's memory.
Defined at line 88 of file ../../src/camera/lib/raw_formats/pointer_list.h
void PointerList<T> (PointerList<T> && o)
Defined at line 121 of file ../../src/camera/lib/raw_formats/pointer_list.h
void ~PointerList<T> ()
Defined at line 136 of file ../../src/camera/lib/raw_formats/pointer_list.h
uint64_t size ()
Defined at line 149 of file ../../src/camera/lib/raw_formats/pointer_list.h
uint64_t capacity ()
Defined at line 150 of file ../../src/camera/lib/raw_formats/pointer_list.h
uint64_t element_array_size ()
Defined at line 151 of file ../../src/camera/lib/raw_formats/pointer_list.h
bool owns_memory ()
Conditionally exposed for unit test purposes since we can't use asserts or do logging in code
that can run at compile time.
Defined at line 156 of file ../../src/camera/lib/raw_formats/pointer_list.h
const T *const * static_list ()
Defined at line 157 of file ../../src/camera/lib/raw_formats/pointer_list.h
T ** dynamic_list ()
Defined at line 158 of file ../../src/camera/lib/raw_formats/pointer_list.h
const T * at (uint64_t index)
Defined at line 161 of file ../../src/camera/lib/raw_formats/pointer_list.h
const T * operator[] (uint64_t index)
Defined at line 170 of file ../../src/camera/lib/raw_formats/pointer_list.h
bool push_back (T * ptr)
Push a new pointer into the list. This object assumes responsibility for calling delete on the
pointer.
Defined at line 174 of file ../../src/camera/lib/raw_formats/pointer_list.h
template <typename U, typename... Args>
bool emplace_back (Args &&... args)
Constructs a new heap allocated object with the given arguments and stores the pointer in
the list, increasing the size by 1.
Defined at line 187 of file ../../src/camera/lib/raw_formats/pointer_list.h