Package Overview
The Prg_Mapping package provides an API to store and retrieve data elements. Each data element maps to a key value, which is defined and computed by the user of the package. Elements in the mapping are stored based on their key values to provide an efficient retrieval (O(log n), where n is the number of elements in the mapping). It is also possible to iterate through all the elements in the mapping in increasing order of key values.
When creating a Prg_Mapping instance, you must provide three functions to fully specify the management of keys. These functions are used when:
- Computing the key associated with a data element.
- Comparing two keys to indicate if one is strictly less than the other.
- Destroying a data element stored in the mapping.
Data elements and key values are void *.
WARNING: For efficiency reasons, the APIs in this package have not been made MT-safe. Thus, in parallel simulations, access to mapped data elements that are shared must be externally serialized.