CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DDLAlgorithm.cc
Go to the documentation of this file.
11 
12 #include <cstddef>
13 #include <map>
14 #include <utility>
15 
16 class DDCompactView;
17 
19 
21  myRegistry_->getElement("Vector")->clear();
22 }
23 
25  auto myNumeric = myRegistry_->getElement("Numeric");
26  auto myString = myRegistry_->getElement("String");
27  auto myVector = myRegistry_->getElement("Vector");
28  auto myMap = myRegistry_->getElement("Map");
29  auto myrParent = myRegistry_->getElement("rParent");
30 
31  DDName algoName(getDDName(nmspace));
32  DDLogicalPart lp(DDName(myrParent->getDDName(nmspace)));
33  DDXMLAttribute atts;
34 
35  // handle all Numeric elements in the Algorithm.
36  DDNumericArguments nArgs;
37  size_t i = 0;
38  for (; i < myNumeric->size(); ++i) {
39  atts = myNumeric->getAttributeSet(i);
40  nArgs[atts.find("name")->second] = myRegistry_->evaluator().eval(nmspace, atts.find("value")->second);
41  }
42 
43  DDStringArguments sArgs;
44  for (i = 0; i < myString->size(); ++i) {
45  atts = myString->getAttributeSet(i);
46  sArgs[atts.find("name")->second] = atts.find("value")->second;
47  }
48 
49  DDAlgorithmHandler handler;
50  atts = getAttributeSet();
51  handler.initialize(algoName,
52  lp,
53  nArgs,
54  static_cast<DDLVector*>(myVector.get())->getMapOfVectors(),
55  static_cast<DDLMap*>(myMap.get())->getMapOfMaps(),
56  sArgs,
57  static_cast<DDLVector*>(myVector.get())->getMapOfStrVectors());
58  handler.execute(cpv);
59 
60  // clear used/referred to elements.
61  myString->clear();
62  myNumeric->clear();
63  myVector->clear();
64  myMap->clear();
65  myrParent->clear();
66  clear();
67 }
void initialize(const DDName &algoName, const DDLogicalPart &parent, const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &svArgs)
initializes the wrapped algorithm algo_ and does some pre- and post-processing
void execute(DDCompactView &)
executes the wrapped algorithm algo_; some pre- and post-processing (exception handling) ...
wrapper around a DDAlgorithm
DDLElementRegistry * myRegistry_
Definition: DDXMLElement.h:173
DDLVector handles Rotation and ReflectionRotation elements.
Definition: DDLVector.h:29
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a &quot;row&quot; of attributes, i.e. one attribute set.
Definition: DDXMLElement.cc:54
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
std::map< std::string, std::string > DDXMLAttribute
Definition: DDXMLElement.h:45
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Processing the element.
Definition: DDLAlgorithm.cc:24
ClhepEvaluator & evaluator()
std::shared_ptr< DDXMLElement > getElement(const std::string &name)
THE most important part. Getting the pointer to a given element type.
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Called by loadAttributes AFTER attributes are loaded.
Definition: DDLAlgorithm.cc:20
DDLMap handles Map container.
Definition: DDLMap.h:33
This is a base class for processing XML elements in the DDD.
Definition: DDXMLElement.h:48
DDLAlgorithm(DDLElementRegistry *myreg)
Definition: DDLAlgorithm.cc:18
double eval(const std::string &ns, const std::string &expr)
The main class for processing parsed elements.
virtual void clear(void)
clear this element&#39;s contents.
Definition: DDXMLElement.cc:40
virtual const DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
Definition: DDXMLElement.cc:56