ets_multimap.h
Include dependency graph for ets_multimap.h:
This graph shows which files directly or indirectly include ets_multimap.h:
Defines
-
ETS_MULTIMAP_NUM_BUCKETS 16
Typedefs
-
typedef struct EtsMultimap EtsMultimap
-
typedef struct EtsMultimapNode EtsMultimapNode
-
typedef struct EtsMultimapEntry EtsMultimapEntry
Enums
Functions
-
EtsMultimap *ets_multimap_new(ets_multimap_type_t type, size_t index)
Create a new multimap.
- Parameters:
type – the multimap type
index – the index of the tuple element to use as key
- Returns:
the created multimap, or NULL on error
-
void ets_multimap_delete(EtsMultimap *multimap, GlobalContext *global)
Delete the multimap and all its contents.
- Parameters:
multimap – the multimap
global – the global context
-
ets_result_t ets_multimap_lookup(EtsMultimap *multimap, term key, term **tuples, size_t *count, GlobalContext *global)
Lookup tuples by key.
Note
Terms returned by this function come from the ETS heap and should be copied to the process heap if needed.
Note
The returned tuples are ordered in reverse insertion order (most recently added elements first).
Warning
The caller is responsible for freeing the memory pointed to by
tuplesusingfree(). When count is zero, memory is not allocated.- Parameters:
multimap – the multimap
key – the key to lookup
tuples – [out] the found tuples (or NULL to only get the count)
count – [out] the number of found tuples; must not be NULL
global – the global context
- Returns:
EtsOk on success, otherwise an error status
-
ets_result_t ets_multimap_insert(EtsMultimap *multimap, term *tuples, size_t count, GlobalContext *global)
Insert one or more tuples into the multimap.
Note
Terms passed to this function will be copied to the ETS heap.
- Parameters:
multimap – the multimap
tuples – the tuples to insert
count – the number of tuples to insert
- Returns:
EtsOk on success, otherwise an error status
-
ets_result_t ets_multimap_remove(EtsMultimap *multimap, term key, GlobalContext *global)
Remove all tuples with the given key.
- Parameters:
multimap – the multimap
key – the key to lookup
global – the global context
- Returns:
EtsOk on success, otherwise an error status
-
ets_result_t ets_multimap_remove_tuple(EtsMultimap *multimap, term tuple, GlobalContext *global)
Remove a given tuple from the multimap.
- Parameters:
multimap – the multimap
tuple – the tuple to remove
global – the global context
- Returns:
EtsOk on success, otherwise an error status
-
struct EtsMultimap
- #include <ets_multimap.h>
Collaboration diagram for EtsMultimap:
-
struct EtsMultimapNode
- #include <ets_multimap.h>
Collaboration diagram for EtsMultimapNode:
-
struct EtsMultimapEntry
- #include <ets_multimap.h>
Collaboration diagram for EtsMultimapEntry: