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="")
 
void set_validation_scheme (const char *parm)
 
void set_do_namespaces ()
 
void set_do_schema ()
 
void set_validation_schema_full_checking ()
 
void set_create_entity_reference_nodes ()
 
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 138 of file XMLCoreParser.h.

Constructor & Destructor Documentation

◆ IdDictParser()

IdDictParser::IdDictParser ( )

Definition at line 124 of file IdDictParser.cxx.

124  : XMLCoreParser ()
125 {
126  register_factory ("IdDict", std::make_unique<IdDictMgrFactory>());
127  register_factory ("IdDictionary", std::make_unique<DictionaryFactory>());
128  register_factory ("field", std::make_unique<FieldFactory>());
129  register_factory ("label", std::make_unique<LabelFactory>());
130  register_factory ("alternate_regions", std::make_unique<AltRegionsFactory>());
131  register_factory ("region", std::make_unique<RegionFactory>());
132  register_factory ("subregion", std::make_unique<SubRegionFactory>());
133  register_factory ("range", std::make_unique<RangeFactory>());
134  register_factory ("reference", std::make_unique<ReferenceFactory>());
135  register_factory ("dictionary", std::make_unique<DictionaryRefFactory>());
136 
137  m_dictionary = 0;
138  m_field = 0;
139  m_region = 0;
140  m_subregion = 0;
141  m_altregions = 0;
142  m_regionentry = 0;
143 }

Member Function Documentation

◆ down()

void XMLCoreParser::down ( )
inherited

Definition at line 547 of file XMLCoreParser.cxx.

548 {
549  m_level -= 1;
550 }

◆ find_factory()

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

Definition at line 530 of file XMLCoreParser.cxx.

531 {
533  if (it != m_factories.end ())
534  {
535  return (*it).second.get();
536  }
537  return m_default_factory.get();
538 }

◆ level()

int XMLCoreParser::level ( ) const
inherited

Definition at line 553 of file XMLCoreParser.cxx.

554 {
555  return m_level;
556 }

◆ parse() [1/2]

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

Definition at line 371 of file XMLCoreParser.cxx.

372 {
373  m_level = 0;
374  std::unique_ptr<CoreParser::DOMNode> doc = ExpatCoreParser::parse (file_name);
376  {
377  if (doc != 0) doc->print ("============ ALL =============");
378  }
379  return XMLCoreNode (std::move (doc));
380 }

◆ parse() [2/2]

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

Definition at line 145 of file IdDictParser.cxx.

146 {
147  m_idd.clear ();
148 
150 
151  if (Debugger::debug ())
152  {
153  std::cout << "IdDictParser::parse1>" << std::endl;
154  }
155 
157 
158  if (Debugger::debug ())
159  {
160  std::cout << "IdDictParser::parse2>" << std::endl;
161  }
162 
164 
165  if (Debugger::debug ())
166  {
167  std::cout << "IdDictParser::parse3>" << std::endl;
168  }
169 
170  return (m_idd);
171 }

◆ register_default_factory()

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

Definition at line 490 of file XMLCoreParser.cxx.

491 {
492  m_default_factory = std::move (factory);
493 }

◆ register_external_entity()

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

Definition at line 507 of file XMLCoreParser.cxx.

508 {
510  {
511  std::cout << "XMLCoreParser::register_external_entity> name=" << name
512  << " file_name=" << file_name << std::endl;
513  }
514 
516 }

◆ register_factory()

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

Definition at line 495 of file XMLCoreParser.cxx.

497 {
499  {
500  std::cout << "XMLCoreFactory::register_factory> name=" << name
501  << " factory=" << factory.get() << std::endl;
502  }
503 
504  m_factories[name] = std::move (factory);
505 }

◆ register_text_entity()

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

Definition at line 518 of file XMLCoreParser.cxx.

519 {
521  {
522  std::cout << "XMLCoreParser::register_text_entity> name=" << name
523  << std::endl;
524  }
525 
527 }

◆ set_create_entity_reference_nodes()

void XMLCoreParser::set_create_entity_reference_nodes ( )
inherited

Definition at line 367 of file XMLCoreParser.cxx.

368 {
369 }

◆ set_do_namespaces()

void XMLCoreParser::set_do_namespaces ( )
inherited

Definition at line 355 of file XMLCoreParser.cxx.

356 {
357 }

◆ set_do_schema()

void XMLCoreParser::set_do_schema ( )
inherited

Definition at line 359 of file XMLCoreParser.cxx.

360 {
361 }

◆ set_validation_schema_full_checking()

void XMLCoreParser::set_validation_schema_full_checking ( )
inherited

Definition at line 363 of file XMLCoreParser.cxx.

364 {
365 }

◆ set_validation_scheme()

void XMLCoreParser::set_validation_scheme ( const char *  parm)
inherited

Definition at line 351 of file XMLCoreParser.cxx.

352 {
353 }

◆ terminate()

void XMLCoreParser::terminate ( )
privateinherited

◆ up()

void XMLCoreParser::up ( )
inherited

Definition at line 541 of file XMLCoreParser.cxx.

542 {
543  m_level += 1;
544 }

◆ visit() [1/2]

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

Definition at line 382 of file XMLCoreParser.cxx.

383 {
385  {
386  std::cout << "XMLCoreParser::visit file_name "
387  << file_name << std::endl;
388  }
389 
391 
393  {
394  const CoreParser::DOMNode& node = n.get_node();
395  const CoreParser::DOMNode* nptr = &node;
396  std::cout << "XMLCoreParser::visit node=" << nptr << std::endl;
397  }
398 
399  visit (n);
400 }

◆ visit() [2/2]

void XMLCoreParser::visit ( const XMLCoreNode node)
privateinherited

Definition at line 402 of file XMLCoreParser.cxx.

403 {
404  // Get the name and value out for convenience
405 
406  const CoreParser::DOMNode& node = core_node.get_node ();
407  const CoreParser::DOMNode* nptr = &node;
408 
409  const std::string& nodeName = node.get_name();
410  const std::string& nodeValue = node.get_value();
411 
413  {
414  std::cout << "XMLCoreParser::visit node(" << nptr << ") " << nodeName << std::endl;
415  }
416 
417  XMLCoreFactory* factory = find_factory (nodeName);
418 
420  {
421  std::cout << "XMLCoreParser::visit factory " << factory << std::endl;
422  }
423 
424  switch (node.get_type())
425  {
427  {
428  const CoreParser::DOMSiblings& siblings = node.get_siblings ();
429  for (const CoreParser::DOMNode* child : siblings) {
430  XMLCoreNode n (child);
431  visit (n);
432  }
433 
434  break;
435  }
437  {
439  {
440  std::cout << "XMLCoreParser::visit ELEMENT_NODE "
441  << " factory=" << factory
442  << std::endl;
443  }
444 
445  if (factory != 0) factory->start (*this, core_node);
446  else
447  {
448  std::cerr << "XMLCoreParser> Cannot find factory for element "
449  << nodeName << std::endl;
450  register_factory (nodeName, std::make_unique<DummyFactory>());
451  }
452 
453  const CoreParser::DOMSiblings& siblings = node.get_siblings ();
454  for (const CoreParser::DOMNode* child : siblings) {
455  XMLCoreNode n (child);
456  visit (n);
457  }
458 
459  if (factory != 0) factory->end (*this, core_node);
460 
461  break;
462  }
464  {
465  if (factory != 0) factory->comment (*this, nodeValue);
466  break;
467  }
469  {
470  std::cout << "ENTITY_NODE " << nodeValue << std::endl;
471  break;
472  }
474  {
475  std::cout << "ENTITY_REFERENCE_NODE " << nodeValue << std::endl;
476  break;
477  }
478  default:
479  std::cerr << "Unrecognized node type = "
480  << (long) node.get_type() << std::endl;
481  break;
482  }
483 
485  {
486  std::cout << "XMLCoreParser::visit-2" << std::endl;
487  }
488 }

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 140 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 139 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 141 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:530
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
XMLCoreParser::parse
XMLCoreNode parse(const std::string &file_name)
Definition: XMLCoreParser.cxx:371
IdDictMgr::resolve_references
void resolve_references()
Construct dictionary after parsing.
Definition: IdDictMgr.cxx:204
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:71
IdDictParser::m_altregions
IdDictAltRegions * m_altregions
Definition: IdDictParser.h:21
skel.it
it
Definition: skel.GENtoEVGEN.py:423
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
XMLCoreParserDebugger::debug
static bool debug()
Definition: XMLCoreParser.cxx:19
CoreParser::DOMNode::ENTITY_NODE
@ ENTITY_NODE
Definition: DOMNode.h:28
XMLCoreNode
Definition: XMLCoreParser.h:21
XMLCoreParser::m_level
int m_level
Definition: XMLCoreParser.h:141
CoreParser::DOMNode::DOCUMENT_NODE
@ DOCUMENT_NODE
Definition: DOMNode.h:25
physics_parameters.file_name
string file_name
Definition: physics_parameters.py:32
XMLCoreParser::m_default_factory
std::unique_ptr< XMLCoreFactory > m_default_factory
Definition: XMLCoreParser.h:140
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:96
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:495
XMLCoreFactory::end
void end(XMLCoreParser &parser, const XMLCoreNode &node)
Definition: XMLCoreParser.cxx:81
XMLCoreFactory
Definition: XMLCoreParser.h:71
PyPoolBrowser.node
node
Definition: PyPoolBrowser.py:131
Debugger::debug
static bool debug()
Definition: IdDictMgr.cxx:26
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CoreParser::DOMNode::ENTITY_REFERENCE_NODE
@ ENTITY_REFERENCE_NODE
Definition: DOMNode.h:29
XMLCoreParser::m_factories
FactoryMap m_factories
Definition: XMLCoreParser.h:139
ExpatCoreParser::parse
static std::unique_ptr< CoreParser::DOMNode > parse(const std::string &file_name)
Definition: ExpatCoreParser.cxx:557
IdDictParser::m_subregion
IdDictSubRegion * m_subregion
Definition: IdDictParser.h:22
IdDictMgr::clear
void clear()
Definition: IdDictMgr.cxx:276
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:84
XMLCoreParser::XMLCoreParser
XMLCoreParser()
Definition: XMLCoreParser.cxx:343
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
XMLCoreFactory::comment
void comment(XMLCoreParser &parser, const std::string &comment)
Definition: XMLCoreParser.cxx:91
XMLCoreParser::visit
void visit(const std::string &file_name)
Definition: XMLCoreParser.cxx:382
node
Definition: memory_hooks-stdcmalloc.h:74
IdDictMgr::generate_implementation
void generate_implementation(const std::string &tag="")
Definition: IdDictMgr.cxx:217