|
Jpp
|
General purpose class for hash map of (key, value) pairs. More...
#include <JHashMap.hh>
Classes | |
| struct | JComparator |
| Auxiliary class for ordering of objects in the collection by the hash value of their keys. More... | |
Public Types | |
| typedef JKey_t | key_type |
| typedef JValue_t | mapped_type |
| typedef std::pair< JKey_t, JValue_t > | value_type |
| typedef JEvaluator_t | evaluator_type |
| typedef std::vector< value_type > | container_type |
| typedef container_type::const_iterator | const_iterator |
| typedef container_type::const_reverse_iterator | const_reverse_iterator |
| typedef container_type::iterator | iterator |
| typedef container_type::reverse_iterator | reverse_iterator |
| typedef std::pair < const_iterator, bool > | pair_type |
Public Member Functions | |
| JHashMap (const JEvaluator_t &evaluator=JEvaluator_t()) | |
| Constructor. More... | |
| virtual void | clear () |
| Clear. More... | |
| virtual mapped_type & | get (typename JClass< key_type >::argument_type key) |
| Get mapped value. More... | |
| const mapped_type & | get (typename JClass< key_type >::argument_type key) const |
| Get mapped value. More... | |
| pair_type | insert (const value_type &element) |
| Insert element. More... | |
| void | erase (iterator pos) |
| Erase element at given position. More... | |
| void | erase (iterator __begin, iterator __end) |
| Erase elements in given range. More... | |
| bool | erase (typename JClass< key_type >::argument_type key) const |
| Erase element. More... | |
| bool | has (typename JClass< key_type >::argument_type key) const |
| Test whether key is present. More... | |
| const JComparator & | getComparator () const |
| Get comparator. More... | |
| mapped_type & | operator[] (typename JClass< key_type >::argument_type key) |
| Get mapped value. More... | |
| void | put (typename JClass< key_type >::argument_type key, typename JClass< mapped_type >::argument_type value) |
| Put pair-wise element (key,value) into collection. More... | |
Public Attributes | |
| JEvaluator_t | getValue |
| Function object for evaluation of key. More... | |
Protected Attributes | |
| JComparator | compare |
| Function object for comparison. More... | |
| JRouter< int > | router |
Private Member Functions | |
| void | resize () |
| void | push_back () |
| void | pop_back () |
Friends | |
| JReader & | operator>> (JReader &in, JHashMap &object) |
| Read hash map from input. More... | |
| JWriter & | operator<< (JWriter &out, const JHashMap &object) |
| Write hash map to output. More... | |
General purpose class for hash map of (key, value) pairs.
The elements in a hash map are sorted according to the specified evaluation. The evaluation of elements corresponds to a unary method returning an integer value for a given key; The default evaluator is JHashEvaluator.
This class implements the JMappableCollection interface.
Definition at line 53 of file JHashMap.hh.
| typedef JKey_t JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::key_type |
Definition at line 59 of file JHashMap.hh.
| typedef JValue_t JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::mapped_type |
Definition at line 60 of file JHashMap.hh.
| typedef std::pair<JKey_t, JValue_t> JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::value_type |
Definition at line 61 of file JHashMap.hh.
| typedef JEvaluator_t JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::evaluator_type |
Definition at line 62 of file JHashMap.hh.
| typedef std::vector<value_type> JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::container_type |
Definition at line 64 of file JHashMap.hh.
| typedef container_type::const_iterator JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::const_iterator |
Definition at line 66 of file JHashMap.hh.
| typedef container_type::const_reverse_iterator JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::const_reverse_iterator |
Definition at line 67 of file JHashMap.hh.
| typedef container_type::iterator JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::iterator |
Definition at line 68 of file JHashMap.hh.
| typedef container_type::reverse_iterator JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::reverse_iterator |
Definition at line 69 of file JHashMap.hh.
| typedef std::pair<const_iterator, bool> JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::pair_type |
Definition at line 71 of file JHashMap.hh.
|
inline |
Constructor.
| evaluator | evaluator |
Definition at line 131 of file JHashMap.hh.
|
inlinevirtual |
Clear.
Implements JTOOLS::JMappableCollection< JKey_t, JValue_t >.
Definition at line 141 of file JHashMap.hh.
|
inlinevirtual |
Get mapped value.
| key | key |
Implements JTOOLS::JMappableCollection< JKey_t, JValue_t >.
Definition at line 159 of file JHashMap.hh.
|
inline |
Get mapped value.
This method will throw an exception if given key is not present following the prerequisite of constness.
| key | key |
Definition at line 179 of file JHashMap.hh.
|
inline |
Insert element.
| element | element |
Definition at line 196 of file JHashMap.hh.
|
inline |
Erase element at given position.
| pos | valid position |
Definition at line 226 of file JHashMap.hh.
|
inline |
Erase elements in given range.
| __begin | begin position (included) |
| __end | end position (excluded) |
Definition at line 246 of file JHashMap.hh.
|
inline |
Erase element.
| key | key |
Definition at line 269 of file JHashMap.hh.
|
inline |
Test whether key is present.
| key | key |
Definition at line 298 of file JHashMap.hh.
|
inline |
Get comparator.
Definition at line 309 of file JHashMap.hh.
|
private |
|
private |
|
private |
|
inlineinherited |
Get mapped value.
| key | key |
Definition at line 64 of file JMappableCollection.hh.
|
inlineinherited |
Put pair-wise element (key,value) into collection.
| key | key |
| value | value |
Definition at line 76 of file JMappableCollection.hh.
|
friend |
Read hash map from input.
| in | reader |
| object | hash map |
Definition at line 322 of file JHashMap.hh.
|
friend |
Write hash map to output.
| out | writer |
| object | hash map |
Definition at line 347 of file JHashMap.hh.
| JEvaluator_t JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::getValue |
Function object for evaluation of key.
Definition at line 366 of file JHashMap.hh.
|
protected |
Function object for comparison.
Definition at line 373 of file JHashMap.hh.
|
protected |
Definition at line 375 of file JHashMap.hh.
1.8.5