CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
DDLElementRegistry Class Reference

The main class for processing parsed elements. More...

#include <DDLElementRegistry.h>

Public Types

typedef std::map< std::string, std::shared_ptr< DDXMLElement > > RegistryMap
 

Public Member Functions

 DDLElementRegistry ()
 
ClhepEvaluatorevaluator ()
 
std::shared_ptr< DDXMLElementgetElement (const std::string &name)
 THE most important part. Getting the pointer to a given element type. More...
 
void registerElement (const std::string &name, DDXMLElement *)
 This allows other Elements to register themselves with the static registry. More...
 
 ~DDLElementRegistry ()
 

Private Attributes

ClhepEvaluator evaluator_
 
RegistryMap registry_
 

Detailed Description

The main class for processing parsed elements.

This class is designed to serve as a registry of all DDL XML elements.

This class is responsible for constructing and destructing any necessary DDL element.

Definition at line 23 of file DDLElementRegistry.h.

Member Typedef Documentation

◆ RegistryMap

typedef std::map<std::string, std::shared_ptr<DDXMLElement> > DDLElementRegistry::RegistryMap

Definition at line 25 of file DDLElementRegistry.h.

Constructor & Destructor Documentation

◆ DDLElementRegistry()

DDLElementRegistry::DDLElementRegistry ( void  )

Definition at line 38 of file DDLElementRegistry.cc.

38 {}

◆ ~DDLElementRegistry()

DDLElementRegistry::~DDLElementRegistry ( void  )

Definition at line 40 of file DDLElementRegistry.cc.

40 { registry_.clear(); }

References registry_.

Member Function Documentation

◆ evaluator()

ClhepEvaluator& DDLElementRegistry::evaluator ( )
inline

◆ getElement()

std::shared_ptr< DDXMLElement > DDLElementRegistry::getElement ( const std::string &  name)

THE most important part. Getting the pointer to a given element type.

If this is called with a DDXMLElementRegistry pointer, it will simply return a pointer if already registered or NULL, no instantiating.

Definition at line 42 of file DDLElementRegistry.cc.

42  {
43  RegistryMap::iterator it = registry_.find(name);
44  std::shared_ptr<DDXMLElement> myret(nullptr);
45  if (it != registry_.end()) {
46  return it->second;
47  } else {
48  // Make the Solid handlers and register them.
49  if (name == "Box") {
50  myret = std::make_shared<DDLBox>(this);
51  } else if (name == "Cone") {
52  myret = std::make_shared<DDLCone>(this);
53  } else if (name == "Polyhedra" || name == "Polycone") {
54  myret = std::make_shared<DDLPolyGenerator>(this);
55  } else if (name == "Trapezoid" || name == "Trd1") {
56  myret = std::make_shared<DDLTrapezoid>(this);
57  } else if (name == "PseudoTrap") {
58  myret = std::make_shared<DDLPseudoTrap>(this);
59  } else if (name == "Tubs" || name == "CutTubs" || name == "Tube" || name == "TruncTubs") {
60  myret = std::make_shared<DDLTubs>(this);
61  } else if (name == "Torus") {
62  myret = std::make_shared<DDLTorus>(this);
63  } else if (name == "UnionSolid" || name == "SubtractionSolid" || name == "IntersectionSolid") {
64  myret = std::make_shared<DDLBooleanSolid>(this);
65  } else if (name == "ShapelessSolid") {
66  myret = std::make_shared<DDLShapelessSolid>(this);
67  } else if (name == "Sphere") {
68  myret = std::make_shared<DDLSphere>(this);
69  } else if (name == "EllipticalTube") {
70  myret = std::make_shared<DDLEllipticalTube>(this);
71  } else if (name == "ExtrudedPolygon")
72  myret = std::make_shared<DDLPgonGenerator>(this);
73 
74  // LogicalParts, Positioners, Materials, Rotations, Reflections
75  // and Specific (Specified?) Parameters
76  else if (name == "PosPart") {
77  myret = std::make_shared<DDLPosPart>(this);
78  } else if (name == "CompositeMaterial") {
79  myret = std::make_shared<DDLCompositeMaterial>(this);
80  } else if (name == "ElementaryMaterial") {
81  myret = std::make_shared<DDLElementaryMaterial>(this);
82  } else if (name == "LogicalPart") {
83  myret = std::make_shared<DDLLogicalPart>(this);
84  } else if (name == "ReflectionRotation" || name == "Rotation") {
85  myret = std::make_shared<DDLRotationAndReflection>(this);
86  } else if (name == "SpecPar") {
87  myret = std::make_shared<DDLSpecPar>(this);
88  } else if (name == "RotationSequence") {
89  myret = std::make_shared<DDLRotationSequence>(this);
90  } else if (name == "RotationByAxis") {
91  myret = std::make_shared<DDLRotationByAxis>(this);
92  }
93  // Special, need them around.
94  else if (name == "SpecParSection") {
95  myret = std::make_shared<DDXMLElement>(this, true);
96  } else if (name == "Vector") {
97  myret = std::make_shared<DDLVector>(this);
98  } else if (name == "Map") {
99  myret = std::make_shared<DDLMap>(this);
100  } else if (name == "String") {
101  myret = std::make_shared<DDLString>(this);
102  } else if (name == "Numeric") {
103  myret = std::make_shared<DDLNumeric>(this);
104  } else if (name == "Algorithm") {
105  myret = std::make_shared<DDLAlgorithm>(this);
106  } else if (name == "Division") {
107  myret = std::make_shared<DDLDivision>(this);
108  }
109 
110  // Supporting Cast of elements.
111  // All elements which simply accumulate attributes which are then used
112  // by one of the above elements.
113  else if (name == "MaterialFraction" || name == "RZPoint" || name == "XYPoint" || name == "PartSelector" ||
114  name == "Parameter" || name == "ZSection" || name == "ZXYSection" || name == "Translation" ||
115  name == "rSolid" || name == "rMaterial" || name == "rParent" || name == "rChild" || name == "rRotation" ||
116  name == "rReflectionRotation" || name == "DDDefinition") {
117  myret = std::make_shared<DDXMLElement>(this);
118  }
119 
120  // IF it is a new element return a default XMLElement which processes nothing.
121  // Since there are elements in the XML which require no processing, they
122  // can all use the same DDXMLElement which defaults to anything. A validated
123  // XML document (i.e. validated with XML Schema) will work properly.
124  // As of 8/16/2002: Elements like LogicalPartSection and any other *Section
125  // XML elements of the DDLSchema are taken care of by this.
126  else {
127  myret = std::make_shared<DDXMLElement>(this);
128  }
129 
130  // Actually register the thing
131  registry_[name] = myret;
132  }
133  return myret;
134 }

References Skims_PA_cff::name, and registry_.

Referenced by DDLSAX2FileHandler::characters(), DDLBooleanSolid::dumpBooleanSolid(), DDLSAX2FileHandler::endElement(), DDLPgonGenerator::preProcessElement(), DDLRotationSequence::preProcessElement(), DDLAlgorithm::preProcessElement(), DDLShapelessSolid::preProcessElement(), DDLBooleanSolid::preProcessElement(), DDLPosPart::preProcessElement(), DDLPolyGenerator::preProcessElement(), DDLCompositeMaterial::preProcessElement(), DDLLogicalPart::preProcessElement(), DDLPgonGenerator::processElement(), DDLRotationSequence::processElement(), DDLRotationByAxis::processElement(), DDLSpecPar::processElement(), DDLAlgorithm::processElement(), DDLPosPart::processElement(), DDLBooleanSolid::processElement(), DDLPolyGenerator::processElement(), DDLCompositeMaterial::processElement(), DDLLogicalPart::processElement(), DDLMaterial::setReference(), DDLSolid::setReference(), and DDLSAX2FileHandler::startElement().

◆ registerElement()

void DDLElementRegistry::registerElement ( const std::string &  name,
DDXMLElement  
)

This allows other Elements to register themselves with the static registry.

Member Data Documentation

◆ evaluator_

ClhepEvaluator DDLElementRegistry::evaluator_
private

Definition at line 46 of file DDLElementRegistry.h.

Referenced by evaluator().

◆ registry_

RegistryMap DDLElementRegistry::registry_
private

Definition at line 45 of file DDLElementRegistry.h.

Referenced by getElement(), and ~DDLElementRegistry().

DDLElementRegistry::registry_
RegistryMap registry_
Definition: DDLElementRegistry.h:45
DDLElementRegistry::evaluator_
ClhepEvaluator evaluator_
Definition: DDLElementRegistry.h:46
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17