CMS 3D CMS Logo

DDLAlgorithm Class Reference

DDLAlgorithm processes Algorithm elements. More...

#include <DetectorDescription/Parser/src/DDLAlgorithm.h>

Inheritance diagram for DDLAlgorithm:

DDXMLElement

List of all members.

Public Member Functions

 DDLAlgorithm ()
 Constructor.
void preProcessElement (const std::string &name, const std::string &nmspace)
 Called by loadAttributes AFTER attributes are loaded.
void processElement (const std::string &name, const std::string &nmspace)
 Processing the element.
 ~DDLAlgorithm ()
 Destructor.


Detailed Description

DDLAlgorithm processes Algorithm elements.

Author:
Michael Case
DDLAlgorithm.h - description ------------------- begin: Saturday November 29, 2003 email: case@ucdhep.ucdavis.edu

This element is used to algorithmically create and position detector LogicalParts.

Definition at line 22 of file DDLAlgorithm.h.


Constructor & Destructor Documentation

DDLAlgorithm::DDLAlgorithm (  ) 

Constructor.

Definition at line 43 of file DDLAlgorithm.cc.

00044 {
00045 }

DDLAlgorithm::~DDLAlgorithm (  ) 

Destructor.

Definition at line 47 of file DDLAlgorithm.cc.

00048 {
00049 }


Member Function Documentation

void DDLAlgorithm::preProcessElement ( const std::string &  name,
const std::string &  nmspace 
) [virtual]

Called by loadAttributes AFTER attributes are loaded.

The preProcessElement method can assume that the attributes are loaded and perform any code that is necessary at the start of an element.

This would allow users to call their own code to setup anything necessary for the continued processing of the child elements.

Reimplemented from DDXMLElement.

Definition at line 51 of file DDLAlgorithm.cc.

References DDXMLElement::clear(), and DDLElementRegistry::getElement().

00052 {
00053   DDLElementRegistry::getElement("Vector")->clear();
00054 }

void DDLAlgorithm::processElement ( const std::string &  name,
const std::string &  nmspace 
) [virtual]

Processing the element.

The processElement method completes any necessary work to process the XML element.

For example, this can be used to call the DDCore to make the geometry in memory. There is a default for this so that if not declared in the inheriting class, no processing is done.

Reimplemented from DDXMLElement.

Definition at line 56 of file DDLAlgorithm.cc.

References DDXMLElement::clear(), DCOUT_V, DDAlgorithmHandler::execute(), DDXMLElement::getAttributeSet(), DDXMLElement::getDDName(), DDLElementRegistry::getElement(), DDLMap::getMapOfMaps(), DDLVector::getMapOfStrVectors(), DDLVector::getMapOfVectors(), i, DDAlgorithmHandler::initialize(), DDI::Singleton< I >::instance(), lp, and DDXMLElement::size().

00057 {
00058   DCOUT_V('P',"DDLAlgorithm::processElement started");
00059 
00060   DDXMLElement* myNumeric        = DDLElementRegistry::getElement("Numeric");
00061   DDXMLElement* myString         = DDLElementRegistry::getElement("String");
00062   DDXMLElement* myVector         = DDLElementRegistry::getElement("Vector");
00063   DDXMLElement* myMap            = DDLElementRegistry::getElement("Map");
00064   DDXMLElement* myrParent        = DDLElementRegistry::getElement("rParent");
00065 
00066   DDName algoName(getDDName(nmspace));  
00067   DDLogicalPart lp(DDName(myrParent->getDDName(nmspace)));
00068   DDXMLAttribute atts;
00069 
00070   // handle all Numeric elements in the Algorithm.
00071   DDNumericArguments nArgs;
00072   size_t i = 0;
00073   for (; i < myNumeric->size(); ++i)
00074     {
00075       atts = myNumeric->getAttributeSet(i);
00076       nArgs[atts.find("name")->second] = ExprEvalSingleton::instance().eval(nmspace, atts.find("value")->second);
00077     }
00078 
00079   DDStringArguments sArgs;
00080   for (i = 0; i < myString->size(); ++i)
00081     {
00082       atts = myString->getAttributeSet(i);
00083       sArgs[atts.find("name")->second] = atts.find("value")->second;
00084     }
00085 
00086   DDAlgorithmHandler handler;
00087   atts = getAttributeSet();
00088   DDLVector* tv= dynamic_cast<DDLVector*> (myVector);
00089   DDLMap* tm= dynamic_cast<DDLMap*> (myMap);
00090   handler.initialize( algoName, lp, nArgs, tv->getMapOfVectors(), tm->getMapOfMaps(), sArgs, tv->getMapOfStrVectors() );
00091   handler.execute();
00092 
00093   // clear used/referred to elements.
00094   myString->clear();
00095   myNumeric->clear();
00096   myVector->clear();
00097   myMap->clear();
00098   myrParent->clear();
00099   clear();
00100 
00101   DCOUT_V('P',"DDLAlgorithm::processElement(...)");
00102 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:59 2009 for CMSSW by  doxygen 1.5.4