Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JMultiMap.hh
Go to the documentation of this file.
1#ifndef __JTOOLS__JMULTIMAP__
2#define __JTOOLS__JMULTIMAP__
3
4#include "JLang/JEquals.hh"
6
7#include "JMath/JMath.hh"
8
9#include "JTools/JDistance.hh"
10#include "JTools/JPair.hh"
11#include "JTools/JMultiPair.hh"
12#include "JTools/JMapList.hh"
14#include "JTools/JMultiKey.hh"
15
16
17/**
18 * \file
19 *
20 * General purpose multidimensional map based on a type list of maps.
21 * \author mdejong
22 */
23namespace JTOOLS {}
24namespace JPP { using namespace JTOOLS; }
25
26namespace JTOOLS {
27
28 using JMATH::JMath;
29 using JLANG::JEquals;
31
32
33 /**
34 * Multidimensional map.
35 *
36 * The first template parameter refers to the data type of the (multidimensional) key;
37 * the second to the data type of the overall mapped value;
38 * the third to the list of maps used; and
39 * the fourth to the distance operator.
40 *
41 * In addition to the standard STL iterators,
42 * there are super iteretors for linear access to the multidimensional map.\n
43 * The access from a super iterator to the actual elements in the multidimensional map
44 * is handled via the usual dereference and pointer operators.\n
45 * The multidimensional key (see JTOOLS::JMultiKey) and value can directly be obtained
46 * via member methods <tt>%getKey()</tt> and <tt>%getValue()</tt>, respectively.
47 */
48 template<class JAbscissa_t,
49 class JOrdinate_t,
50 class JMaplist_t,
51 class JDistance_t = JDistance<JAbscissa_t> >
52 class JMultiMap;
53
54
55 /**
56 * Template specialisation of JMultiMap for map list with at least one map.
57 */
58 template<class JAbscissa_t,
59 class JOrdinate_t,
60 template<class, class, class> class JHead_t,
61 class JTail_t,
62 class JDistance_t>
63 class JMultiMap<JAbscissa_t, JOrdinate_t, JMapList<JHead_t, JTail_t>, JDistance_t> :
64 public JHead_t<JAbscissa_t, JMultiMap<JAbscissa_t, JOrdinate_t, JTail_t, JDistance_t>, JDistance_t>,
65 public JMath< JMultiMap<JAbscissa_t, JOrdinate_t, JMapList<JHead_t, JTail_t>, JDistance_t> >
66 {
67 public:
68
69 enum { NUMBER_OF_DIMENSIONS = JMapLength< JMapList<JHead_t, JTail_t> >::value };
70
71 typedef JHead_t<JAbscissa_t,
73 JDistance_t> map_type;
74
75 typedef JAbscissa_t abscissa_type;
76 typedef JOrdinate_t ordinate_type;
77
78 typedef typename map_type::key_type key_type;
79 typedef typename map_type::mapped_type mapped_type;
80 typedef typename map_type::value_type value_type;
81
82 typedef typename map_type::const_iterator const_iterator;
83 typedef typename map_type::const_reverse_iterator const_reverse_iterator;
84 typedef typename map_type::iterator iterator;
85 typedef typename map_type::reverse_iterator reverse_iterator;
86
87 using map_type::insert;
88 using map_type::configure;
89 using map_type::get;
90
91
92 /**
93 * Default constructor.
94 */
96 {}
97
98
99 /**
100 * Add map.
101 *
102 * \param map multimap
103 * \return this multimap
104 */
106 {
107 static_cast<map_type&>(*this).add(static_cast<const map_type&>(map));
108
109 return *this;
110 }
111
112
113 /**
114 * Subtract map.
115 *
116 * \param map multimap
117 * \return this multimap
118 */
120 {
121 static_cast<map_type&>(*this).sub(static_cast<const map_type&>(map));
122
123 return *this;
124 }
125
126
127 /**
128 * Scale contents.
129 *
130 * \param value multiplication factor
131 * \return this multimap
132 */
133 JMultiMap& mul(const double value)
134 {
135 static_cast<map_type&>(*this).mul(value);
136
137 return *this;
138 }
139
140 /**
141 * Scale contents.
142 *
143 * \param value division factor
144 * \return this multimap
145 */
146 JMultiMap& div(const double value)
147 {
148 static_cast<map_type&>(*this).div(value);
149
150 return *this;
151 }
152
153
154 /**
155 * Function application to each element of this multimap.
156 *
157 * \param function function
158 */
159 template<class JFunction_t>
160 void for_each(const JFunction_t& function)
161 {
162 function(*this);
163
164 for (iterator i = this->begin(); i != this->end(); ++i) {
165 i->getY().for_each(function);
166 }
167 }
168
169
170 /**
171 * Configure multidimensional map.
172 *
173 * \param bounds multidimensional bounds
174 */
179
180
181 /**
182 * Configure multidimensional map.
183 *
184 * \param key multidimensional key
185 * \param bounds multidimensional bounds
186 */
187 template<unsigned int N, unsigned int M>
189 {
190 this->configure(bounds(key));
191
192 for (iterator i = this->begin(); i != this->end(); ++i) {
193 i->getY().configure(JMultiKey<M+1, abscissa_type>(key,i->getX()), bounds);
194 }
195 }
196
197 private:
198
199 /**
200 * Base class for multidimensional iterator.
201 */
202 template<class first_iterator, class second_iterator>
204 public JEquals< iterator_base<first_iterator, second_iterator> >
205 {
207 typedef typename second_iterator::value_type value_type;
208 typedef JMultiKey <NUMBER_OF_DIMENSIONS, const abscissa_type> multikey_type;
210
211
212 /**
213 * Auxiliary class for smart pointer.
214 */
216 private JPair<const key_type, second_iterator>
217 {
218 /**
219 * Constructor.
220 *
221 * \param key key
222 * \param value value
223 */
224 pointer_type(const key_type key, second_iterator value) :
225 JPair<const key_type, second_iterator>(key, value)
226 {}
227
228
229 /**
230 * Smart pointer operator.
231 *
232 * \return pointer to object
233 */
235 {
236 return this;
237 }
238 };
239
240
241 /**
242 * Smart pointer operator.
243 *
244 * \return pointer to pair of iterators
245 */
247 {
248 return pointer_type(i->getX(), second);
249 }
250
251
252 /**
253 * Dereference operator.
254 *
255 * \return multidimensional pair
256 */
258 {
259 return multipair_type(i->getX(), *second);
260 }
261
262
263 /**
264 * Equality of super iterator.
265 *
266 * \param cursor super iterator
267 * \return true if equal; else false
268 */
269 bool equals(const iterator_base& cursor) const
270 {
271 return i == cursor.i && (i == range.second || second.equals(cursor.second));
272 }
273
274
275 /**
276 * Get multidimensional key.
277 *
278 * \return key
279 */
281 {
282 return multikey_type(i->getX(), second.getKey());
283 }
284
285
286 /**
287 * Get value.
288 *
289 * \return value
290 */
292 {
293 return this->second.getValue();
294 }
295
296
297 protected:
299 first_iterator i;
300 second_iterator second;
301 };
302
303
304 /**
305 * Helper class for multidimensional iterator.
306 */
307 template<class first_iterator, class second_iterator>
309 public iterator_base<first_iterator, second_iterator>,
310 public JForwardIterator< iterator_helper<first_iterator, second_iterator> >
311 {
312 /**
313 * Default constructor.
314 */
317
318
319 /**
320 * Constructor.
321 *
322 * \param __begin begin of data
323 * \param __end end of data
324 */
325 iterator_helper(first_iterator __begin,
326 first_iterator __end)
327 {
328 this->range = std::make_pair(__begin, __end);
329
330 for (this->i = this->range.first; this->i != this->range.second; ++(this->i)) {
331
332 this->second = this->i->getY().super_begin();
333
334 if (this->second != this->i->getY().super_end()) {
335 break;
336 }
337 }
338 }
339
340
341 /**
342 * Increment super iterator.
343 *
344 * \return true if valid; else false
345 */
346 virtual bool increment() override
347 {
348 if (!this->second.increment()) {
349
350 while (++(this->i) != this->range.second) {
351
352 this->second = this->i->getY().super_begin();
353
354 if (this->second != this->i->getY().super_end()) {
355 break;
356 }
357 }
358 }
359
360 return this->i != this->range.second;
361 }
362 };
363
364
365 /**
366 * Helper class for multidimensional reverse iterator.
367 */
368 template<class first_iterator, class second_iterator>
370 public iterator_base<first_iterator, second_iterator>,
371 public JForwardIterator< reverse_iterator_helper<first_iterator, second_iterator> >
372 {
373 /**
374 * Default constructor.
375 */
378
379
380 /**
381 * Constructor.
382 *
383 * \param __begin begin of data
384 * \param __end end of data
385 */
386 reverse_iterator_helper(first_iterator __begin,
387 first_iterator __end)
388 {
389 this->range = std::make_pair(__begin, __end);
390
391 for (this->i = this->range.first; this->i != this->range.second; ++(this->i)) {
392
393 this->second = this->i->getY().super_rbegin();
394
395 if (this->second != this->i->getY().super_rend()) {
396 break;
397 }
398 }
399 }
400
401
402 /**
403 * Increment super iterator.
404 *
405 * \return true if valid; else false
406 */
407 virtual bool increment() override
408 {
409 if (!this->second.increment()) {
410
411 while (++(this->i) != this->range.second) {
412
413 this->second = this->i->getY().super_rbegin();
414
415 if (this->second != this->i->getY().super_rend()) {
416 break;
417 }
418 }
419 }
420
421 return this->i != this->range.second;
422 }
423 };
424
425 public:
426
427 class super_const_iterator; // forward declaration
428
429
430 /**
431 * Multidimensional iterator.
432 */
434 public iterator_helper<iterator, typename mapped_type::super_iterator>
435 {
436 public:
437 friend class JMultiMap;
439
440 /**
441 * Default constructor.
442 */
445
446 private:
447 /**
448 * Constructor.
449 *
450 * \param __begin begin of data
451 * \param __end end of data
452 */
454 iterator __end) :
455 iterator_helper<iterator, typename mapped_type::super_iterator>(__begin, __end)
456 {}
457 };
458
459
460 /**
461 * Multidimensional const_iterator.
462 */
464 public iterator_helper<const_iterator, typename mapped_type::super_const_iterator>,
465 public JEquals<super_const_iterator, super_iterator>
466 {
467 public:
468 friend class JMultiMap;
469
470 /**
471 * Default constructor.
472 */
475
476
477 /**
478 * Copy constructor.
479 *
480 * \param cursor super iterator
481 */
483 {
484 this->range = cursor.range;
485 this->i = cursor.i;
486 this->second = cursor.second;
487 }
488
489
490 /**
491 * Equality of super iterator.
492 *
493 * \param cursor super iterator
494 * \return true if equal; else false
495 */
496 bool equals(const super_const_iterator& cursor) const
497 {
499 }
500
501
502 /**
503 * Equality of super iterator.
504 *
505 * \param cursor super iterator
506 * \return true if equal; else false
507 */
508 bool equals(const super_iterator& cursor) const
509 {
510 return equals(super_const_iterator(cursor));
511 }
512
513 private:
514 /**
515 * Constructor.
516 *
517 * \param __begin begin of data
518 * \param __end end of data
519 */
524 };
525
526
527 class super_const_reverse_iterator; // forward declaration
528
529
530 /**
531 * Multidimensional reverse iterator.
532 */
534 public reverse_iterator_helper<reverse_iterator, typename mapped_type::super_reverse_iterator>
535 {
536 public:
537 friend class JMultiMap;
539
540 /**
541 * Default constructor.
542 */
545
546 private:
547 /**
548 * Constructor.
549 *
550 * \param __begin reverse begin of data
551 * \param __end reverse end of data
552 */
557 };
558
559
560 /**
561 * Multidimensional const reverse iterator.
562 */
564 public reverse_iterator_helper<const_reverse_iterator, typename mapped_type::super_const_reverse_iterator>,
565 public JEquals<super_const_reverse_iterator, super_reverse_iterator>
566 {
567 public:
568 friend class JMultiMap;
569
570 /**
571 * Default constructor.
572 */
575
576
577 /**
578 * Copy constructor.
579 *
580 * \param cursor super reverse iterator
581 */
583 {
584 this->range = cursor.range;
585 this->i = cursor.i;
586 this->second = cursor.second;
587 }
588
589
590 /**
591 * Equality of super reverse iterator.
592 *
593 * \param cursor super reverse iterator
594 * \return true if equal; else false
595 */
596 bool equals(const super_const_reverse_iterator& cursor) const
597 {
599 }
600
601
602 /**
603 * Equality of super reverse iterator.
604 *
605 * \param cursor super reverse iterator
606 * \return true if equal; else false
607 */
608 bool equals(const super_reverse_iterator& cursor) const
609 {
610 return equals(super_const_reverse_iterator(cursor));
611 }
612
613 private:
614 /**
615 * Constructor.
616 *
617 * \param __begin begin of data
618 * \param __end end of data
619 */
624 };
625
626
627 /**
628 * Get super iterator to begin of data.
629 *
630 * \return super iterator
631 */
633 {
634 return super_const_iterator(this->begin(), this->end());
635 }
636
637
638 /**
639 * Get super iterator to reverse begin of data
640 *
641 * \return super reverse iterator
642 */
644 {
645 return super_const_reverse_iterator(this->rbegin(), this->rend());
646 }
647
648
649 /**
650 * Get super iterator to end of data.
651 *
652 * \return super iterator
653 */
655 {
656 return super_const_iterator(this->end(), this->end());
657 }
658
659
660 /**
661 * Get super iterator to reverse end of data.
662 *
663 * \return super reverse iterator
664 */
666 {
667 return super_const_reverse_iterator(this->rend(), this->rend());
668 }
669
670
671 /**
672 * Get super iterator to begin of data.
673 *
674 * \return super iterator
675 */
677 {
678 return super_iterator(this->begin(), this->end());
679 }
680
681
682 /**
683 * Get super iterator to reverse begin of data.
684 *
685 * \return super iterator
686 */
688 {
689 return super_reverse_iterator(this->rbegin(), this->rend());
690 }
691
692
693 /**
694 * Get super iterator to end of data.
695 *
696 * \return super iterator
697 */
699 {
700 return super_iterator(this->end(), this->end());
701 }
702
703
704 /**
705 * Get super iterator to reverse end of data.
706 *
707 * \return super iterator
708 */
710 {
711 return super_reverse_iterator(this->rend(), this->rend());
712 }
713
714
715 /**
716 * Get value.
717 *
718 * \param key multidimensional key
719 * \return value
720 */
722 {
723 return this->get(key.first).get(key.second);
724 }
725
726
727 /**
728 * Get value.
729 *
730 * \param key multidimensional key
731 * \return value
732 */
734 {
735 return this->get(key.first).get(key.second);
736 }
737
738
739 /**
740 * Insert element.
741 *
742 * \param key multidimensional key
743 * \param value value
744 */
746 {
747 (*this)[key.first].insert(key.second, value);
748 }
749
750
751 /**
752 * Insert element.
753 *
754 * \param value multidimensional pair
755 */
757 {
758 (*this)[value.first].insert(value.second);
759 }
760 };
761
762
763 /**
764 * Terminator class of recursive JMultiMap class.
765 */
766 template<class JAbscissa_t,
767 class JOrdinate_t,
768 template<class, class, class> class JHead_t,
769 class JDistance_t>
770 class JMultiMap<JAbscissa_t, JOrdinate_t, JMapList<JHead_t, JLANG::JNullType>, JDistance_t> :
771 public JHead_t<JAbscissa_t, JOrdinate_t, JDistance_t>,
772 public JMath< JMultiMap<JAbscissa_t, JOrdinate_t, JMapList<JHead_t, JLANG::JNullType>, JDistance_t> >
773 {
774 public:
775
776 enum { NUMBER_OF_DIMENSIONS = 1 };
777
778 typedef JHead_t<JAbscissa_t, JOrdinate_t, JDistance_t> map_type;
779
780 typedef JAbscissa_t abscissa_type;
781 typedef JOrdinate_t ordinate_type;
782
783 typedef typename map_type::key_type key_type;
784 typedef typename map_type::mapped_type mapped_type;
785 typedef typename map_type::value_type value_type;
786
787 typedef typename map_type::const_iterator const_iterator;
788 typedef typename map_type::const_reverse_iterator const_reverse_iterator;
789 typedef typename map_type::iterator iterator;
790 typedef typename map_type::reverse_iterator reverse_iterator;
791
792 using map_type::insert;
793 using map_type::configure;
794 using map_type::get;
795
796
797 /**
798 * Default constructor.
799 */
801 {}
802
803
804 /**
805 * Add map.
806 *
807 * \param map multimap
808 * \return this multimap
809 */
811 {
812 static_cast<map_type&>(*this).add(static_cast<const map_type&>(map));
813
814 return *this;
815 }
816
817
818 /**
819 * Subtract map.
820 *
821 * \param map multimap
822 * \return this multimap
823 */
825 {
826 static_cast<map_type&>(*this).sub(static_cast<const map_type&>(map));
827
828 return *this;
829 }
830
831
832 /**
833 * Scale contents.
834 *
835 * \param value multiplication factor
836 * \return this multimap
837 */
838 JMultiMap& mul(const double value)
839 {
840 static_cast<map_type&>(*this).mul(value);
841
842 return *this;
843 }
844
845 /**
846 * Scale contents.
847 *
848 * \param value division factor
849 * \return this multimap
850 */
851 JMultiMap& div(const double value)
852 {
853 static_cast<map_type&>(*this).div(value);
854
855 return *this;
856 }
857
858
859 /**
860 * Termination of function application.
861 *
862 * \param function function
863 */
864 template<class JFunction_t>
865 void for_each(const JFunction_t& function)
866 {
867 function(*this);
868 }
869
870
871 /**
872 * Configure multidimensional map.
873 *
874 * \param bounds multidimensional bounds
875 */
880
881
882 /**
883 * Configure multidimensional map.
884 *
885 * \param key multidimensional key
886 * \param bounds multidimensional bounds
887 */
888 template<unsigned int N, unsigned int M>
890 {
891 this->configure(bounds(key));
892 }
893
894 private:
895
896 /**
897 * Helper class for multidimensional iterator.
898 */
899 template<class iterator_type, class ordinate_type>
901 public JEquals < iterator_helper<iterator_type, ordinate_type> >,
902 public JForwardIterator< iterator_helper<iterator_type, ordinate_type> >
903 {
906 typedef JMultiKey <NUMBER_OF_DIMENSIONS, const abscissa_type> multikey_type;
908
909
910 /**
911 * Auxiliary class for pair via smart pointer.
912 */
914 private JPair<const key_type, value_type>
915 {
916 /**
917 * Constructor.
918 *
919 * \param key key
920 * \param value value
921 */
922 pointer_type(const key_type key, value_type value) :
923 JPair<const key_type, value_type>(key, value)
924 {}
925
926
927 /**
928 * Smart pointer operator.
929 *
930 * \return pointer to object
931 */
933 {
934 return this;
935 }
936 };
937
938
939 /**
940 * Default constructor.
941 */
944
945
946 /**
947 * Constructor.
948 *
949 * \param __begin begin of data
950 * \param __end end of data
951 */
952 iterator_helper(iterator_type __begin,
953 iterator_type __end) :
954 range(__begin, __end),
955 i(__begin)
956 {}
957
958
959 /**
960 * Smart pointer operator.
961 *
962 * \return pointer to pair of iterators
963 */
965 {
966 return pointer_type(i->getX(), i->getY());
967 }
968
969
970 /**
971 * Dereference operator.
972 *
973 * \return multidimensional pair
974 */
976 {
977 return multipair_type(i->getX(), i->getY());
978 }
979
980
981 /**
982 * Equality of super iterator.
983 *
984 * \param cursor super iterator
985 * \return true if equal; else false
986 */
987 bool equals(const iterator_helper& cursor) const
988 {
989 return i == cursor.i;
990 }
991
992
993 /**
994 * Increment super iterator.
995 *
996 * \return true if valid; else false
997 */
998 virtual bool increment() override
999 {
1000 return ++i != range.second;
1001 }
1002
1003
1004 /**
1005 * Get multidimensional key.
1006 *
1007 * \return key
1008 */
1010 {
1011 return multikey_type(i->getX());
1012 }
1013
1014
1015 /**
1016 * Get value.
1017 *
1018 * \return value
1019 */
1021 {
1022 return i->getY();
1023 }
1024
1025
1027 iterator_type i;
1028 };
1029
1030 public:
1031
1032 class super_const_iterator; // forward declaration
1033
1034
1035 /**
1036 * Terminator class of multidimensional iterator.
1037 */
1039 public iterator_helper<iterator, ordinate_type&>
1040 {
1041 public:
1042 friend class JMultiMap;
1044
1045 /**
1046 * Default constructor.
1047 */
1050
1051 private:
1052 /**
1053 * Constructor.
1054 *
1055 * \param __begin begin of data
1056 * \param __end end of data
1057 */
1059 iterator __end) :
1060 iterator_helper<iterator, ordinate_type&>(__begin, __end)
1061 {}
1062 };
1063
1064
1065 /**
1066 * Terminator class of multidimensional const_iterator.
1067 */
1069 public iterator_helper<const_iterator, const ordinate_type&>,
1070 public JEquals<super_const_iterator, super_iterator>
1071 {
1072 public:
1073 friend class JMultiMap;
1074
1075 /**
1076 * Default constructor.
1077 */
1080
1081
1082 /**
1083 * Copy constructor.
1084 *
1085 * \param cursor super iterator
1086 */
1088 {
1089 this->range = cursor.range;
1090 this->i = cursor.i;
1091 }
1092
1093
1094 /**
1095 * Equality of super iterator.
1096 *
1097 * \param cursor super iterator
1098 * \return true if equal; else false
1099 */
1100 bool equals(const super_const_iterator& cursor) const
1101 {
1102 return this->i == cursor.i;
1103 }
1104
1105
1106 /**
1107 * Equality of super iterator.
1108 *
1109 * \param cursor super iterator
1110 * \return true if equal; else false
1111 */
1112 bool equals(const super_iterator& cursor) const
1113 {
1114 return this->i == cursor.i;
1115 }
1116
1117 private:
1118 /**
1119 * Constructor.
1120 *
1121 * \param __begin begin of data
1122 * \param __end end of data
1123 */
1125 const_iterator __end) :
1126 iterator_helper<const_iterator, const ordinate_type&>(__begin, __end)
1127 {}
1128 };
1129
1130
1131 class super_const_reverse_iterator; // forward declaration
1132
1133
1134 /**
1135 * Terminator class of multidimensional reverse iterator.
1136 */
1138 public iterator_helper<reverse_iterator, ordinate_type&>
1139 {
1140 public:
1141 friend class JMultiMap;
1143
1144 /**
1145 * Default constructor.
1146 */
1149
1150 private:
1151 /**
1152 * Constructor.
1153 *
1154 * \param __begin begin of data
1155 * \param __end end of data
1156 */
1161 };
1162
1163
1164 /**
1165 * Terminator class of multidimensional const_iterator.
1166 */
1168 public iterator_helper<const_reverse_iterator, const ordinate_type&>,
1169 public JEquals<super_const_reverse_iterator, super_reverse_iterator>
1170 {
1171 public:
1172 friend class JMultiMap;
1173
1174 /**
1175 * Default constructor.
1176 */
1179
1180
1181 /**
1182 * Copy constructor.
1183 *
1184 * \param cursor super reverse iterator
1185 */
1187 {
1188 this->range = cursor.range;
1189 this->i = cursor.i;
1190 }
1191
1192
1193 /**
1194 * Equality of super reverse iterator.
1195 *
1196 * \param cursor super reverse iterator
1197 * \return true if equal; else false
1198 */
1199 bool equals(const super_const_reverse_iterator& cursor) const
1200 {
1201 return this->i == cursor.i;
1202 }
1203
1204
1205 /**
1206 * Equality of super reverse iterator.
1207 *
1208 * \param cursor super reverse iterator
1209 * \return true if equal; else false
1210 */
1211 bool equals(const super_reverse_iterator& cursor) const
1212 {
1213 return this->i == cursor.i;
1214 }
1215
1216 private:
1217 /**
1218 * Constructor.
1219 *
1220 * \param __begin begin of data
1221 * \param __end end of data
1222 */
1227 };
1228
1229
1230 /**
1231 * Get super iterator to begin of data.
1232 *
1233 * \return super iterator
1234 */
1236 {
1237 return super_const_iterator(this->begin(), this->end());
1238 }
1239
1240
1241 /**
1242 * Get super iterator to reverse begin of data.
1243 *
1244 * \return super reverse iterator
1245 */
1247 {
1248 return super_const_reverse_iterator(this->rbegin(), this->rend());
1249 }
1250
1251
1252 /**
1253 * Get super iterator to end of data.
1254 *
1255 * \return super iterator
1256 */
1258 {
1259 return super_const_iterator(this->end(), this->end());
1260 }
1261
1262
1263 /**
1264 * Get super iterator to reverse end of data.
1265 *
1266 * \return super reverse iterator
1267 */
1269 {
1270 return super_const_reverse_iterator(this->rend(), this->rend());
1271 }
1272
1273
1274 /**
1275 * Get super iterator to begin of data.
1276 *
1277 * \return super iterator
1278 */
1280 {
1281 return super_iterator(this->begin(), this->end());
1282 }
1283
1284
1285 /**
1286 * Get super iterator to reverse begin of data.
1287 *
1288 * \return super reverse iterator
1289 */
1291 {
1292 return super_reverse_iterator(this->rbegin(), this->rend());
1293 }
1294
1295
1296 /**
1297 * Get super iterator to end of data.
1298 *
1299 * \return super iterator
1300 */
1302 {
1303 return super_iterator(this->end(), this->end());
1304 }
1305
1306
1307 /**
1308 * Get super iterator to reverse end of data.
1309 *
1310 * \return super reverse iterator
1311 */
1313 {
1314 return super_reverse_iterator(this->rend(), this->rend());
1315 }
1316
1317
1318 /**
1319 * Get value.
1320 *
1321 * \param key multidimensional key
1322 * \return value
1323 */
1325 {
1326 return get(key.first);
1327 }
1328
1329
1330 /**
1331 * Get value.
1332 *
1333 * \param key multidimensional key
1334 * \return value
1335 */
1337 {
1338 return get(key.first);
1339 }
1340
1341
1342 /**
1343 * Insert element.
1344 *
1345 * \param key multidimensional key
1346 * \param value value
1347 */
1349 {
1350 insert(value_type(key.first, value));
1351 }
1352
1353
1354 /**
1355 * Insert element.
1356 *
1357 * \param value multidimensional pair
1358 */
1363 };
1364}
1365
1366#endif
Base class for data structures with artithmetic capabilities.
Template interface for method bool increment().
Multidimensional key.
Definition JMultiKey.hh:69
void configure(const JMultiKey< M, abscissa_type > &key, const JAbstractMultiMap< N, abscissa_type > &bounds)
Configure multidimensional map.
Definition JMultiMap.hh:889
void insert(const JMultiKey< NUMBER_OF_DIMENSIONS, const abscissa_type > &key, const ordinate_type &value)
Insert element.
void for_each(const JFunction_t &function)
Termination of function application.
Definition JMultiMap.hh:865
super_const_reverse_iterator super_rend() const
Get super iterator to reverse end of data.
super_const_reverse_iterator super_rbegin() const
Get super iterator to reverse begin of data.
super_const_iterator super_begin() const
Get super iterator to begin of data.
const ordinate_type & get(const JMultiKey< NUMBER_OF_DIMENSIONS, const abscissa_type > &key) const
Get value.
ordinate_type & get(const JMultiKey< NUMBER_OF_DIMENSIONS, const abscissa_type > &key)
Get value.
super_reverse_iterator super_rend()
Get super iterator to reverse end of data.
super_reverse_iterator super_rbegin()
Get super iterator to reverse begin of data.
void insert(const JMultiPair< NUMBER_OF_DIMENSIONS, const abscissa_type, const ordinate_type & > &value)
Insert element.
void configure(const JAbstractMultiMap< NUMBER_OF_DIMENSIONS, abscissa_type > &bounds)
Configure multidimensional map.
Definition JMultiMap.hh:876
bool equals(const super_const_reverse_iterator &cursor) const
Equality of super reverse iterator.
super_const_reverse_iterator(const_reverse_iterator __begin, const_reverse_iterator __end)
Constructor.
Definition JMultiMap.hh:620
bool equals(const super_reverse_iterator &cursor) const
Equality of super reverse iterator.
Definition JMultiMap.hh:608
bool equals(const super_const_reverse_iterator &cursor) const
Equality of super reverse iterator.
Definition JMultiMap.hh:596
bool equals(const super_const_iterator &cursor) const
Equality of super iterator.
Definition JMultiMap.hh:496
const ordinate_type & get(const JMultiKey< NUMBER_OF_DIMENSIONS, const abscissa_type > &key) const
Get value.
Definition JMultiMap.hh:733
super_const_iterator super_begin() const
Get super iterator to begin of data.
Definition JMultiMap.hh:632
super_const_reverse_iterator super_rbegin() const
Get super iterator to reverse begin of data.
Definition JMultiMap.hh:643
super_const_reverse_iterator super_rend() const
Get super iterator to reverse end of data.
Definition JMultiMap.hh:665
ordinate_type & get(const JMultiKey< NUMBER_OF_DIMENSIONS, const abscissa_type > &key)
Get value.
Definition JMultiMap.hh:721
super_const_iterator super_end() const
Get super iterator to end of data.
Definition JMultiMap.hh:654
void configure(const JMultiKey< M, abscissa_type > &key, const JAbstractMultiMap< N, abscissa_type > &bounds)
Configure multidimensional map.
Definition JMultiMap.hh:188
void configure(const JAbstractMultiMap< NUMBER_OF_DIMENSIONS, abscissa_type > &bounds)
Configure multidimensional map.
Definition JMultiMap.hh:175
void for_each(const JFunction_t &function)
Function application to each element of this multimap.
Definition JMultiMap.hh:160
JHead_t< JAbscissa_t, JMultiMap< JAbscissa_t, JOrdinate_t, JTail_t, JDistance_t >, JDistance_t > map_type
Definition JMultiMap.hh:73
super_reverse_iterator super_rbegin()
Get super iterator to reverse begin of data.
Definition JMultiMap.hh:687
void insert(const JMultiPair< NUMBER_OF_DIMENSIONS, const abscissa_type, const ordinate_type & > &value)
Insert element.
Definition JMultiMap.hh:756
super_reverse_iterator super_rend()
Get super iterator to reverse end of data.
Definition JMultiMap.hh:709
void insert(const JMultiKey< NUMBER_OF_DIMENSIONS, const abscissa_type > &key, const ordinate_type &value)
Insert element.
Definition JMultiMap.hh:745
Multidimensional map.
Definition JMultiMap.hh:52
Multidimensional pair.
Definition JMultiPair.hh:31
mapped_type second
Template specialisation for a pair of values.
Definition JPair.hh:29
const char * map
Definition elog.cc:87
Auxiliary classes and methods for language specific functionality.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for multi-dimensional interpolations and histograms.
void configure(const T &value, const JAbstractCollection< JAbscissa_t > &bounds, JBool< false > option)
Configuration of value.
Template definition of auxiliary base class for comparison of data structures.
Definition JEquals.hh:84
Auxiliary class for no type definition.
Definition JNullType.hh:19
Auxiliary base class for aritmetic operations of derived class types.
Definition JMath.hh:347
Abstract interface for abscissa values of a multidimensional map.
Template class for distance evaluation.
Definition JDistance.hh:24
Length of map list.
Definition JMapList.hh:45
Map list.
Definition JMapList.hh:25
const JPair< const key_type, second_iterator > * operator->() const
Smart pointer operator.
Definition JMultiMap.hh:234
JMultiPair< NUMBER_OF_DIMENSIONS, const abscissa_type, value_type > multipair_type
Definition JMultiMap.hh:209