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))) {
53 parse(str, [
this](
char const* st,
char const* end) { do_makeDouble(st, end); });
58 parse(str, [
this](
char const* st,
char const* end) { do_makeString(st, end); });
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
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()
ReadMapType< std::vector< double > > pVecMap
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
bool parse_numbers(char const *str)
std::vector< std::string > pStrVector
This is a base class for processing XML elements in the DDD.
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.