16 #include "boost/spirit/include/classic.hpp"
18 namespace boost {
namespace spirit {
namespace classic { } } }
using namespace boost::spirit::classic;
20 using namespace boost::spirit;
25 void operator() (
char const* str,
char const*
end)
const
27 ddlVector_->do_makeDouble(str, end);
40 void operator() (
char const* str,
char const*
end)
const
42 ddlVector_->do_makeString(str, end);
57 ((+(anychar_p -
','))[makeDouble]
58 >> *(
',' >> (+(anychar_p -
','))[makeDouble]))
68 ((+(anychar_p -
','))[makeString]
69 >> *(
',' >> (+(anychar_p -
','))[makeString]))
92 DCOUT_V(
'P',
"DDLVector::processElement started");
95 bool isNumVec((atts.find(
"type") == atts.end()
96 || atts.find(
"type")->second ==
"numeric")
98 bool isStringVec((!isNumVec && atts.find(
"type") != atts.end()
99 && atts.find(
"type")->second ==
"string")
103 if (tTextToParse.size() == 0) {
112 else if (isStringVec) {
118 errorOut(
"Unexpected std::vector type. Only \"numeric\" and \"string\" are allowed.");
131 else if (isStringVec) {
135 size_t expNEntries = 0;
136 if (atts.find(
"nEntries") != atts.end()) {
137 std::string nEntries = atts.find(
"nEntries")->second;
140 if ( (isNumVec &&
pVector.size() != expNEntries)
141 || (isStringVec &&
pStrVector.size() != expNEntries) )
143 std::string msg (
"Number of entries found in Vector text does not match number in attribute nEntries.");
144 msg +=
"\n\tnEntries = " + atts.find(
"nEntries")->second;
145 msg +=
"\n------------------text---------\n";
147 msg +=
"\n------------------text---------\n";
151 else if (
parent() ==
"ConstantsSection" ||
parent() ==
"DDDefinition")
153 if (atts.find(
"type") == atts.end() || atts.find(
"type")->second ==
"numeric") {
161 DCOUT_V(
'P',
"DDLVector::processElement completed");
196 e+=
"\n as a Vector element (comma separated list).";
DDLElementRegistry * myRegistry_
std::vector< double > pVector
DDLVector handles Rotation and ReflectionRotation elements.
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> ...
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Processing the element.
type of data representation of DDCompactView
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)
void errorOut(const char *str) const
static value_type & instance()
bool parse_strings(char const *str) const
a std::map<std::string,YourType> that offers a const operator[key]; if key is not stored in the std::...
ClhepEvaluator & evaluator()
void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Called by loadAttributes AFTER attributes are loaded.
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
std::vector< std::string > pStrVector
ReadMapType< std::vector< double > > pVecMap
#define DCOUT_V(M_v_Y, M_v_S)
bool parse_numbers(char const *str) const
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.
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.