OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
red-black tree maps Handle keys to type T elements More...
#include <HandleMap.h>
Public Types | |
typedef std::shared_ptr < HandleMap< T > > | MapPtr |
Public Member Functions | |
HandleMap () | |
void | add (Handle key, T element) throw (RuntimeException) |
T | get (Handle key) |
bool | contains (Handle key) |
T | remove (Handle key) |
void | resize (int newSize) |
int | get_count () |
int | get_size () |
HandleMapIterator< T > * | keys () |
Private Types | |
typedef std::map< Handle, T, std::less< Handle > > | InternalMap |
typedef InternalMap::iterator | InternalIterator |
Private Attributes | |
InternalMap | _handle_map |
std::mutex | _mtx |
Friends | |
class | HandleMapIterator< T > |
red-black tree maps Handle keys to type T elements
This is an Adapter to stl's HashMap.
Definition at line 53 of file HandleMap.h.
|
private |
Definition at line 64 of file HandleMap.h.
|
private |
Defines an iterator to the map.
Definition at line 63 of file HandleMap.h.
typedef std::shared_ptr<HandleMap<T> > opencog::HandleMap< T >::MapPtr |
Definition at line 78 of file HandleMap.h.
|
inline |
Definition at line 79 of file HandleMap.h.
|
inline |
Adds a new entry to the hash table.
Key. | |
Element. |
Definition at line 87 of file HandleMap.h.
References opencog::HandleMap< T >::_handle_map, and opencog::HandleMap< T >::_mtx.
|
inline |
Checks if there exists an element for the given key.
Key. |
Definition at line 131 of file HandleMap.h.
References opencog::HandleMap< T >::_handle_map, and opencog::HandleMap< T >::_mtx.
|
inline |
Returns the element for a given key.
Key. |
Definition at line 109 of file HandleMap.h.
References opencog::HandleMap< T >::_handle_map, and opencog::HandleMap< T >::_mtx.
|
inline |
Returns the total number of elements in the hash table.
Definition at line 175 of file HandleMap.h.
References opencog::HandleMap< T >::_handle_map, and opencog::HandleMap< T >::_mtx.
|
inline |
Returns the size of the hash table (number of possible collision lists). XXX No not any more XXX.
Definition at line 187 of file HandleMap.h.
References opencog::HandleMap< T >::_handle_map, and opencog::HandleMap< T >::_mtx.
|
inline |
Returns an iterator through all keys stored in the hash table.
Definition at line 200 of file HandleMap.h.
|
inline |
Removes an element referred by a given key from the table and returns it.
Key. |
Definition at line 144 of file HandleMap.h.
References opencog::HandleMap< T >::_handle_map, and opencog::HandleMap< T >::_mtx.
|
inline |
Changes the size of the hash table to at least a new size.
New | size for the hash table. |
Definition at line 164 of file HandleMap.h.
References opencog::HandleMap< T >::_handle_map, and opencog::HandleMap< T >::_mtx.
|
friend |
Definition at line 56 of file HandleMap.h.
|
private |
The Map where the elements will be stored.
Definition at line 69 of file HandleMap.h.
|
private |
The mutex used to control access to the HashMap.
Definition at line 74 of file HandleMap.h.