Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

simplemap.h File Reference

Go to the source code of this file.

Data Structures

struct  _simple_map_el
 Auxulary structure. More...
struct  MapTypeInfo
struct  SimpleMap
 Main SimpleMap structure. More...

Defines

#define STORAGE_TYPE   extern

Typedefs

typedef int(* MapCompareFunc )(char *, char *)
typedef char *(* MapCopyFunc )(char *)
typedef void(* MapDestructor )(void *)
 Destructor signature.
typedef void(* MapFreeFunc )(char *)
typedef unsigned int(* MapHashFunc )(char *)
typedef int(* MapIterator )(SimpleMap *map, char *key, void *value, void *data)
 Map iterator function.
typedef _simple_map_el SimpleMapEl
 Auxulary structure.

Functions

STORAGE_TYPE SimpleMap * map_copy (SimpleMap *map)
 Creates a copy of map.
STORAGE_TYPE int map_foreach (SimpleMap *map, MapIterator iterator, void *data)
 Iterates over all stored elements.
STORAGE_TYPE void map_free (SimpleMap *map)
 Deletes and frees the map.
STORAGE_TYPE void * map_get (SimpleMap *map, char *key)
 Returns an element by key or -1 if element with such key does not exists.
STORAGE_TYPE void * map_get_element (SimpleMap *, char *key)
 Searches for the element in the map.
STORAGE_TYPE int map_has_key (SimpleMap *map, char *key)
 Checks whether the element with given key exists or not.
STORAGE_TYPE SimpleMap * map_new ()
 Creates new map with default size and no destructor.
STORAGE_TYPE SimpleMap * map_new_configured (int size, MapDestructor destructor)
 Creates new map with given size and destructor.
STORAGE_TYPE SimpleMap * map_new_configured_full (int size, MapDestructor destructor, MapTypeInfo *pInfo)
 Creates new map with given size, destructor, hash and compare functions.
STORAGE_TYPE SimpleMap * map_new_with_destructor (MapDestructor destructor)
 Creates new map with given destructor and default size.
STORAGE_TYPE void map_remove (SimpleMap *map, char *key)
 Removes element by key from map.
STORAGE_TYPE void map_set (SimpleMap *map, char *key, void *value)
 Creates new map element from key/value pair.


Define Documentation

#define STORAGE_TYPE   extern
 


Typedef Documentation

typedef int(* MapCompareFunc)(char *, char *)
 

typedef char*(* MapCopyFunc)(char *)
 

typedef void(* MapDestructor)(void *)
 

Destructor signature.

typedef void(* MapFreeFunc)(char *)
 

typedef unsigned int(* MapHashFunc)(char *)
 

typedef int(* MapIterator)(SimpleMap *map, char *key, void *value, void *data)
 

Map iterator function.

typedef struct _simple_map_el SimpleMapEl
 

Auxulary structure.


Function Documentation

STORAGE_TYPE SimpleMap* map_copy (  SimpleMap *  map  ) 
 

Creates a copy of map.

STORAGE_TYPE int map_foreach (  SimpleMap *  map,
MapIterator  iterator,
void *  data
) 
 

Iterates over all stored elements.

Returns:
zero in case of success or error code, returned by iterator.

STORAGE_TYPE void map_free (  SimpleMap *  map  ) 
 

Deletes and frees the map.

STORAGE_TYPE void* map_get (  SimpleMap *  map,
char *  key
) 
 

Returns an element by key or -1 if element with such key does not exists.

STORAGE_TYPE void* map_get_element (  SimpleMap *  ,
char *  key
) 
 

Searches for the element in the map.

Returns:
the value of the element if the key was found in the map, NULL otherwise

STORAGE_TYPE int map_has_key (  SimpleMap *  map,
char *  key
) 
 

Checks whether the element with given key exists or not.

STORAGE_TYPE SimpleMap* map_new (   ) 
 

Creates new map with default size and no destructor.

Returns:
reference to the newly created map, or 0 if the error occured.

STORAGE_TYPE SimpleMap* map_new_configured (  int  size,
MapDestructor  destructor
) 
 

Creates new map with given size and destructor.

STORAGE_TYPE SimpleMap* map_new_configured_full (  int  size,
MapDestructor  destructor,
MapTypeInfo *  pInfo
) 
 

Creates new map with given size, destructor, hash and compare functions.

STORAGE_TYPE SimpleMap* map_new_with_destructor (  MapDestructor  destructor  ) 
 

Creates new map with given destructor and default size.

STORAGE_TYPE void map_remove (  SimpleMap *  map,
char *  key
) 
 

Removes element by key from map.

STORAGE_TYPE void map_set (  SimpleMap *  map,
char *  key,
void *  value
) 
 

Creates new map element from key/value pair.

Returns:
Newly created map element


Generated on Wed Dec 27 16:52:25 2006 for VRB Online Server by  doxygen 1.4.4