libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
|
Go to the source code of this file.
Data Structures | |
struct | GblArrayDeque |
Macros | |
#define | GBL_ARRAY_DEQUE_FORCE_POW2 |
Functions | |
GBL_RESULT | GblArrayDeque_construct (GblArrayDeque *pSelf, uint16_t elementSize, size_t capacity, size_t initialSize, const void *pInitialData, GblContext *pCtx) |
GBL_RESULT | GblArrayDeque_destruct (GblArrayDeque *pSelf) |
GBL_RESULT | GblArrayDeque_copy (GblArrayDeque *pSelf, const GblArrayDeque *pOther) |
GBL_RESULT | GblArrayDeque_move (GblArrayDeque *pSelf, GblArrayDeque *pOther) |
GblContext * | GblArrayDeque_context (const GblArrayDeque *pSelf) |
size_t | GblArrayDeque_capacity (const GblArrayDeque *pSelf) |
size_t | GblArrayDeque_size (const GblArrayDeque *pSelf) |
size_t | GblArrayDeque_elementSize (const GblArrayDeque *pSelf) |
GblBool | GblArrayDeque_empty (const GblArrayDeque *pSelf) |
GblBool | GblArrayDeque_full (const GblArrayDeque *pSelf) |
void * | GblArrayDeque_at (const GblArrayDeque *pSelf, size_t index) |
void * | GblArrayDeque_front (const GblArrayDeque *pSelf) |
void * | GblArrayDeque_back (const GblArrayDeque *pSelf) |
GBL_RESULT | GblArrayDeque_pushBack (GblArrayDeque *pSelf, const void *pData) |
void * | GblArrayDeque_emplaceBack (GblArrayDeque *pSelf) |
GBL_RESULT | GblArrayDeque_pushFront (GblArrayDeque *pSelf, const void *pData) |
void * | GblArrayDeque_emplaceFront (GblArrayDeque *pSelf) |
void * | GblArrayDeque_popBack (GblArrayDeque *pSelf) |
void * | GblArrayDeque_popFront (GblArrayDeque *pSelf) |
void * | GblArrayDeque_insert (GblArrayDeque *pSelf, size_t pos, const void *pData, size_t count) |
void * | GblArrayDeque_emplace (GblArrayDeque *pSelf, size_t pos) |
GBL_RESULT | GblArrayDeque_erase (GblArrayDeque *pSelf, size_t pos, size_t count) |
void | GblArrayDeque_clear (GblArrayDeque *pSelf) |
GBL_RESULT | GblArrayDeque_reserve (GblArrayDeque *pSelf, size_t capacity) |
GBL_RESULT | GblArrayDeque_resize (GblArrayDeque *pSelf, size_t size) |
GBL_RESULT | GblArrayDeque_shrinkToFit (GblArrayDeque *pSelf) |
GblArrayDeque container and related functions.
Circular array-based double-ended queue container.
GblArrayDeque is a very flexible container type which combines the fast random access and cache coherency of a contiguous array with the semantics of a double-ended queue. This means that not only are random accesses extremely efficient, but also adding and removing entries from either end as well.
This container is well-suited for data sets which can grow or shrink from either end, but which are typically accessed as an array.
Operation | Time Complexity |
---|---|
iteration | O(N) |
insertion (back or front) | O(1) |
insertion (middle) | O(N) |
removal (back or front) | O(1) |
removal (middle) (WIP) | O(N) |
access (front or back) | O(1) |
random access (middle) | O(1) |
For reference, the following are the results of the profiler unit tests for some common operations shared between GblArrayList (comparable to std::vector) and GblArrayDeque (1024 pointer-sized entries):
Test | GblArrayList | GblArrayDeque |
---|---|---|
at | 0.004 ms | 0.008 ms |
pushBack | 0.030 ms | 0.030 ms |
pushFront | 0.116 ms | 0.027 ms |
Definition in file gimbal_array_deque.h.
#define GBL_ARRAY_DEQUE_FORCE_POW2 |
Definition at line 18 of file gimbal_array_deque.h.