All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
KzcHashMapIterator Struct Reference

Iterator to the contents of a KzcHashMap. More...

#include <core/util/collection/kzc_hash_map.h>

Public Attributes

struct KzcHashMapmap_private
 Reference to the hash map accessed by this iterator. More...
 
union {
   struct KzcHashMapIteratorIndexing   index_private
 
   struct KzcHashMapOrderedEntry *   entry_private
 
data
 Used for tracking position of the iterator. More...
 

Detailed Description

Iterator to the contents of a KzcHashMap.

If the hash map is ordered, the iterator will iterate the elements in the order specified by the KzcComparatorFunction.

Usage

The following example code shows how to iterate over a hash map. Notice that kzcHashMapIterationBreak() is necessary for breaking out of the iteration loop when Kanzi has been built for debugging.

while (kzcHashMapIterate(it))
{
struct SomeKey* key = (struct SomeKey*)kzcHashMapIteratorPointerGetKey(it); // (Optional)
struct SomeStruct* value = (struct SomeStruct*)kzcHashMapIteratorGetPointerValue(it);
somestruct_some_operation(value);
// ... etc ...
if (condition_for_breaking_out_of_the_loop)
}

Alternative accessor functions are listed in kzc_hash_map_accessors_h.inl.

Member Data Documentation

struct KzcHashMap* KzcHashMapIterator::map_private

Reference to the hash map accessed by this iterator.

struct KzcHashMapIteratorIndexing KzcHashMapIterator::index_private
struct KzcHashMapOrderedEntry* KzcHashMapIterator::entry_private
union { ... } KzcHashMapIterator::data

Used for tracking position of the iterator.


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