Go to the documentation of this file. 1 #ifndef __JTOOLS__JHASHMAP__
2 #define __JTOOLS__JHASHMAP__
52 template<
class JKey_t,
class JValue_t,
class JEvaluator_t = JHashEvaluator>
68 typedef typename container_type::iterator
iterator;
131 JHashMap(
const JEvaluator_t& evaluator = JEvaluator_t()) :
145 for (
iterator i = this->begin(); i != this->end(); ++i) {
149 container_type::clear();
161 const int ival = this->
getValue(key);
167 return container_type::operator[](
router.get(ival)).second;
181 const int ival = this->
getValue(key);
184 return container_type::operator[](
router.get(ival)).second;
200 const int ival = this->
getValue(element.first);
204 iterator i = container_type::insert(lower_bound(this->begin(), this->end(), element.first,
compare), element);
208 for (
iterator __i = i; ++__i != this->end(); ) {
232 container_type::erase(i++);
234 for ( ; i != this->end(); ++i) {
254 container_type::erase(i++);
257 for ( ; i != this->end(); ++i) {
271 const int ival = this->
getValue(key);
279 iterator i = container_type::erase(pos);
281 for ( ; i != this->end(); ++i) {
332 for (
value_type element;
n != 0 && in >> element; --
n) {
333 object.insert(element);
351 int n =
object.size();
387 template<
class JHead_t,
class JTail_t,
class JValue_t,
class JEvaluator_t>
389 public JHashMap<JHead_t, JHashMap<JTail_t, JValue_t, JEvaluator_t>, JEvaluator_t>
407 using map_type::erase;
415 JHashMap(
const JEvaluator_t& evaluator = JEvaluator_t()) :
416 JHashMap<JHead_t,
JHashMap<JTail_t, JValue_t, JEvaluator_t>, JEvaluator_t>(evaluator)
420 class super_const_iterator;
426 class super_iterator :
474 virtual bool equals(
const super_iterator& cursor)
const
476 return i == cursor.i && (i == range.second || second.equals(cursor.second));
487 if (!second.increment()) {
489 while (++i != range.second) {
491 second = i->second.super_begin();
493 if (second != i->second.super_end()) {
499 return i != range.second;
521 return second.getValue();
534 range(__begin, __end)
536 for (i = range.first; i != range.second; ++i) {
538 second = i->second.super_begin();
540 if (second != i->second.super_end()) {
549 typename mapped_type::super_iterator
second;
556 class super_const_iterator :
582 range (cursor.range),
584 second(cursor.second)
616 virtual bool equals(
const super_const_iterator& cursor)
const
618 return i == cursor.i && (i == range.second || second.equals(cursor.second));
629 if (!second.increment()) {
631 while (++i != range.second) {
633 second = i->second.super_begin();
635 if (second != i->second.super_end()) {
641 return i != range.second;
663 return second.getValue();
676 range(__begin, __end)
678 for (i = range.first; i != range.second; ++i) {
680 second = i->second.super_begin();
682 if (second != i->second.super_end()) {
691 typename mapped_type::super_const_iterator
second;
702 return super_const_iterator(this->begin(), this->end());
713 return super_const_iterator(this->end(), this->end());
724 return super_iterator(this->begin(), this->end());
735 return super_iterator(this->end(), this->end());
808 template<
class JHead_t,
class JValue_t,
class JEvaluator_t>
810 public JHashMap<JHead_t, JValue_t, JEvaluator_t>
831 JHashMap(
const JEvaluator_t& evaluator = JEvaluator_t()) :
832 JHashMap<JHead_t, JValue_t, JEvaluator_t>(evaluator)
836 class super_const_iterator;
842 class super_iterator :
890 virtual bool equals(
const super_iterator& cursor)
const
892 return i == cursor.i;
903 return ++i != range.second;
937 range(__begin, __end),
950 class super_const_iterator :
1009 virtual bool equals(
const super_const_iterator& cursor)
const
1011 return i == cursor.i;
1022 return ++i != range.second;
1056 range(__begin, __end),
1073 return super_const_iterator(this->begin(), this->end());
1084 return super_const_iterator(this->end(), this->end());
1095 return super_iterator(this->begin(), this->end());
1106 return super_iterator(this->end(), this->end());
Interface for binary input.
Exception for accessing an index in a collection that is outside of its range.
The template JSinglePointer class can be used to hold a pointer to an object.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
Template definition of auxiliary base class for comparison of data structures.
Auxiliary class for no type definition.
JArgument< T >::argument_type argument_type
Auxiliary class for recursive type list generation.
Template for generic class types.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Template interface for method bool increment().
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Interface for binary output.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Auxiliary classes and methods for binary I/O.
T get(const JHead &header)
Get object from header.