ATLAS Offline Software
Loading...
Searching...
No Matches
IdDictParserNS::RegionEntryFactory Class Reference
Inheritance diagram for IdDictParserNS::RegionEntryFactory:
Collaboration diagram for IdDictParserNS::RegionEntryFactory:

Public Member Functions

virtual void idd_start (IdDictParser &parser, const XMLCoreNode &node)
virtual void idd_end (IdDictParser &parser, const XMLCoreNode &node)
void do_start (XMLCoreParser &parser, const XMLCoreNode &node)
void do_end (XMLCoreParser &parser, const XMLCoreNode &node)
void start (XMLCoreParser &parser, const XMLCoreNode &node)
void end (XMLCoreParser &parser, const XMLCoreNode &node)
void comment (XMLCoreParser &parser, const std::string &comment)
virtual void do_comment (XMLCoreParser &parser, const std::string &comment)

Static Public Member Functions

static bool has_attribute (const XMLCoreNode &node, const std::string &name)
static int get_int (const XMLCoreNode &node, const std::string &name)
static double get_double (const XMLCoreNode &node, const std::string &name)
static bool get_boolean (const XMLCoreNode &node, const std::string &name)
static std::string get_ID (const XMLCoreNode &node, const std::string &name)
static std::string get_value (const XMLCoreNode &node, const std::string &name)
static std::string get_token (const XMLCoreNode &node, const std::string &name)
static bool check_int (const int n, const XMLCoreNode &node, const std::string &name)
static bool check_double (const int n, const XMLCoreNode &node, const std::string &name)

Protected Attributes

std::string m_xmlelementname

Detailed Description

Definition at line 92 of file IdDictParser.cxx.

Member Function Documentation

◆ check_double()

bool XMLCoreFactory::check_double ( const int n,
const XMLCoreNode & node,
const std::string & name )
staticinherited

Definition at line 183 of file XMLCoreParser.cxx.

183 {
184 std::string checkstring = get_value (node, name);
185 int counter = 0;
186 //
187 // concatenate two times same string to
188 // check the last number of the string
189 // explicitly!
190 //
191 std::string t = checkstring + " " + checkstring;
192 std::istringstream tmpstr (t.c_str());
193 while (tmpstr.good ()) {
194 double ii{};
195 counter++;
196 tmpstr >> ii;
197 }
198 if (counter/2 != n) {
199 std::cerr << "XMLCoreFactory::check_double error: (" << counter << ") no " << n
200 << " doubles in \"" << checkstring << "\" for attribute " <<
201 name << ". exit." << std::endl;
202 std::string name1 = get_value (node, "name");
203 std::string volume = get_value (node, "volume");
204 if (name1 != "" ) std::cerr << "for name=" << name << std::endl;
205 if (volume != "" ) std::cerr << "for volume=" << volume << std::endl;
206 std::abort();
207 }
208 return true;
209}
static std::string get_value(const XMLCoreNode &node, const std::string &name)

◆ check_int()

bool XMLCoreFactory::check_int ( const int n,
const XMLCoreNode & node,
const std::string & name )
staticinherited

Definition at line 151 of file XMLCoreParser.cxx.

151 {
152 std::string checkstring = get_value (node, name);
153 int counter = 0;
154 //
155 // concatenate two times same string to
156 // check the last number of the string
157 // explicitly!
158 //
159 std::string t = checkstring + " " + checkstring;
160 std::istringstream tmpstr (t.c_str());
161 while (tmpstr.good ()) {
162 int ii;
163 counter++;
164 tmpstr >> ii;
165 }
166 if (counter/2 != n) {
167 std::cerr << "XMLCoreFactory::check_int error: no " << n
168 << " ints in \"" << checkstring << "\" for attribute " <<
169 name << ". exit." << std::endl;
170
171 std::string nodename = get_value (node, "name");
172 std::string volume = get_value (node, "volume");
173
174 if (nodename != "" ) std::cerr << "for name=" << nodename << std::endl;
175 if (volume != "" ) std::cerr << "for volume=" << volume << std::endl;
176
177 std::abort();
178 }
179 return true;
180}

◆ comment()

void XMLCoreFactory::comment ( XMLCoreParser & parser,
const std::string & comment )
inherited

Definition at line 57 of file XMLCoreParser.cxx.

57 {
58 if (XMLCoreParserDebugger::debug ()){
59 std::cout << "XMLCoreFactory::comment>" << std::endl;
60 }
61 do_comment (parser,comment);
62}
virtual void do_comment(XMLCoreParser &parser, const std::string &comment)
void comment(XMLCoreParser &parser, const std::string &comment)

◆ do_comment()

void XMLCoreFactory::do_comment ( XMLCoreParser & parser,
const std::string & comment )
virtualinherited

Definition at line 79 of file XMLCoreParser.cxx.

79 {
80 if (XMLCoreParserDebugger::debug ()){
81 std::cout << "XMLCoreFactory::do_comment>" << std::endl;
82 }
83}

◆ do_end()

void IdDictBaseFactory::do_end ( XMLCoreParser & parser,
const XMLCoreNode & node )
virtualinherited

Reimplemented from XMLCoreFactory.

Definition at line 157 of file IdDictParser.cxx.

157 {
158 idd_end (static_cast<IdDictParser&>(parser), node);
159 parser.down ();
160}
virtual void idd_end(IdDictParser &parser, const XMLCoreNode &node)

◆ do_start()

void IdDictBaseFactory::do_start ( XMLCoreParser & parser,
const XMLCoreNode & node )
virtualinherited

Reimplemented from XMLCoreFactory.

Definition at line 150 of file IdDictParser.cxx.

151 {
152 parser.up ();
153 idd_start (static_cast<IdDictParser&>(parser), node);
154}
virtual void idd_start(IdDictParser &parser, const XMLCoreNode &node)

◆ end()

void XMLCoreFactory::end ( XMLCoreParser & parser,
const XMLCoreNode & node )
inherited

Definition at line 49 of file XMLCoreParser.cxx.

49 {
50 if (XMLCoreParserDebugger::debug ()){
51 std::cout << "XMLCoreFactory::end>" << std::endl;
52 }
53 do_end (parser, node);
54}
virtual void do_end(XMLCoreParser &parser, const XMLCoreNode &node)

◆ get_boolean()

bool XMLCoreFactory::get_boolean ( const XMLCoreNode & node,
const std::string & name )
staticinherited

Definition at line 107 of file XMLCoreParser.cxx.

107 {
108 bool result = false;
109 std::string s = get_token (node, name);
110 if (s == "TRUE") result = true;
111 return (result);
112}
static std::string get_token(const XMLCoreNode &node, const std::string &name)

◆ get_double()

double XMLCoreFactory::get_double ( const XMLCoreNode & node,
const std::string & name )
staticinherited

Definition at line 99 of file XMLCoreParser.cxx.

99 {
100 double result = 0;
101 std::string s = get_value (node, name);
102 sscanf (s.c_str (), "%80lg", &result);
103 return (result);
104}

◆ get_ID()

std::string XMLCoreFactory::get_ID ( const XMLCoreNode & node,
const std::string & name )
staticinherited

Definition at line 114 of file XMLCoreParser.cxx.

114 {
115 std::string result = get_value (node, name);
116 return (result);
117}

◆ get_int()

int XMLCoreFactory::get_int ( const XMLCoreNode & node,
const std::string & name )
staticinherited

Definition at line 91 of file XMLCoreParser.cxx.

91 {
92 int result = 0;
93 std::string s = get_value (node, name);
94 sscanf (s.c_str (), "%80d", &result);
95 return (result);
96}

◆ get_token()

std::string XMLCoreFactory::get_token ( const XMLCoreNode & node,
const std::string & name )
staticinherited

Definition at line 134 of file XMLCoreParser.cxx.

134 {
135 std::string result = get_value (node, name);
136 // trim the value
137 while ((result.length () > 0) &&
138 (result.at(0) == ' ')) result.erase (0, 1);
139
140 while ((result.length () > 0) &&
141 (result.at(result.length () - 1) == ' ')) result.erase (result.length () - 1, 1);
142 // Convert to upper case
143 for (std::string::size_type i = 0; i < result.length (); ++i){
144 result[i] = std::toupper (result[i]);
145 }
146 return (result);
147}

◆ get_value()

std::string XMLCoreFactory::get_value ( const XMLCoreNode & node,
const std::string & name )
staticinherited

Definition at line 120 of file XMLCoreParser.cxx.

120 {
121 if (XMLCoreParserDebugger::debug ()){
122 std::cout << "XMLCoreFactory::get_value> name=" << name << std::endl;
123 }
124 std::string result;
125 if (node.has_attrib (name))
126 result = node.get_attrib (name);
127 if (XMLCoreParserDebugger::debug ()) {
128 std::cout << "XMLCoreFactory::get_value>2 value=" << result << std::endl;
129 }
130 return (result);
131}
const std::string & get_attrib(const std::string &name) const
Retrieve the value of an attribute.
bool has_attrib(const std::string &name) const
Test for presence of an attribute with a given name.

◆ has_attribute()

bool XMLCoreFactory::has_attribute ( const XMLCoreNode & node,
const std::string & name )
staticinherited

Definition at line 86 of file XMLCoreParser.cxx.

86 {
87 return node.has_attrib (name);
88}

◆ idd_end()

void RegionEntryFactory::idd_end ( IdDictParser & parser,
const XMLCoreNode & node )
virtual

Reimplemented from IdDictParserNS::IdDictBaseFactory.

Definition at line 480 of file IdDictParser.cxx.

480 {
481 if (Debugger::debug ()) {
482 Debugger::tab (parser.level());
483 std::cout << "RegionEntryFactory::idd_end>" << std::endl;
484 }
485 if (parser.m_regionentry != 0){
486 if (parser.m_region != 0) parser.m_region->add_entry (std::move(parser.m_regionentry));
487 else if (parser.m_subregion != 0) parser.m_subregion->add_entry (std::move(parser.m_regionentry));
488 else parser.m_regionentry.reset();
489 }
490}
static void tab(int n)

◆ idd_start()

void RegionEntryFactory::idd_start ( IdDictParser & parser,
const XMLCoreNode & node )
virtual

Reimplemented from IdDictParserNS::IdDictBaseFactory.

Reimplemented in IdDictParserNS::DictionaryRefFactory, IdDictParserNS::RangeFactory, and IdDictParserNS::ReferenceFactory.

Definition at line 472 of file IdDictParser.cxx.

472 {
473 if (Debugger::debug ()){
474 Debugger::tab (parser.level());
475 std::cout << "RegionEntryFactory::idd_start>" << std::endl;
476 }
477}

◆ start()

void XMLCoreFactory::start ( XMLCoreParser & parser,
const XMLCoreNode & node )
inherited

Definition at line 41 of file XMLCoreParser.cxx.

41 {
42 if (XMLCoreParserDebugger::debug ()){
43 std::cout << "XMLCoreFactory::start> factory=" << this << std::endl;
44 }
45 do_start (parser, node);
46}
virtual void do_start(XMLCoreParser &parser, const XMLCoreNode &node)

Member Data Documentation

◆ m_xmlelementname

std::string XMLCoreFactory::m_xmlelementname
protectedinherited

Definition at line 42 of file XMLCoreParser.h.


The documentation for this class was generated from the following file: