13 parE_type::iterator pit = pe.find(e_it->first);
14 if (e_it->second.use_) {
16 if (pit != pe.end()) {
20 err += std::string(
"\tmissing required parameter: ") + e_it->first + std::string(
"\n");
29 DCOUT(
'e',
"AlgoCheck::check(): optional param=" << e_it->first);
32 if (pit != pe.end()) {
38 if (e_it->second.default_) {
39 for(
int j=0;
j<e_it->second.minOccurs_; ++
j)
40 pe[e_it->first].push_back(e_it->second.defaultVal_);
53 parS_type::iterator sit = ps.find(s_it->first);
54 if (s_it->second.use_) {
56 if (sit != ps.end()) {
60 err += std::string(
"\tmissing required parameter: ") + s_it->first + std::string(
"\n");
67 if (s_it->second.default_) {
68 for (
int j = 0;
j < s_it->second.minOccurs_; ++
j)
69 ps[s_it->first].push_back(s_it->second.defaultVal_);
79 constraintsE_type::iterator cit,
85 DCOUT(
'e',
"AlgoCheck::checkBounds(), par-name=" << pit->first );
86 DCOUT(
'e',
" minOccurs = " << cit->second.minOccurs_ );
87 DCOUT(
'e',
" maxOccurs = " << cit->second.maxOccurs_ );
88 DCOUT(
'e',
" par-occurs = " << pit->second.size() );
90 if (cit->second.minOccurs_ >
int(pit->second.size()) ) {
91 err +=
"\tpar. " + cit->first
92 +
" occurs=" +
d2s(pit->second.size()) + std::string(
" < minOccurs; minOccurs=")
93 +
d2s(cit->second.minOccurs_) + std::string(
" maxOccurs=")
94 +
d2s(cit->second.maxOccurs_)
97 DCOUT(
'e',
" VIOLATION of minOccurs");
100 if (cit->second.maxOccurs_ <
int(pit->second.size()) ) {
101 err +=
"\tpar. " + cit->first
102 +
" occurs=" +
d2s(pit->second.size()) + std::string(
" > maxOccurs; minOccurs=")
103 +
d2s(cit->second.minOccurs_) + std::string(
" maxOccurs=")
104 +
d2s(cit->second.maxOccurs_)
107 DCOUT(
'e',
" VIOLATION of maxOccurs");
115 int m=int(pit->second.size());
117 if (pit->second[i] < cit->second.min_) {
118 err +=
"\tpar. " + cit->first + std::string(
"[") +
d2s(i) + std::string(
"]=")
119 +
d2s(pit->second[i]) + std::string(
" < min; min=")
120 +
d2s(cit->second.min_) + std::string(
" max=") +
d2s(cit->second.max_)
124 if (pit->second[i] > cit->second.max_) {
125 err +=
"\tpar. " + cit->first + std::string(
"[") +
d2s(i) + std::string(
"]=")
126 +
d2s(pit->second[i]) + std::string(
" > max; min=")
127 +
d2s(cit->second.min_) + std::string(
" max=") +
d2s(cit->second.max_)
142 int len = snprintf( buffer, 25,
"%g", x );
144 edm::LogError(
"DoubleToString" ) <<
"Length truncated (from " << len <<
")";
145 return std::string( buffer );
150 constraintsS_type::iterator cit,
155 if (cit->second.minOccurs_ >
int(sit->second.size()) ) {
156 err +=
"\tpar. " + cit->first
157 +
" occurs=" +
d2s(sit->second.size()) + std::string(
" < minOccurs; minOccurs=")
158 +
d2s(cit->second.minOccurs_) + std::string(
" maxOccurs=")
159 +
d2s(cit->second.maxOccurs_)
162 DCOUT(
'e',
" VIOLATION of minOccurs");
165 if (cit->second.maxOccurs_ <
int(sit->second.size()) ) {
166 err +=
"\tpar. " + cit->first
167 +
" occurs=" +
d2s(sit->second.size()) + std::string(
" > maxOccurs; minOccurs=")
168 +
d2s(cit->second.minOccurs_) + std::string(
" maxOccurs=")
169 +
d2s(cit->second.maxOccurs_)
172 DCOUT(
'e',
" VIOLATION of maxOccurs");
177 int m = int(sit->second.size());
180 std::string
s = sit->second[
i];
181 int ss = int(s.size());
184 for (; j < ss; ++
j) {
188 if (j == ss && s[j] ==
' ') {
189 err +=
"\tpar. " + cit->first + std::string(
"[") +
d2s(i) + std::string(
"] is blank");
191 DCOUT(
'e',
" VIOLATION of requiring non-blank std::strings");
bool checkBounds(parE_type::iterator pit, constraintsE_type::iterator cit, std::string &err)
static std::string d2s(double x)
ahh, converts a double into a std::string ... yet another one of this kind!
bool check(parS_type &ps, parE_type &pe, std::string &err)
returns true if the check was successfull (parameters conform to XML specification) ...
std::map< std::string, std::vector< std::string > > parS_type
constraintsS_type constraintsS_
format: "ParameterName" -> ConstraintS
constraintsE_type constraintsE_
format: "ParameterName" -> ConstraintE
bool checkStrings(parS_type::iterator sit, constraintsS_type::iterator cit, std::string &err)
#define DCOUT(M_v_Y, M_v_S)
std::map< std::string, std::vector< double > > parE_type