5
* An SMap is a data structure that holds many mappings of objects to objects:
6
* say, a string to an other string. This can be likened to the Dict structure
7
* in python, but not fully.
9
* An SMap is made up of SMapItems, each MapItem holds two pointers to data.
10
* The first pointer is the key, the secold is the value.
12
* please note that SMaps can be slow and are unordered.
15
#include "SimpleTypeSystem.h"
16
#include "baseobject.h"
19
typedef struct _SMapItem SMapItem;
20
typedef struct _SMap SMap;
21
typedef struct _SMapClass SMapClass;
22
typedef struct _SMapPrivate SMapPrivate;
30
SBaseObjectInstance parent;
35
SBaseObjectClass parentclass;
36
bool (* is_equal)(void *, void *); // method to check if items are equal.
39
SMapItem * s_map_item_new (void * key, void * value);
41
void s_map_item_free (SMapItem * self);
44
* s_map_new creates a new SMap oject, it takes a CompFunc as an argument.
46
* The compfunc tells the SMap object if the key already exists when
47
* adding key/value pares or when searching after a key when retrieving a value.
49
SMap * s_map_new ( CompFunc comp_func );
51
void s_map_free (SMap * self);
53
void s_map_add (SMap * self ,void * key, void * value);
55
void * s_map_get (SMap * self, void * key);