Go to the source code of this file.
Legato Safe References API include file.
Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
Reference to an "iterator" object, used to manage iterating a collection of safe refs.
Reference to a "Reference Map" object, which stores mappings from Safe References to pointers.
Create a Reference Map that can hold mappings from Safe References to pointers.
- Returns
- A reference to the Reference Map object.
- Parameters
-
[in] | name | Name of the map (for diagnostics). |
[in] | maxRefs | Maximum number of Safe References expected to be kept in this Reference Map at any one time. |
Creates a Safe Reference, storing a mapping between that reference and a specified pointer for future lookup.
- Returns
- The Safe Reference.
- Parameters
-
[in] | mapRef | Reference Map in which the mapping should be kept. |
[in] | ptr | Pointer value to which the new Safe Reference will be mapped. |
Deletes a Safe Reference.
- Parameters
-
[in] | mapRef | Reference Map to delete the mapping from. |
[in] | safeRef | Safe Reference to be deleted (invalidated). |
Gets an interator for step-by-step iteration over the map. In this mode the iteration is controlled by the calling function using the le_ref_NextNode() function. There is one iterator per map, and calling this function resets the iterator position to the start of the map. The iterator is not ready for data access until le_ref_NextNode() has been called at least once.
- Returns
- Returns A reference to a hashmap iterator which is ready for le_hashmap_NextNode() to be called on it.
- Parameters
-
[in] | mapRef | Reference to the map. |
Retrieves a pointer to the safe ref iterator is currently pointing at. If the iterator has just been initialized and le_hashmap_NextNode() has not been called, or if the iterator has been invalidated then this will return NULL.
- Returns
- A pointer to the current key, or NULL if the iterator has been invalidated or is not ready.
- Parameters
-
[in] | iteratorRef | Reference to the iterator. |
Retrieves a pointer to the value which the iterator is currently pointing at. If the iterator has just been initialized and le_ref_NextNode() has not been called, or if the iterator has been invalidated then this will return NULL.
- Returns
- A pointer to the current value, or NULL if the iterator has been invalidated or is not ready.
- Parameters
-
[in] | iteratorRef | Reference to the iterator. |
Translates a Safe Reference back to the pointer from when the Safe Reference was created.
- Returns
- Pointer that the Safe Reference maps to, or NULL if the Safe Reference has been deleted or is invalid.
- Parameters
-
[in] | mapRef | Reference Map to do the lookup in. |
[in] | safeRef | Safe Reference to be translated into a pointer. |
Moves the iterator to the next key/value pair in the map. If the hashmap is modified during iteration then this function will return an error.
- Returns
- Returns LE_OK unless you go past the end of the map, then returns LE_NOT_FOUND. If the iterator has been invalidated by the map changing or you have previously received a LE_NOT_FOUND then this returns LE_FAULT.
- Parameters
-
[in] | iteratorRef | Reference to the iterator. |