24 while( std::isspace(*ptr) ) {
27 char const* strt = ptr;
32 while( (*ptr != 0) and
33 (*ptr !=
',')) {++ptr;}
34 char const*
end = ptr;
35 if(*ptr ==
',') {++ptr;}
42 while(strt != end-1 and
43 std::isspace(*(end-1)) ) {
55 parse(str, [
this](
char const* st,
char const* end) {
56 do_makeDouble(st, end);
64 parse(str,[
this](
char const* st,
char const* end) {
65 do_makeString(st,end);
86 bool isNumVec((atts.find(
"type") == atts.end()
87 || atts.find(
"type")->second ==
"numeric")
89 bool isStringVec((!isNumVec && atts.find(
"type") != atts.end()
90 && atts.find(
"type")->second ==
"string")
94 if (tTextToParse.empty()) {
103 else if (isStringVec) {
109 errorOut(
"Unexpected std::vector type. Only \"numeric\" and \"string\" are allowed.");
117 else if (isStringVec) {
120 size_t expNEntries = 0;
121 if (atts.find(
"nEntries") != atts.end()) {
122 std::string nEntries = atts.find(
"nEntries")->second;
125 if ( (isNumVec &&
pVector.size() != expNEntries)
126 || (isStringVec &&
pStrVector.size() != expNEntries) )
128 std::string msg (
"Number of entries found in Vector text does not match number in attribute nEntries.");
129 msg +=
"\n\tnEntries = " + atts.find(
"nEntries")->second;
130 msg +=
"\n------------------text---------\n";
132 msg +=
"\n------------------text---------\n";
136 else if (
parent() ==
"ConstantsSection" ||
parent() ==
"DDDefinition")
138 if (atts.find(
"type") == atts.end() || atts.find(
"type")->second ==
"numeric") {
180 e+=
"\n as a Vector element (comma separated list).";
DDLElementRegistry * myRegistry_
std::vector< double > pVector
void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Called by loadAttributes AFTER attributes are loaded.
DDLVector(DDLElementRegistry *myreg)
ReadMapType< std::vector< std::string > > & getMapOfStrVectors()
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
const std::string & parent(void) const
access to parent element name
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsStrVector> ...
Compact representation of the geometrical detector hierarchy.
void do_makeDouble(char const *str, char const *end)
std::map< std::string, std::string > DDXMLAttribute
ReadMapType< std::vector< double > > & getMapOfVectors()
void do_makeString(char const *str, char const *end)
bool parse_strings(char const *str)
void errorOut(const char *str) const
a std::map<std::string,YourType> that offers a const operator[key]; if key is not stored in the std::...
ClhepEvaluator & evaluator()
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
bool parse_numbers(char const *str)
std::vector< std::string > pStrVector
ReadMapType< std::vector< double > > pVecMap
This is a base class for processing XML elements in the DDD.
ReadMapType< std::vector< std::string > > pStrVecMap
double eval(const std::string &ns, const std::string &expr)
The main class for processing parsed elements.
virtual void clear(void)
clear this element's contents.
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Processing the element.
virtual const DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
const std::string getText(size_t tindex=0) const
retrieve the text blob.