Jpp test-rotations-new
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 * Insert element.
729 *
730 * \param key multidimensional key
731 * \param value value
732 */
734 {
735 (*this)[key.first].insert(key.second, value);
736 }
737
738
739 /**
740 * Insert element.
741 *
742 * \param value multidimensional pair
743 */
745 {
746 (*this)[value.first].insert(value.second);
747 }
748 };
749
750
751 /**
752 * Terminator class of recursive JMultiMap class.
753 */
754 template<class JAbscissa_t,
755 class JOrdinate_t,
756 template<class, class, class> class JHead_t,
757 class JDistance_t>
758 class JMultiMap<JAbscissa_t, JOrdinate_t, JMapList<JHead_t, JLANG::JNullType>, JDistance_t> :
759 public JHead_t<JAbscissa_t, JOrdinate_t, JDistance_t>,
760 public JMath< JMultiMap<JAbscissa_t, JOrdinate_t, JMapList<JHead_t, JLANG::JNullType>, JDistance_t> >
761 {
762 public:
763
764 enum { NUMBER_OF_DIMENSIONS = 1 };
765
766 typedef JHead_t<JAbscissa_t, JOrdinate_t, JDistance_t> map_type;
767
768 typedef JAbscissa_t abscissa_type;
769 typedef JOrdinate_t ordinate_type;
770
771 typedef typename map_type::key_type key_type;
772 typedef typename map_type::mapped_type mapped_type;
773 typedef typename map_type::value_type value_type;
774
775 typedef typename map_type::const_iterator const_iterator;
776 typedef typename map_type::const_reverse_iterator const_reverse_iterator;
777 typedef typename map_type::iterator iterator;
778 typedef typename map_type::reverse_iterator reverse_iterator;
779
780 using map_type::insert;
781 using map_type::configure;
782 using map_type::get;
783
784
785 /**
786 * Default constructor.
787 */
789 {}
790
791
792 /**
793 * Add map.
794 *
795 * \param map multimap
796 * \return this multimap
797 */
799 {
800 static_cast<map_type&>(*this).add(static_cast<const map_type&>(map));
801
802 return *this;
803 }
804
805
806 /**
807 * Subtract map.
808 *
809 * \param map multimap
810 * \return this multimap
811 */
813 {
814 static_cast<map_type&>(*this).sub(static_cast<const map_type&>(map));
815
816 return *this;
817 }
818
819
820 /**
821 * Scale contents.
822 *
823 * \param value multiplication factor
824 * \return this multimap
825 */
826 JMultiMap& mul(const double value)
827 {
828 static_cast<map_type&>(*this).mul(value);
829
830 return *this;
831 }
832
833 /**
834 * Scale contents.
835 *
836 * \param value division factor
837 * \return this multimap
838 */
839 JMultiMap& div(const double value)
840 {
841 static_cast<map_type&>(*this).div(value);
842
843 return *this;
844 }
845
846
847 /**
848 * Termination of function application.
849 *
850 * \param function function
851 */
852 template<class JFunction_t>
853 void for_each(const JFunction_t& function)
854 {
855 function(*this);
856 }
857
858
859 /**
860 * Configure multidimensional map.
861 *
862 * \param bounds multidimensional bounds
863 */
868
869
870 /**
871 * Configure multidimensional map.
872 *
873 * \param key multidimensional key
874 * \param bounds multidimensional bounds
875 */
876 template<unsigned int N, unsigned int M>
878 {
879 this->configure(bounds(key));
880 }
881
882 private:
883
884 /**
885 * Helper class for multidimensional iterator.
886 */
887 template<class iterator_type, class ordinate_type>
889 public JEquals < iterator_helper<iterator_type, ordinate_type> >,
890 public JForwardIterator< iterator_helper<iterator_type, ordinate_type> >
891 {
894 typedef JMultiKey <NUMBER_OF_DIMENSIONS, const abscissa_type> multikey_type;
896
897
898 /**
899 * Auxiliary class for pair via smart pointer.
900 */
902 private JPair<const key_type, value_type>
903 {
904 /**
905 * Constructor.
906 *
907 * \param key key
908 * \param value value
909 */
910 pointer_type(const key_type key, value_type value) :
911 JPair<const key_type, value_type>(key, value)
912 {}
913
914
915 /**
916 * Smart pointer operator.
917 *
918 * \return pointer to object
919 */
921 {
922 return this;
923 }
924 };
925
926
927 /**
928 * Default constructor.
929 */
932
933
934 /**
935 * Constructor.
936 *
937 * \param __begin begin of data
938 * \param __end end of data
939 */
940 iterator_helper(iterator_type __begin,
941 iterator_type __end) :
942 range(__begin, __end),
943 i(__begin)
944 {}
945
946
947 /**
948 * Smart pointer operator.
949 *
950 * \return pointer to pair of iterators
951 */
953 {
954 return pointer_type(i->getX(), i->getY());
955 }
956
957
958 /**
959 * Dereference operator.
960 *
961 * \return multidimensional pair
962 */
964 {
965 return multipair_type(i->getX(), i->getY());
966 }
967
968
969 /**
970 * Equality of super iterator.
971 *
972 * \param cursor super iterator
973 * \return true if equal; else false
974 */
975 bool equals(const iterator_helper& cursor) const
976 {
977 return i == cursor.i;
978 }
979
980
981 /**
982 * Increment super iterator.
983 *
984 * \return true if valid; else false
985 */
986 virtual bool increment() override
987 {
988 return ++i != range.second;
989 }
990
991
992 /**
993 * Get multidimensional key.
994 *
995 * \return key
996 */
998 {
999 return multikey_type(i->getX());
1000 }
1001
1002
1003 /**
1004 * Get value.
1005 *
1006 * \return value
1007 */
1009 {
1010 return i->getY();
1011 }
1012
1013
1015 iterator_type i;
1016 };
1017
1018 public:
1019
1020 class super_const_iterator; // forward declaration
1021
1022
1023 /**
1024 * Terminator class of multidimensional iterator.
1025 */
1027 public iterator_helper<iterator, ordinate_type&>
1028 {
1029 public:
1030 friend class JMultiMap;
1032
1033 /**
1034 * Default constructor.
1035 */
1038
1039 private:
1040 /**
1041 * Constructor.
1042 *
1043 * \param __begin begin of data
1044 * \param __end end of data
1045 */
1047 iterator __end) :
1048 iterator_helper<iterator, ordinate_type&>(__begin, __end)
1049 {}
1050 };
1051
1052
1053 /**
1054 * Terminator class of multidimensional const_iterator.
1055 */
1057 public iterator_helper<const_iterator, const ordinate_type&>,
1058 public JEquals<super_const_iterator, super_iterator>
1059 {
1060 public:
1061 friend class JMultiMap;
1062
1063 /**
1064 * Default constructor.
1065 */
1068
1069
1070 /**
1071 * Copy constructor.
1072 *
1073 * \param cursor super iterator
1074 */
1076 {
1077 this->range = cursor.range;
1078 this->i = cursor.i;
1079 }
1080
1081
1082 /**
1083 * Equality of super iterator.
1084 *
1085 * \param cursor super iterator
1086 * \return true if equal; else false
1087 */
1088 bool equals(const super_const_iterator& cursor) const
1089 {
1090 return 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_iterator& cursor) const
1101 {
1102 return this->i == cursor.i;
1103 }
1104
1105 private:
1106 /**
1107 * Constructor.
1108 *
1109 * \param __begin begin of data
1110 * \param __end end of data
1111 */
1113 const_iterator __end) :
1114 iterator_helper<const_iterator, const ordinate_type&>(__begin, __end)
1115 {}
1116 };
1117
1118
1119 class super_const_reverse_iterator; // forward declaration
1120
1121
1122 /**
1123 * Terminator class of multidimensional reverse iterator.
1124 */
1126 public iterator_helper<reverse_iterator, ordinate_type&>
1127 {
1128 public:
1129 friend class JMultiMap;
1131
1132 /**
1133 * Default constructor.
1134 */
1137
1138 private:
1139 /**
1140 * Constructor.
1141 *
1142 * \param __begin begin of data
1143 * \param __end end of data
1144 */
1149 };
1150
1151
1152 /**
1153 * Terminator class of multidimensional const_iterator.
1154 */
1156 public iterator_helper<const_reverse_iterator, const ordinate_type&>,
1157 public JEquals<super_const_reverse_iterator, super_reverse_iterator>
1158 {
1159 public:
1160 friend class JMultiMap;
1161
1162 /**
1163 * Default constructor.
1164 */
1167
1168
1169 /**
1170 * Copy constructor.
1171 *
1172 * \param cursor super reverse iterator
1173 */
1175 {
1176 this->range = cursor.range;
1177 this->i = cursor.i;
1178 }
1179
1180
1181 /**
1182 * Equality of super reverse iterator.
1183 *
1184 * \param cursor super reverse iterator
1185 * \return true if equal; else false
1186 */
1187 bool equals(const super_const_reverse_iterator& cursor) const
1188 {
1189 return 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_reverse_iterator& cursor) const
1200 {
1201 return this->i == cursor.i;
1202 }
1203
1204 private:
1205 /**
1206 * Constructor.
1207 *
1208 * \param __begin begin of data
1209 * \param __end end of data
1210 */
1215 };
1216
1217
1218 /**
1219 * Get super iterator to begin of data.
1220 *
1221 * \return super iterator
1222 */
1224 {
1225 return super_const_iterator(this->begin(), this->end());
1226 }
1227
1228
1229 /**
1230 * Get super iterator to reverse begin of data.
1231 *
1232 * \return super reverse iterator
1233 */
1235 {
1236 return super_const_reverse_iterator(this->rbegin(), this->rend());
1237 }
1238
1239
1240 /**
1241 * Get super iterator to end of data.
1242 *
1243 * \return super iterator
1244 */
1246 {
1247 return super_const_iterator(this->end(), this->end());
1248 }
1249
1250
1251 /**
1252 * Get super iterator to reverse end of data.
1253 *
1254 * \return super reverse iterator
1255 */
1257 {
1258 return super_const_reverse_iterator(this->rend(), this->rend());
1259 }
1260
1261
1262 /**
1263 * Get super iterator to begin of data.
1264 *
1265 * \return super iterator
1266 */
1268 {
1269 return super_iterator(this->begin(), this->end());
1270 }
1271
1272
1273 /**
1274 * Get super iterator to reverse begin of data.
1275 *
1276 * \return super reverse iterator
1277 */
1279 {
1280 return super_reverse_iterator(this->rbegin(), this->rend());
1281 }
1282
1283
1284 /**
1285 * Get super iterator to end of data.
1286 *
1287 * \return super iterator
1288 */
1290 {
1291 return super_iterator(this->end(), this->end());
1292 }
1293
1294
1295 /**
1296 * Get super iterator to reverse end of data.
1297 *
1298 * \return super reverse iterator
1299 */
1301 {
1302 return super_reverse_iterator(this->rend(), this->rend());
1303 }
1304
1305
1306 /**
1307 * Get value.
1308 *
1309 * \param key multidimensional key
1310 * \return value
1311 */
1313 {
1314 return get(key.first);
1315 }
1316
1317
1318 /**
1319 * Insert element.
1320 *
1321 * \param key multidimensional key
1322 * \param value value
1323 */
1325 {
1326 insert(value_type(key.first, value));
1327 }
1328
1329
1330 /**
1331 * Insert element.
1332 *
1333 * \param value multidimensional pair
1334 */
1339 };
1340}
1341
1342#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:877
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:853
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.
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:864
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
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:744
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:733
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