reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
pointer_hashmap.h File Reference
#include "hashmap.h"

Go to the source code of this file.

Macros

#define HASHMAP(token)   hashmap_object2int##_##token
 Defines a hashmap type that maps void pointers to integers. To use this:
 
#define K   void*
 
#define V   int
 
#define HASH_OF(key)   (size_t) key
 

Macro Definition Documentation

◆ HASH_OF

#define HASH_OF ( key)    (size_t) key

◆ HASHMAP

#define HASHMAP ( token)    hashmap_object2int##_##token

Defines a hashmap type that maps void pointers to integers. To use this:

Author
Peter Donovan (peter.nosp@m.dono.nosp@m.van@b.nosp@m.erke.nosp@m.ley.e.nosp@m.du) To create a new hashmap:
return address
Definition hashmap.h:74
#define CAPACITY
Definition hashmap_test.c:8
where CAPACITY is the maximum capacity of the hashmap and NOTHING is a pointer key that is guaranteed to be never used (e.g., NULL). To put an entry into the hashmap: where POINTER is a pointer not equal to NOTHING and VALUE is an integer. This will segfault if the hashmap is already at capacity.

To retrieve a value from the hashmap:

This will segfault if the entry is not in the hashmap.

See hashmap.h for documentation on how to declare other hashmap types.

◆ K

#define K   void*

◆ V

#define V   int