Jpp
|
General purpose class for hash collection of unique elements. More...
#include <JHashCollection.hh>
Public Types | |
typedef JElement_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 | |
JHashCollection (const JEvaluator_t &evaluator=JEvaluator_t()) | |
Constructor. More... | |
virtual void | clear () |
Clear. More... | |
template<class T > | |
const_iterator | find (const T &value) const |
Find element with given value. More... | |
template<class T > | |
iterator | find (const T &value) |
Find element with given value. More... | |
template<class T > | |
value_type & | get (const T value) |
Get element with given value. More... | |
template<class T > | |
const value_type & | get (const T value) const |
Get element with given value. More... | |
virtual pair_type | insert (typename JClass< value_type >::argument_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... | |
template<class T > | |
bool | erase (const T &value) |
Erase element with given value. More... | |
template<class T > | |
bool | has (const T &value) const |
Test whether given value is present. More... | |
Public Attributes | |
JEvaluator_t | getValue |
Function object for evaluation of element. More... | |
Protected Member Functions | |
iterator | insert (iterator pos, typename JClass< value_type >::argument_type element) |
Insert element. More... | |
Protected Attributes | |
JRouter< int > | router |
Private Member Functions | |
void | operator[] (int) |
void | resize () |
void | push_back () |
void | pop_back () |
Friends | |
JReader & | operator>> (JReader &in, JHashCollection &object) |
Read hash collection from input. More... | |
JWriter & | operator<< (JWriter &out, const JHashCollection &object) |
Write hash collection to output. More... | |
General purpose class for hash collection of unique elements.
The elements in a hash collection are unique according to the specified evaluation. The evaluation of elements corresponds to a unary method returning an integer value for a given element; The default evaluator is JHashEvaluator.
For the binary I/O of a collection of elements, the data structure of the elements should provide for an implementation of the following operators:
JReader& operator>>(JReader& in); JWriter& operator<<(JWriter& out);
Definition at line 46 of file JHashCollection.hh.
typedef JElement_t JTOOLS::JHashCollection< JElement_t, JEvaluator_t >::value_type |
Definition at line 51 of file JHashCollection.hh.
typedef JEvaluator_t JTOOLS::JHashCollection< JElement_t, JEvaluator_t >::evaluator_type |
Definition at line 52 of file JHashCollection.hh.
typedef std::vector<value_type> JTOOLS::JHashCollection< JElement_t, JEvaluator_t >::container_type |
Definition at line 54 of file JHashCollection.hh.
typedef container_type::const_iterator JTOOLS::JHashCollection< JElement_t, JEvaluator_t >::const_iterator |
Definition at line 56 of file JHashCollection.hh.
typedef container_type::const_reverse_iterator JTOOLS::JHashCollection< JElement_t, JEvaluator_t >::const_reverse_iterator |
Definition at line 57 of file JHashCollection.hh.
typedef container_type::iterator JTOOLS::JHashCollection< JElement_t, JEvaluator_t >::iterator |
Definition at line 58 of file JHashCollection.hh.
typedef container_type::reverse_iterator JTOOLS::JHashCollection< JElement_t, JEvaluator_t >::reverse_iterator |
Definition at line 59 of file JHashCollection.hh.
typedef std::pair<const_iterator, bool> JTOOLS::JHashCollection< JElement_t, JEvaluator_t >::pair_type |
Definition at line 61 of file JHashCollection.hh.
|
inline |
|
inlinevirtual |
|
inline |
Find element with given value.
value | value |
Definition at line 97 of file JHashCollection.hh.
|
inline |
Find element with given value.
value | value |
Definition at line 121 of file JHashCollection.hh.
|
inline |
Get element with given value.
This method will throw an exception if given value is not present following the prerequisite of constness.
value | value |
Definition at line 147 of file JHashCollection.hh.
|
inline |
Get element with given value.
This method will throw an exception if given value is not present following the prerequisite of constness.
value | value |
Definition at line 168 of file JHashCollection.hh.
|
inlinevirtual |
Insert element.
element | element |
Reimplemented in JTOOLS::JHashSet< JElement_t, JEvaluator_t >.
Definition at line 185 of file JHashCollection.hh.
|
inline |
Erase element at given position.
pos | valid position |
Definition at line 213 of file JHashCollection.hh.
|
inline |
Erase elements in given range.
__begin | begin position (included) |
__end | end position (excluded) |
Definition at line 231 of file JHashCollection.hh.
|
inline |
Erase element with given value.
value | value |
Definition at line 252 of file JHashCollection.hh.
|
inline |
Test whether given value is present.
value | value |
Definition at line 278 of file JHashCollection.hh.
|
inlineprotected |
Insert element.
pos | position |
element | element |
Definition at line 340 of file JHashCollection.hh.
|
private |
|
private |
|
private |
|
private |
|
friend |
Read hash collection from input.
in | reader |
object | hash collection |
Definition at line 291 of file JHashCollection.hh.
|
friend |
Write hash collection to output.
out | writer |
object | hash collection |
Definition at line 312 of file JHashCollection.hh.
JEvaluator_t JTOOLS::JHashCollection< JElement_t, JEvaluator_t >::getValue |
Function object for evaluation of element.
Definition at line 329 of file JHashCollection.hh.
|
protected |
Definition at line 345 of file JHashCollection.hh.