Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JMapList.hh
Go to the documentation of this file.
1 #ifndef __JTOOLS__JMAPLIST__
2 #define __JTOOLS__JMAPLIST__
3 
4 #include "JLang/JNullType.hh"
5 #include "JTools/JDistance.hh"
6 
7 
8 /**
9  * \author mdejong
10  */
11 
12 namespace JTOOLS {}
13 namespace JPP { using namespace JTOOLS; }
14 
15 namespace JTOOLS {
16 
17  using JLANG::JNullType;
18 
19 
20  /**
21  * Map list.
22  */
23  template<template<class, class, class> class JHead_t, class JTail_t = JNullType>
24  struct JMapList
25  {
27  typedef typename JTail_t::tail_type tail_type; //!< last map
28  };
29 
30 
31  /**
32  * Terminator class of map list.
33  */
34  template<template<class, class, class> class JHead_t>
35  struct JMapList<JHead_t, JNullType>
36  {
37  typedef JNullType head_list; //!< first N-1 maps
38  typedef JMapList<JHead_t> tail_type; //!< last map
39  };
40 
41 
42  /**
43  * Length of map list.
44  */
45  template<class JMaplist_t> struct JMapLength {};
46 
47 
48  /**
49  * Recursive length of map list.
50  */
51  template<template<class, class, class> class JHead_t, class JTail_t>
52  struct JMapLength< JMapList<JHead_t, JTail_t> >
53  {
54  enum { value = 1 + JMapLength<JTail_t>::value };
55  };
56 
57 
58  /**
59  * Terminator class of length of map list.
60  */
61  template<template<class, class, class> class JHead_t>
62  struct JMapLength< JMapList<JHead_t, JNullType> >
63  {
64  enum { value = 1 };
65  };
66 
67 
68  /**
69  * Auxiliary class for no map definition.
70  * This class can be used to terminate a map list, define a default template argument, etc.
71  */
72  template<class JKey_t,
73  class JValue_t,
74  class JDistance_t = JDistance<JKey_t> >
75  struct JNullMap {};
76 
77 
78  /**
79  * Auxiliary class for recursive map list generation.
80  * This class accepts up to 26 map types.
81  */
82  template<template<class, class, class> class A = JNullMap,
83  template<class, class, class> class B = JNullMap,
84  template<class, class, class> class C = JNullMap,
85  template<class, class, class> class D = JNullMap,
86  template<class, class, class> class E = JNullMap,
87  template<class, class, class> class F = JNullMap,
88  template<class, class, class> class G = JNullMap,
89  template<class, class, class> class H = JNullMap,
90  template<class, class, class> class I = JNullMap,
91  template<class, class, class> class J = JNullMap,
92  template<class, class, class> class K = JNullMap,
93  template<class, class, class> class L = JNullMap,
94  template<class, class, class> class M = JNullMap,
95  template<class, class, class> class N = JNullMap,
96  template<class, class, class> class O = JNullMap,
97  template<class, class, class> class P = JNullMap,
98  template<class, class, class> class Q = JNullMap,
99  template<class, class, class> class R = JNullMap,
100  template<class, class, class> class S = JNullMap,
101  template<class, class, class> class T = JNullMap,
102  template<class, class, class> class U = JNullMap,
103  template<class, class, class> class V = JNullMap,
104  template<class, class, class> class W = JNullMap,
105  template<class, class, class> class X = JNullMap,
106  template<class, class, class> class Y = JNullMap,
107  template<class, class, class> class Z = JNullMap>
108  struct JMAPLIST
109  {
111  };
112 
113 
114  /**
115  * Template specialisation to terminate recursive map list generation.
116  */
117  template<template<class, class, class> class A>
118  struct JMAPLIST<A,
119  JNullMap,
120  JNullMap,
121  JNullMap,
122  JNullMap,
123  JNullMap,
124  JNullMap,
125  JNullMap,
126  JNullMap,
127  JNullMap,
128  JNullMap,
129  JNullMap,
130  JNullMap,
131  JNullMap,
132  JNullMap,
133  JNullMap,
134  JNullMap,
135  JNullMap,
136  JNullMap,
137  JNullMap,
138  JNullMap,
139  JNullMap,
140  JNullMap,
141  JNullMap,
142  JNullMap,
143  JNullMap>
144  {
145  typedef JMapList<A> maplist; //!< Map list
146  };
147 }
148 
149 #endif
do echo Generating $dir eval D
Definition: JDrawLED.sh:50
Q(UTCMax_s-UTCMin_s)-livetime_s
static const uint32_t K[64]
Definition: crypt.cc:77
do $JPP JMEstimator M
Definition: JMEstimator.sh:37
JMapList< JHead_t, typename JTail_t::head_list > head_list
first N-1 maps
Definition: JMapList.hh:26
Template class for distance evaluation.
Definition: JDistance.hh:24
Length of map list.
Definition: JMapList.hh:45
static const double H
Planck constant [eV s].
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
static const double C
Physics constants.
Map list.
Definition: JMapList.hh:24
Auxiliary class for no map definition.
Definition: JMapList.hh:75
do set_variable OUTPUT_DIRECTORY $WORKDIR T
JNullType head_list
first N-1 maps
Definition: JMapList.hh:37
Auxiliary class for no type definition.
Definition: JNullType.hh:19
then break fi done getCenter read X Y Z let X
then awk F
Auxiliary class for recursive map list generation.
Definition: JMapList.hh:108
JTail_t::tail_type tail_type
last map
Definition: JMapList.hh:27
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR set_variable NORTH set_variable EAST set_variable SOUTH set_variable WEST set_variable WORKDIR tmp set_variable R set_variable CT set_variable YMAX set_variable YMIN if do_usage *then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:35
do set_variable SIGMA_NS set_variable OUTLIERS set_variable OUTPUT_FILE matrix[${ALPHA_DEG}\deg\] root $JPP JMatrixNZ a $DETECTOR f $INPUT_FILE o $OUTPUT_FILE S
Definition: JMatrixNZ.sh:56
JMapList< A, typename JMAPLIST< B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z >::maplist > maplist
Map list.
Definition: JMapList.hh:110
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:35
JMapList< JHead_t > tail_type
last map
Definition: JMapList.hh:38
source $JPP_DIR setenv csh $JPP_DIR eval JShellParser o a A
then usage $script[input file[working directory[option]]] nWhere option can be E
Definition: JMuonPostfit.sh:35
then $DIR JPlotNPE PDG P
Definition: JPlotNPE-PDG.sh:60