|
|
Go to the documentation of this file.
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).";
const std::string & parent(void) const
access to parent element name
virtual void clear(void)
clear this element's contents.
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
DDLVector(DDLElementRegistry *myreg)
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector>
std::vector< std::string > pStrVector
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Processing the element.
ReadMapType< std::vector< double > > pVecMap
The main class for processing parsed elements.
virtual std::vector< DDXMLAttribute >::const_iterator end(void)
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
ClhepEvaluator & evaluator()
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsStrVector>
void errorOut(const char *str) const
Compact representation of the geometrical detector hierarchy.
std::map< std::string, std::string > DDXMLAttribute
This is a base class for processing XML elements in the DDD.
std::vector< double > pVector
void do_makeDouble(char const *str, char const *end)
bool parse_strings(char const *str)
void do_makeString(char const *str, char const *end)
bool parse_numbers(char const *str)
const virtual DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
a std::map<std::string,YourType> that offers a const operator[key]; if key is not stored in the std::...
ReadMapType< std::vector< std::string > > pStrVecMap
const std::string getText(size_t tindex=0) const
retrieve the text blob.
ReadMapType< std::vector< double > > & getMapOfVectors()
DDLElementRegistry * myRegistry_
void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Called by loadAttributes AFTER attributes are loaded.
double eval(const std::string &ns, const std::string &expr)
ReadMapType< std::vector< std::string > > & getMapOfStrVectors()