ATLAS Offline Software
Loading...
Searching...
No Matches
foreachHandler.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
8#include <iostream>
9
10
11using namespace xercesc;
12
13foreachHandler::foreachHandler(const std::string& s,
15 : XMLHandler(s, c)
16{
17// std::cout<<"Creating handler for foreach"<<std::endl;
18}
19
21 xercesc::DOMNode *t)
22{
23 std::string index=getAttributeAsString(c, t, "index");
24 int ibegin=getAttributeAsInt(c, t, "begin");
25 int iloops=getAttributeAsInt(c, t, "loops");
26 StopLoop(true);
27 c.Evaluator().RegisterVariable(index,ibegin);
28
29 IAGDDParser& parser = *c.GetParser();
30 DOMNode *fChild=t->getFirstChild();
31 for (int i=ibegin;i<ibegin+iloops;i++)
32 {
33
34// std::cout<<"\t\tindex "<<i<<std::endl;
35 c.Evaluator().RegisterVariable(index,i);
36
37 DOMNode *child;
38 for (child=fChild;child!=0;child=child->getNextSibling())
39 {
40 if (child->getNodeType()==DOMNode::ELEMENT_NODE) {
41 parser.elementLoop(c, child);
42 }
43 }
44
45
46 }
47
48}
void StopLoop(bool)
int getAttributeAsInt(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
XMLHandler(const std::string &n, AGDDController &c)
std::string getAttributeAsString(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
foreachHandler(const std::string &, AGDDController &c)
virtual void ElementHandle(AGDDController &c, xercesc::DOMNode *t) override
Definition index.py:1