threadsafe map object More...
#include <threadsafe_map.h>
Classes | |
struct | iterator_t |
Public Member Functions | |
int | size (void) const throw () |
how many elements in the map | |
void | insert (IN const K &key, IN const T &t) |
insert the given object at the given key value (map, not multimap!) | |
bool | lookup (IN const K &key, OUT T &t) const throw () |
retrieve value at key--true if there is a value there | |
bool | remove (IN const K &key) |
remove (erase) the element at key, if there is one | |
void | clear (void) |
clear out (erase) the entire map | |
void | getIterator (OUT iterator_t &i) const throw () |
get an iterator (points to the first element in the map) | |
bool | getNextElement (IO iterator_t &i, OUT K &k, OUT T &t) const |
get next element in map and increment iterator |
threadsafe map object
A very simple map object that is safe for multiple threads to use at the same time. There is a single mutex protecting the entire map.
You can iterate using getIterator()/getNextElement(). However, that is not guaranteed iteration. Your iterator will be invalidated (and getNextElement() will return false) if another thread has since updated the map.
Definition at line 58 of file threadsafe_map.h.
int threadsafe_map< K, T >::size | ( | void | ) | const throw () [inline] |
how many elements in the map
Definition at line 78 of file threadsafe_map.h.
void threadsafe_map< K, T >::insert | ( | IN const K & | key, | |
IN const T & | t | |||
) | [inline] |
insert the given object at the given key value (map, not multimap!)
Definition at line 85 of file threadsafe_map.h.
bool threadsafe_map< K, T >::lookup | ( | IN const K & | key, | |
OUT T & | t | |||
) | const throw () [inline] |
retrieve value at key--true if there is a value there
Definition at line 92 of file threadsafe_map.h.
bool threadsafe_map< K, T >::remove | ( | IN const K & | key | ) | [inline] |
remove (erase) the element at key, if there is one
Definition at line 104 of file threadsafe_map.h.
void threadsafe_map< K, T >::clear | ( | void | ) | [inline] |
clear out (erase) the entire map
Definition at line 116 of file threadsafe_map.h.
void threadsafe_map< K, T >::getIterator | ( | OUT iterator_t & | i | ) | const throw () [inline] |
get an iterator (points to the first element in the map)
Definition at line 123 of file threadsafe_map.h.
bool threadsafe_map< K, T >::getNextElement | ( | IO iterator_t & | i, | |
OUT K & | k, | |||
OUT T & | t | |||
) | const [inline] |
get next element in map and increment iterator
Definition at line 131 of file threadsafe_map.h.