ucx
UAP Common Extensions
Loading...
Searching...
No Matches
cx_map_class_s Struct Reference

The class definition for arbitrary maps. More...

#include <map.h>

Data Fields

void(* deallocate )(struct cx_map_s *map)
 Deallocates the entire memory.
 
void(* clear )(struct cx_map_s *map)
 Removes all elements.
 
void *(* put )(CxMap *map, CxHashKey key, void *value)
 Add or overwrite an element.
 
void *(* get )(const CxMap *map, CxHashKey key)
 Returns an element.
 
int(* remove )(CxMap *map, CxHashKey key, void *targetbuf)
 Removes an element.
 
CxMapIterator(* iterator )(const CxMap *map, enum cx_map_iterator_type type)
 Creates an iterator for this map.
 

Detailed Description

The class definition for arbitrary maps.

Field Documentation

◆ put

void *(* cx_map_class_s::put) (CxMap *map, CxHashKey key, void *value)

Add or overwrite an element.

If the value is NULL, the implementation shall only allocate memory instead of adding an existing value to the map. Returns a pointer to the allocated memory or NULL if allocation fails.

◆ remove

int(* cx_map_class_s::remove) (CxMap *map, CxHashKey key, void *targetbuf)

Removes an element.

Implementations SHALL check if targetbuf is set and copy the elements to the buffer without invoking any destructor. When targetbuf is not set, the destructors SHALL be invoked.

The function SHALL return zero when the key was found and non-zero, otherwise.


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