libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
GblArrayMap Struct Reference

#include <gimbal_array_map.h>

Data Fields

struct { 
 
   GblContext *   pCtx 
 
   GblArrayMapCmpFn   pFnComparator 
 
   size_t   binarySearches: 1 
 
   size_t   size: 63 
 
private_ 
 

Related Symbols

(Note that these are not member symbols.)

GblArrayMapGblArrayMap_create (GblArrayMapCmpFn pFnComparator, GblBool binarySearches, GblContext *pCtx)
 
GBL_RESULT GblArrayMap_destroy (GblArrayMap **ppSelf)
 
GblBool GblArrayMap_erase (GblArrayMap **ppSelf, uintptr_t key)
 
GblBool GblArrayMap_extractVariant (GblArrayMap **ppSelf, uintptr_t key, GblVariant *pVariant)
 
GblBool GblArrayMap_extractValue (GblArrayMap **ppSelf, uintptr_t key, uintptr_t *pValue)
 
void GblArrayMap_clear (GblArrayMap **ppSelf)
 

Detailed Description

Dynamic array-based [K,V] pair associative container.

Contiguous array-based associative container with [K,V] pairs. GblArrayMap is essentially a flat map structure with a few specific properties:

  • Value types can either be uinptr_t userdata or typed GblVariants
  • Userdata types can have per-entry custom destructors
  • For non-trivial key types, a custom comparator can be specified
  • insertion and searching can either be done sorted in a binary search or unsorted linearly
Note
GblArrayMap is a lazily-allocated structure, meaning it isn't actually allocated until it's needed. This is why the majority of the API takes a pointer to a pointer, so a NULL pointer value is a valid empty map. You can optionally preconstruct the structure with GblArrayMap_create.
See also
GblArrayMapEntry

Definition at line 67 of file gimbal_array_map.h.

Friends And Related Symbol Documentation

◆ GblArrayMap_create()

GblArrayMap * GblArrayMap_create ( GblArrayMapCmpFn  pFnComparator,
GblBool  binarySearches,
GblContext pCtx 
)
related
Parameters
pFnComparator
binarySearches
pCtx
Returns
pointer to a new GblArrayMap

◆ GblArrayMap_destroy()

GBL_RESULT GblArrayMap_destroy ( GblArrayMap **  ppSelf)
related
Parameters
ppSelf
Returns
GBL_RESULT_SUCCESS or error code upon failure

◆ GblArrayMap_erase()

GblBool GblArrayMap_erase ( GblArrayMap **  ppSelf,
uintptr_t  key 
)
related
Parameters
ppSelf
key
Returns
GBL_TRUE if the entry with the given key was removed.

◆ GblArrayMap_extractVariant()

GblBool GblArrayMap_extractVariant ( GblArrayMap **  ppSelf,
uintptr_t  key,
GblVariant pVariant 
)
related
Parameters
ppSelf
key
pVariant
Returns
GBL_TRUE if the given variant was extracted

◆ GblArrayMap_extractValue()

GblBool GblArrayMap_extractValue ( GblArrayMap **  ppSelf,
uintptr_t  key,
uintptr_t *  pValue 
)
related
Parameters
ppSelf
key
pValue
Returns
GBL_TRUE if the given value was successfully extracted

◆ GblArrayMap_clear()

void GblArrayMap_clear ( GblArrayMap **  ppSelf)
related
Parameters
ppSelf

Field Documentation

◆ pCtx

GblContext* GblArrayMap::pCtx

Optional custom context.

Definition at line 69 of file gimbal_array_map.h.

◆ pFnComparator

GblArrayMapCmpFn GblArrayMap::pFnComparator

Optional custom comparator.

Definition at line 70 of file gimbal_array_map.h.

◆ binarySearches

size_t GblArrayMap::binarySearches

Optionally sort values and use binary searches.

Definition at line 71 of file gimbal_array_map.h.

◆ size

size_t GblArrayMap::size

Number of elements within the map.

Definition at line 73 of file gimbal_array_map.h.


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