Typedefs |
typedef struct EpkIdMap_struct | EpkIdMap |
| Opaque data structure representing an ID mapping table.
|
Enumerations |
enum | epk_idmap_mode_t { EPK_IDMAP_DENSE,
EPK_IDMAP_SPARSE
} |
| Enumeration type defining the two differnt modes of an identifier mapping table. More...
|
Functions |
|
EXTERN EpkIdMap * | epk_idmap_create (epk_idmap_mode_t mode, size_t capacity) |
| Creates and returns a new instance of EpkIdMap with the given mode and initial capacity.
|
EXTERN void | epk_idmap_free (EpkIdMap *instance) |
| Destroys the given instance of EpkIdMap and releases the allocated memory.
|
EXTERN size_t | epk_idmap_size (const EpkIdMap *instance) |
| Returns the actual number of entries stored in the given mapping table instance.
|
EXTERN epk_idmap_mode_t | epk_idmap_mode (const EpkIdMap *instance) |
| Returns the identifier mapping mode (dense/sparse) used for the given mapping table instance.
|
EXTERN void | epk_idmap_clear (EpkIdMap *instance) |
| Removes all entries in the given mapping table instance.
|
EXTERN void | epk_idmap_add (EpkIdMap *instance, elg_ui4 local_id, elg_ui4 global_id) |
| Adds the given mapping from local_id to global_id to the mapping table instance.
|
EXTERN elg_ui4 | epk_idmap_get (const EpkIdMap *instance, elg_ui4 local_id) |
| Returns the global identifier for the given local_id stored in the mapping table instance.
|
EXTERN const elg_ui4 * | epk_idmap_data (const EpkIdMap *instance, size_t *count) |
| Returns an pointer to the raw data of the given mapping table instance.
|
This file provides type definitions and function prototypes for an identifier mapping data structure which is used to store mapping tables for converting local into global identifiers.
This mapping data structure can operate in two different modes (see epk_idmap_mode_t): A dense mapping can be used if the local identifiers are consecutively enumerated from 0 to N-1. In this case, only the global identifier are stored in the table at the corresponding entry, leading to compact storage and fast look-up. By contrast, if the local identifiers can consist of arbitrary numbers, a sparse mapping is necessary. Here, (local_id, global_id) tuples are stored, which requires a more complicated look-up procedure.
- Note:
- This module uses the
assert()
macro to check various conditions (especially the values of given parameters) at runtime, which can cause a performance penalty.