23 while (std::isspace(*ptr)) {
26 char const* strt = ptr;
31 while ((*ptr != 0) and (*ptr !=
',')) {
34 char const*
end = ptr;
44 while (strt !=
end - 1 and std::isspace(*(
end - 1))) {
72 bool isNumVec((atts.find(
"type") == atts.end() || atts.find(
"type")->second ==
"numeric") ?
true :
false);
73 bool isStringVec((!isNumVec && atts.find(
"type") != atts.end() && atts.find(
"type")->second ==
"string") ?
true 77 if (tTextToParse.empty()) {
85 }
else if (isStringVec) {
90 errorOut(
"Unexpected std::vector type. Only \"numeric\" and \"string\" are allowed.");
96 }
else if (isStringVec) {
99 size_t expNEntries = 0;
100 if (atts.find(
"nEntries") != atts.end()) {
101 std::string nEntries = atts.find(
"nEntries")->second;
104 if ((isNumVec &&
pVector.size() != expNEntries) || (isStringVec &&
pStrVector.size() != expNEntries)) {
105 std::string msg(
"Number of entries found in Vector text does not match number in attribute nEntries.");
106 msg +=
"\n\tnEntries = " + atts.find(
"nEntries")->second;
107 msg +=
"\n------------------text---------\n";
109 msg +=
"\n------------------text---------\n";
112 }
else if (
parent() ==
"ConstantsSection" ||
parent() ==
"DDDefinition") {
113 if (atts.find(
"type") == atts.end() || atts.find(
"type")->second ==
"numeric") {
140 e +=
"\n as a Vector element (comma separated list).";
ReadMapType< std::vector< std::string > > pStrVecMap
vector< string > parse(string line, const string &delimiter)
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()
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)
virtual std::vector< DDXMLAttribute >::const_iterator end(void)
bool parse_strings(char const *str)
a std::map<std::string,YourType> that offers a const operator[key]; if key is not stored in the std::...
ClhepEvaluator & evaluator()
ReadMapType< std::vector< double > > pVecMap
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
bool parse_numbers(char const *str)
std::vector< std::string > pStrVector
void errorOut(const char *str) const
This is a base class for processing XML elements in the DDD.
const std::string & parent(void) const
access to parent element name
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.
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
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.