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