ATLAS Offline Software
Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
IdDictParser Class Reference

#include <IdDictParser.h>

Inheritance diagram for IdDictParser:
Collaboration diagram for IdDictParser:

Public Member Functions

 IdDictParser ()
 
IdDictMgrparse (const std::string &file_name, const std::string &tag="")
 
XMLCoreNode parse (const std::string &file_name)
 
void visit (const std::string &file_name)
 
void register_default_factory (std::unique_ptr< XMLCoreFactory > factory)
 
void register_factory (const std::string &name, std::unique_ptr< XMLCoreFactory > factory)
 
void register_external_entity (const std::string &name, const std::string &file_name)
 
void register_text_entity (const std::string &name, const std::string &text)
 
void up ()
 
void down ()
 
int level () const
 

Public Attributes

IdDictMgr m_idd
 
IdDictDictionarym_dictionary
 
IdDictFieldm_field
 
IdDictRegionm_region
 
IdDictAltRegionsm_altregions
 
IdDictSubRegionm_subregion
 
IdDictRegionEntrym_regionentry
 

Private Types

typedef std::map< std::string, std::unique_ptr< XMLCoreFactory > > FactoryMap
 

Private Member Functions

void visit (const XMLCoreNode &node)
 
void terminate ()
 
XMLCoreFactoryfind_factory (const std::string &name)
 

Private Attributes

FactoryMap m_factories
 
std::unique_ptr< XMLCoreFactorym_default_factory
 
int m_level = 0
 

Detailed Description

Definition at line 11 of file IdDictParser.h.

Member Typedef Documentation

◆ FactoryMap

typedef std::map<std::string, std::unique_ptr<XMLCoreFactory> > XMLCoreParser::FactoryMap
privateinherited

Definition at line 120 of file XMLCoreParser.h.

Constructor & Destructor Documentation

◆ IdDictParser()

IdDictParser::IdDictParser ( )

Definition at line 106 of file IdDictParser.cxx.

106  : XMLCoreParser () {
107  register_factory ("IdDict", std::make_unique<IdDictMgrFactory>());
108  register_factory ("IdDictionary", std::make_unique<DictionaryFactory>());
109  register_factory ("field", std::make_unique<FieldFactory>());
110  register_factory ("label", std::make_unique<LabelFactory>());
111  register_factory ("alternate_regions", std::make_unique<AltRegionsFactory>());
112  register_factory ("region", std::make_unique<RegionFactory>());
113  register_factory ("subregion", std::make_unique<SubRegionFactory>());
114  register_factory ("range", std::make_unique<RangeFactory>());
115  register_factory ("reference", std::make_unique<ReferenceFactory>());
116  register_factory ("dictionary", std::make_unique<DictionaryRefFactory>());
117 
118  m_dictionary = 0;
119  m_field = 0;
120  m_region = 0;
121  m_subregion = 0;
122  m_altregions = 0;
123  m_regionentry = 0;
124 }

Member Function Documentation

◆ down()

void XMLCoreParser::down ( )
inherited

Definition at line 421 of file XMLCoreParser.cxx.

421  {
422  m_level -= 1;
423 }

◆ find_factory()

XMLCoreFactory * XMLCoreParser::find_factory ( const std::string &  name)
privateinherited

Definition at line 405 of file XMLCoreParser.cxx.

405  {
407  if (it != m_factories.end ()) {
408  return (*it).second.get();
409  }
410  return m_default_factory.get();
411 }

◆ level()

int XMLCoreParser::level ( ) const
inherited

Definition at line 427 of file XMLCoreParser.cxx.

427  {
428  return m_level;
429 }

◆ parse() [1/2]

XMLCoreNode XMLCoreParser::parse ( const std::string &  file_name)
inherited

Definition at line 276 of file XMLCoreParser.cxx.

276  {
277  m_level = 0;
278  std::unique_ptr<CoreParser::DOMNode> doc = ExpatCoreParser::parse (file_name);
280  if (doc != nullptr) doc->print ("============ ALL =============");
281  }
282  if (not doc){
283  throw std::runtime_error("XMLCoreParser: no such file ["+file_name+"]");
284  }
285  return XMLCoreNode (std::move (doc));
286 }

◆ parse() [2/2]

IdDictMgr & IdDictParser::parse ( const std::string &  file_name,
const std::string &  tag = "" 
)

Definition at line 127 of file IdDictParser.cxx.

127  {
128  m_idd.clear ();
130  if (Debugger::debug ()) {
131  std::cout << "IdDictParser::parse1>" << std::endl;
132  }
134  if (Debugger::debug ()) {
135  std::cout << "IdDictParser::parse2>" << std::endl;
136  }
138  if (Debugger::debug ()) {
139  std::cout << "IdDictParser::parse3>" << std::endl;
140  }
141  return (m_idd);
142 }

◆ register_default_factory()

void XMLCoreParser::register_default_factory ( std::unique_ptr< XMLCoreFactory factory)
inherited

Definition at line 371 of file XMLCoreParser.cxx.

371  {
372  m_default_factory = std::move (factory);
373 }

◆ register_external_entity()

void XMLCoreParser::register_external_entity ( const std::string &  name,
const std::string &  file_name 
)
inherited

Definition at line 386 of file XMLCoreParser.cxx.

386  {
388  std::cout << "XMLCoreParser::register_external_entity> name=" << name
389  << " file_name=" << file_name << std::endl;
390  }
392 }

◆ register_factory()

void XMLCoreParser::register_factory ( const std::string &  name,
std::unique_ptr< XMLCoreFactory factory 
)
inherited

Definition at line 376 of file XMLCoreParser.cxx.

377  {
379  std::cout << "XMLCoreFactory::register_factory> name=" << name
380  << " factory=" << factory.get() << std::endl;
381  }
382  m_factories[name] = std::move (factory);
383 }

◆ register_text_entity()

void XMLCoreParser::register_text_entity ( const std::string &  name,
const std::string &  text 
)
inherited

Definition at line 395 of file XMLCoreParser.cxx.

395  {
397  std::cout << "XMLCoreParser::register_text_entity> name=" << name
398  << std::endl;
399  }
401 }

◆ terminate()

void XMLCoreParser::terminate ( )
privateinherited

◆ up()

void XMLCoreParser::up ( )
inherited

Definition at line 415 of file XMLCoreParser.cxx.

415  {
416  m_level += 1;
417 }

◆ visit() [1/2]

void XMLCoreParser::visit ( const std::string &  file_name)
inherited

Definition at line 289 of file XMLCoreParser.cxx.

289  {
291  std::cout << "XMLCoreParser::visit file_name "
292  << file_name << std::endl;
293  }
296  const CoreParser::DOMNode& node = n.get_node();
297  const CoreParser::DOMNode* nptr = &node;
298  std::cout << "XMLCoreParser::visit node=" << nptr << std::endl;
299  }
300  visit (n);
301 }

◆ visit() [2/2]

void XMLCoreParser::visit ( const XMLCoreNode node)
privateinherited

Definition at line 304 of file XMLCoreParser.cxx.

304  {
305  // Get the name and value out for convenience
306  const CoreParser::DOMNode& node = core_node.get_node ();
307  const CoreParser::DOMNode* nptr = &node;
308  const std::string& nodeName = node.get_name();
309  const std::string& nodeValue = node.get_value();
311  std::cout << "XMLCoreParser::visit node(" << nptr << ") " << nodeName << std::endl;
312  }
313  XMLCoreFactory* factory = find_factory (nodeName);
315  std::cout << "XMLCoreParser::visit factory " << factory << std::endl;
316  }
317 
318  switch (node.get_type()) {
320  const CoreParser::DOMSiblings& siblings = node.get_siblings ();
321  for (const CoreParser::DOMNode* child : siblings) {
322  XMLCoreNode n (child);
323  visit (n);
324  }
325  break;
326  }
329  std::cout << "XMLCoreParser::visit ELEMENT_NODE "
330  << " factory=" << factory
331  << std::endl;
332  }
333  if (factory != 0){
334  factory->start (*this, core_node);
335  } else {
336  std::cerr << "XMLCoreParser> Cannot find factory for element "
337  << nodeName << std::endl;
338  register_factory (nodeName, std::make_unique<DummyFactory>());
339  }
340  const CoreParser::DOMSiblings& siblings = node.get_siblings ();
341  for (const CoreParser::DOMNode* child : siblings) {
342  XMLCoreNode n (child);
343  visit (n);
344  }
345  if (factory != 0) factory->end (*this, core_node);
346  break;
347  }
349  if (factory != 0) factory->comment (*this, nodeValue);
350  break;
351  }
353  std::cout << "ENTITY_NODE " << nodeValue << std::endl;
354  break;
355  }
357  std::cout << "ENTITY_REFERENCE_NODE " << nodeValue << std::endl;
358  break;
359  }
360  default: {
361  std::cerr << "Unrecognized node type = " << (long) node.get_type() << std::endl;
362  break;
363  }
364  }
366  std::cout << "XMLCoreParser::visit-2" << std::endl;
367  }
368 }

Member Data Documentation

◆ m_altregions

IdDictAltRegions* IdDictParser::m_altregions

Definition at line 21 of file IdDictParser.h.

◆ m_default_factory

std::unique_ptr<XMLCoreFactory> XMLCoreParser::m_default_factory
privateinherited

Definition at line 122 of file XMLCoreParser.h.

◆ m_dictionary

IdDictDictionary* IdDictParser::m_dictionary

Definition at line 18 of file IdDictParser.h.

◆ m_factories

FactoryMap XMLCoreParser::m_factories
privateinherited

Definition at line 121 of file XMLCoreParser.h.

◆ m_field

IdDictField* IdDictParser::m_field

Definition at line 19 of file IdDictParser.h.

◆ m_idd

IdDictMgr IdDictParser::m_idd

Definition at line 17 of file IdDictParser.h.

◆ m_level

int XMLCoreParser::m_level = 0
privateinherited

Definition at line 123 of file XMLCoreParser.h.

◆ m_region

IdDictRegion* IdDictParser::m_region

Definition at line 20 of file IdDictParser.h.

◆ m_regionentry

IdDictRegionEntry* IdDictParser::m_regionentry

Definition at line 23 of file IdDictParser.h.

◆ m_subregion

IdDictSubRegion* IdDictParser::m_subregion

Definition at line 22 of file IdDictParser.h.


The documentation for this class was generated from the following files:
XMLCoreParser::find_factory
XMLCoreFactory * find_factory(const std::string &name)
Definition: XMLCoreParser.cxx:405
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
XMLCoreParser::parse
XMLCoreNode parse(const std::string &file_name)
Definition: XMLCoreParser.cxx:276
IdDictMgr::resolve_references
void resolve_references()
Construct dictionary after parsing.
Definition: IdDictMgr.cxx:206
CoreParser::DOMSiblings
std::vector< DOMNode * > DOMSiblings
Definition: DOMNode.h:18
IdDictParser::m_dictionary
IdDictDictionary * m_dictionary
Definition: IdDictParser.h:18
XMLCoreFactory::start
void start(XMLCoreParser &parser, const XMLCoreNode &node)
Definition: XMLCoreParser.cxx:66
IdDictParser::m_altregions
IdDictAltRegions * m_altregions
Definition: IdDictParser.h:21
skel.it
it
Definition: skel.GENtoEVGEN.py:396
IdDictParser::m_regionentry
IdDictRegionEntry * m_regionentry
Definition: IdDictParser.h:23
CoreParser::DOMNode
Definition: DOMNode.h:21
IdDictParser::m_field
IdDictField * m_field
Definition: IdDictParser.h:19
IdDictParser::m_idd
IdDictMgr m_idd
Definition: IdDictParser.h:17
CoreParser::DOMNode::ENTITY_NODE
@ ENTITY_NODE
Definition: DOMNode.h:28
XMLCoreNode
Definition: XMLCoreParser.h:19
XMLCoreParser::m_level
int m_level
Definition: XMLCoreParser.h:123
CoreParser::DOMNode::DOCUMENT_NODE
@ DOCUMENT_NODE
Definition: DOMNode.h:25
physics_parameters.file_name
string file_name
Definition: physics_parameters.py:32
XMLCoreParser
Definition: XMLCoreParser.h:97
XMLCoreParser::m_default_factory
std::unique_ptr< XMLCoreFactory > m_default_factory
Definition: XMLCoreParser.h:122
CoreParser::DOMNode::COMMENT_NODE
@ COMMENT_NODE
Definition: DOMNode.h:27
ExpatCoreParser::register_text_entity
static void register_text_entity(const std::string &name, const std::string &text)
Definition: ExpatCoreParser.cxx:92
beamspotman.n
n
Definition: beamspotman.py:731
CoreParser::DOMNode::ELEMENT_NODE
@ ELEMENT_NODE
Definition: DOMNode.h:26
IdDictParser::m_region
IdDictRegion * m_region
Definition: IdDictParser.h:20
XMLCoreParser::register_factory
void register_factory(const std::string &name, std::unique_ptr< XMLCoreFactory > factory)
Definition: XMLCoreParser.cxx:376
XMLCoreFactory::end
void end(XMLCoreParser &parser, const XMLCoreNode &node)
Definition: XMLCoreParser.cxx:74
XMLCoreFactory
Definition: XMLCoreParser.h:62
PyPoolBrowser.node
node
Definition: PyPoolBrowser.py:131
Debugger::debug
static bool debug()
Definition: IdDictMgr.cxx:28
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
CoreParser::DOMNode::ENTITY_REFERENCE_NODE
@ ENTITY_REFERENCE_NODE
Definition: DOMNode.h:29
XMLCoreParser::m_factories
FactoryMap m_factories
Definition: XMLCoreParser.h:121
ExpatCoreParser::parse
static std::unique_ptr< CoreParser::DOMNode > parse(const std::string &file_name)
Definition: ExpatCoreParser.cxx:417
IdDictParser::m_subregion
IdDictSubRegion * m_subregion
Definition: IdDictParser.h:22
IdDictMgr::clear
void clear()
Definition: IdDictMgr.cxx:278
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
ExpatCoreParser::register_external_entity
static void register_external_entity(const std::string &name, const std::string &file_name)
Definition: ExpatCoreParser.cxx:82
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
XMLCoreFactory::comment
void comment(XMLCoreParser &parser, const std::string &comment)
Definition: XMLCoreParser.cxx:82
XMLCoreParser::visit
void visit(const std::string &file_name)
Definition: XMLCoreParser.cxx:289
node
Definition: memory_hooks-stdcmalloc.h:74
IdDictMgr::generate_implementation
void generate_implementation(const std::string &tag="")
Definition: IdDictMgr.cxx:219