test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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,
DDXMLElement * > 
RegistryMap
 

Public Member Functions

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

Private Attributes

RegistryMap registry_
 

Detailed Description

The main class for processing parsed elements.

DDLElementRegistry.h - description

begin : Wed Oct 24 2001 email : case@.nosp@m.ucdh.nosp@m.ep.uc.nosp@m.davi.nosp@m.s.edu

This class is designed to serve as a registry of all DDL XML elements. It inherits from DDXMLElementRegistry.

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

Definition at line 32 of file DDLElementRegistry.h.

Member Typedef Documentation

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

Definition at line 36 of file DDLElementRegistry.h.

Constructor & Destructor Documentation

DDLElementRegistry::DDLElementRegistry ( void  )

Definition at line 42 of file DDLElementRegistry.cc.

43 {}
DDLElementRegistry::~DDLElementRegistry ( void  )

Definition at line 45 of file DDLElementRegistry.cc.

References end, spr::find(), and registry_.

46 {
47  // Complicated cleanup. I keep track of DDXMLElements that have
48  // already been deleted using this vector. Then delete them one-by-one.
49  std::vector<DDXMLElement*> toDelete;
50  for( RegistryMap::const_iterator it = registry_.begin(), end = registry_.end(); it != end; ++it )
51  {
52  std::vector<DDXMLElement*>::const_iterator deleteIt = std::find( toDelete.begin(), toDelete.end(), it->second );
53  if( deleteIt == toDelete.end())
54  {
55  toDelete.push_back( it->second );
56  delete it->second;
57  }
58  }
59 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
#define end
Definition: vmac.h:37

Member Function Documentation

ClhepEvaluator& DDLElementRegistry::evaluator ( )
inline
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 65 of file DDLElementRegistry.cc.

References mergeVDriftHistosByStation::name, NULL, and registry_.

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

66 {
67  RegistryMap::iterator it = registry_.find(name);
68  DDXMLElement* myret = NULL;
69  if( it != registry_.end())
70  {
71  myret = it->second;
72  } else {
73  // Make the Solid handlers and register them.
74  if (name == "Box")
75  {
76  myret = new DDLBox(this);
77  }
78  else if (name == "Cone")
79  {
80  myret = new DDLCone(this);
81  }
82  else if (name == "Polyhedra" || name == "Polycone")
83  {
84  myret = new DDLPolyGenerator(this);
85  }
86  else if (name == "Trapezoid" || name == "Trd1")
87  {
88  myret = new DDLTrapezoid(this);
89  }
90  else if (name == "PseudoTrap")
91  {
92  myret = new DDLPseudoTrap(this);
93  }
94  else if (name == "Tubs" || name == "CutTubs" || name == "Tube" || name == "TruncTubs")
95  {
96  myret = new DDLTubs(this);
97  }
98  else if (name == "Torus")
99  {
100  myret = new DDLTorus(this);
101  }
102  else if (name == "ReflectionSolid")
103  {
104  myret = new DDLReflectionSolid(this);
105  }
106  else if (name == "UnionSolid" || name == "SubtractionSolid"
107  || name == "IntersectionSolid")
108  {
109  myret = new DDLBooleanSolid(this);
110  }
111  else if (name == "ShapelessSolid")
112  {
113  myret = new DDLShapelessSolid(this);
114  }
115  else if (name == "Sphere")
116  {
117  myret = new DDLSphere(this);
118  }
119  else if (name == "Orb")
120  {
121  myret = new DDLOrb(this);
122  }
123  else if (name == "EllipticalTube")
124  {
125  myret = new DDLEllipticalTube(this);
126  }
127  else if (name == "Ellipsoid")
128  {
129  myret = new DDLEllipsoid(this);
130  }
131  else if (name == "Sphere")
132  {
133  myret = new DDLParallelepiped(this);
134  }
135 
136  // LogicalParts, Positioners, Materials, Rotations, Reflections
137  // and Specific (Specified?) Parameters
138  else if (name == "PosPart")
139  {
140  myret = new DDLPosPart(this);
141  }
142  else if (name == "CompositeMaterial")
143  {
144  myret = new DDLCompositeMaterial(this);
145  }
146  else if (name == "ElementaryMaterial")
147  {
148  myret = new DDLElementaryMaterial(this);
149  }
150  else if (name == "LogicalPart")
151  {
152  myret = new DDLLogicalPart(this);
153  }
154  else if (name == "ReflectionRotation" || name == "Rotation" )
155  {
156  myret = new DDLRotationAndReflection(this);
157  }
158  else if (name == "SpecPar")
159  {
160  myret = new DDLSpecPar(this);
161  }
162  else if (name == "RotationSequence")
163  {
164  myret = new DDLRotationSequence(this);
165  }
166  else if (name == "RotationByAxis")
167  {
168  myret = new DDLRotationByAxis(this);
169  }
170  // Special, need them around.
171  else if (name == "SpecParSection") {
172  myret = new DDXMLElement(this, true);
173  }
174  else if (name == "Vector") {
175  myret = new DDLVector(this);
176  }
177  else if (name == "Map") {
178  myret = new DDLMap(this);
179  }
180  else if (name == "String") {
181  myret = new DDLString(this);
182  }
183  else if (name == "Numeric") {
184  myret = new DDLNumeric(this);
185  }
186  else if (name == "Algorithm") {
187  myret = new DDLAlgorithm(this);
188  }
189  else if (name == "Division") {
190  myret = new DDLDivision(this);
191  }
192 
193  // Supporting Cast of elements.
194  // All elements which simply accumulate attributes which are then used
195  // by one of the above elements.
196  else if (name == "MaterialFraction"
197  || name == "RZPoint" || name == "PartSelector"
198  || name == "Parameter" || name == "ZSection"
199  || name == "Translation"
200  || name == "rSolid" || name == "rMaterial"
201  || name == "rParent" || name == "rChild"
202  || name == "rRotation" || name == "rReflectionRotation"
203  || name == "DDDefinition" )
204  {
205  myret = new DDXMLElement(this);
206  }
207 
208  // IF it is a new element return a default XMLElement which processes nothing.
209  // Since there are elements in the XML which require no processing, they
210  // can all use the same DDXMLElement which defaults to anything. A validated
211  // XML document (i.e. validated with XML Schema) will work properly.
212  // As of 8/16/2002: Elements like LogicalPartSection and any other *Section
213  // XML elements of the DDLSchema are taken care of by this.
214  else
215  {
216  myret = new DDXMLElement(this);
217  }
218 
219  // Actually register the thing
220  registry_[name] = myret;
221  }
222  return myret;
223 }
DDLPosPart handles PosPart elements.
Definition: DDLPosPart.h:27
This class takes care of processing all BooleanSolid type elements.
DDLSphere processes all Sphere elements.
Definition: DDLSphere.h:24
DDLDivision processes Division elements.
Definition: DDLDivision.h:27
DDLOrb processes all Orb elements.
Definition: DDLOrb.h:23
DDLString handles String Elements.
Definition: DDLString.h:26
DDLVector handles Rotation and ReflectionRotation elements.
Definition: DDLVector.h:31
DDLReflectionSolid processes ReflectionSolid elements.
#define NULL
Definition: scimark2.h:8
DDLSpecPar processes SpecPar elements.
Definition: DDLSpecPar.h:26
DDLRotationAndReflection handles RotationCMSIM and ReflectionRotation elements.
DDLEllipticalTube processes all EllipticalTube elements.
DDLAlgorithm processes Algorithm elements.
Definition: DDLAlgorithm.h:25
DDLParallelepiped processes all Parallelepiped elements.
DDLBox processes Box elements.
Definition: DDLBox.h:27
DDLElementaryMaterial processes ElementaryMaterial elements.
DDLCone processes all Cone elements.
Definition: DDLCone.h:27
DDLEllipsoid processes all Ellipsoid elements.
Definition: DDLEllipsoid.h:24
DDLTubs processes Tubs elements.
Definition: DDLTubs.h:21
DDLPolyGenerator processes DDL XML Polycone and DDL XML Polyhedra elements.
DDLMap handles Map container.
Definition: DDLMap.h:63
DDLLogicalPart processes LogicalPart elements.
This is a base class for processing XML elements in the DDD.
Definition: DDXMLElement.h:48
DDLRotationByAxis handles RotationByAxis elements.
DDLCompositeMaterial processes all CompositeMaterial elements.
DDLNumeric handles Numeric Elements.
Definition: DDLNumeric.h:29
DDLRotationSequence handles a set of Rotations.
DDLShapelessSolid processes ShapelessSolid elements.
const std::string & DDLElementRegistry::getElementName ( DDXMLElement theElement) const

Get the name given a pointer. This may not be needed...

Definition at line 226 of file DDLElementRegistry.cc.

References end, and registry_.

227 {
228  for( RegistryMap::const_iterator it = registry_.begin(), end = registry_.end(); it != end; ++it )
229  if( it->second == theElement )
230  return it->first;
231  return registry_.find( "***" )->first;
232 }
#define end
Definition: vmac.h:37
void DDLElementRegistry::registerElement ( const std::string &  name,
DDXMLElement  
)

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

Member Data Documentation

RegistryMap DDLElementRegistry::registry_
private

Definition at line 58 of file DDLElementRegistry.h.

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