CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AlgoCheck.h
Go to the documentation of this file.
1 #ifndef ExprAlgo_AlgoCheck_h
2 #define ExprAlgo_AlgoCheck_h
3 
4 #include <string>
5 #include <map>
7 
8 
10 class AlgoCheck
11 {
12 public:
14  AlgoCheck() { }
15 
16  virtual ~AlgoCheck() { }
17 
19  struct ConstraintE {
20  ConstraintE() { } // for STL conformance
21  ConstraintE(int minOccurs,
22  int maxOccurs,
23  double min,
24  double max,
25  bool use,
26  bool deflt,
27  double defltVal
28  )
29  : minOccurs_(minOccurs), maxOccurs_(maxOccurs), use_(use),
30  default_(deflt), min_(min), max_(max), defaultVal_(defltVal) { }
32  bool use_, default_; // use==true==required, default==true==default-val-specified
33  double min_, max_, defaultVal_;
34  };
35 
37  struct ConstraintS {
38  ConstraintS() { } // for STL conformance
39  ConstraintS(int minOccurs,
40  int maxOccurs,
41  bool use,
42  bool deflt,
43  std::string defltVal
44  )
45  : minOccurs_(minOccurs), maxOccurs_(maxOccurs), use_(use), default_(deflt),
46  defaultVal_(defltVal)
47  { }
49  bool use_, default_;
51  };
52 
54  bool check(parS_type & ps, parE_type & pe, std::string & err);
55 
56  typedef std::map<std::string,ConstraintE> constraintsE_type;
57  typedef std::map<std::string,ConstraintS> constraintsS_type;
58 
59 protected:
60  bool checkBounds(parE_type::iterator pit, // current parameter to be checked
61  constraintsE_type::iterator cit, // corresponding constraints
62  std::string & err // error std::string
63  );
64  bool checkStrings(parS_type::iterator sit, // current parameter to be checked
65  constraintsS_type::iterator cit, // corresponding constraints
66  std::string & err // error std::string
67  );
68 
70  static std::string d2s(double x);
71 
74 
77 };
78 
79 #endif
virtual ~AlgoCheck()
Definition: AlgoCheck.h:16
base class for generated checking code for algorithm parameters.
Definition: AlgoCheck.h:10
bool checkBounds(parE_type::iterator pit, constraintsE_type::iterator cit, std::string &err)
Definition: AlgoCheck.cc:78
std::string defaultVal_
Definition: AlgoCheck.h:50
ConstraintS(int minOccurs, int maxOccurs, bool use, bool deflt, std::string defltVal)
Definition: AlgoCheck.h:39
static std::string d2s(double x)
ahh, converts a double into a std::string ... yet another one of this kind!
Definition: AlgoCheck.cc:139
std::map< std::string, std::vector< std::string > > parS_type
Definition: DDAlgoPar.h:9
constraints as defined for algorithm-parameters in the XML schema Algorithm.xsd, strings ...
Definition: AlgoCheck.h:37
bool check(parS_type &ps, parE_type &pe, std::string &err)
returns true if the check was successfull (parameters conform to XML specification) ...
Definition: AlgoCheck.cc:5
constraints as defined for algorithm-parameters in the XML schema Algorithm.xsd, expressions ...
Definition: AlgoCheck.h:19
ConstraintE(int minOccurs, int maxOccurs, double min, double max, bool use, bool deflt, double defltVal)
Definition: AlgoCheck.h:21
const T & max(const T &a, const T &b)
std::map< std::string, ConstraintS > constraintsS_type
Definition: AlgoCheck.h:57
constraintsS_type constraintsS_
format: &quot;ParameterName&quot; -&gt; ConstraintS
Definition: AlgoCheck.h:76
std::map< std::string, ConstraintE > constraintsE_type
Definition: AlgoCheck.h:56
std::map< std::string, std::vector< double > > parE_type
Definition: DDAlgoPar.h:12
constraintsE_type constraintsE_
format: &quot;ParameterName&quot; -&gt; ConstraintE
Definition: AlgoCheck.h:73
Definition: DDAxes.h:10
bool checkStrings(parS_type::iterator sit, constraintsS_type::iterator cit, std::string &err)
Definition: AlgoCheck.cc:149
AlgoCheck()
the ctor of the derived class has to fill the members constraintsE_,S_
Definition: AlgoCheck.h:14