CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/DetectorDescription/ExprAlgo/interface/AlgoCheck.h

Go to the documentation of this file.
00001 #ifndef ExprAlgo_AlgoCheck_h
00002 #define ExprAlgo_AlgoCheck_h
00003 
00004 #include <string>
00005 #include <map>
00006 #include "DetectorDescription/Base/interface/DDAlgoPar.h"
00007 
00008 
00010 class AlgoCheck
00011 {
00012 public:
00014   AlgoCheck()  { }
00015   
00016   virtual ~AlgoCheck() { }
00017   
00019   struct ConstraintE {
00020    ConstraintE() { } // for STL conformance
00021    ConstraintE(int minOccurs,
00022                int maxOccurs,
00023                double min,
00024                double max,
00025                bool use,
00026                bool deflt,
00027                double defltVal
00028                )
00029    : minOccurs_(minOccurs), maxOccurs_(maxOccurs), use_(use),
00030      default_(deflt), min_(min), max_(max), defaultVal_(defltVal) { }           
00031    int minOccurs_, maxOccurs_;
00032    bool use_, default_; // use==true==required, default==true==default-val-specified
00033    double min_, max_, defaultVal_;             
00034   };
00035   
00037   struct ConstraintS {
00038    ConstraintS() { } // for STL conformance
00039    ConstraintS(int minOccurs,
00040                int maxOccurs,
00041                bool use,
00042                bool deflt,
00043                std::string defltVal
00044                )
00045    : minOccurs_(minOccurs), maxOccurs_(maxOccurs), use_(use), default_(deflt),
00046      defaultVal_(defltVal)
00047    { }          
00048    int minOccurs_, maxOccurs_;
00049    bool use_, default_; 
00050    std::string defaultVal_;
00051   };
00052   
00054   bool check(parS_type & ps, parE_type & pe, std::string & err);
00055   
00056   typedef std::map<std::string,ConstraintE> constraintsE_type;
00057   typedef std::map<std::string,ConstraintS> constraintsS_type;
00058 
00059 protected:
00060   bool checkBounds(parE_type::iterator pit, // current parameter to be checked
00061                             constraintsE_type::iterator cit, // corresponding constraints
00062                             std::string & err // error std::string
00063                             );
00064   bool checkStrings(parS_type::iterator sit, // current parameter to be checked
00065                  constraintsS_type::iterator cit, // corresponding constraints
00066                  std::string & err // error std::string
00067                  );
00068 
00070   static std::string d2s(double x);
00071   
00073   constraintsE_type constraintsE_;  
00074   
00076   constraintsS_type constraintsS_;
00077 };
00078 
00079 #endif