Geant4_10
DefaultHepRepDefinition.cc
Go to the documentation of this file.
1 // Copyright FreeHEP, 2005.
2 
5 
6 #include <iostream>
7 #include <algorithm>
8 
9 using namespace std;
10 using namespace HEPREP;
11 
16 namespace cheprep {
17 
18 DefaultHepRepDefinition::DefaultHepRepDefinition()
20 }
21 
23  set<HepRepAttDef *> list = getAttDefsFromNode();
24  for (set<HepRepAttDef*>::iterator i1 = list.begin(); i1 != list.end(); i1++) {
25  delete (*i1);
26  }
27 }
28 
30  set<HepRepAttDef*> attSet;
31  for (map<string, HepRepAttDef*>::iterator i = attDefs.begin(); i != attDefs.end(); i++) {
32  attSet.insert((*i).second);
33  }
34  return attSet;
35 }
36 
38  string lowerCaseName = hepRepAttDef->getLowerCaseName();
39  if (attDefs[lowerCaseName] != NULL) delete attDefs[lowerCaseName];
40  attDefs[lowerCaseName] = hepRepAttDef;
41 }
42 
43 void DefaultHepRepDefinition::addAttDef(string name, string desc, string type, string extra) {
44  addAttDef(new DefaultHepRepAttDef(name, desc, type, extra));
45 }
46 
48  string s = name;
49  transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
50  return (attDefs.count(s) > 0) ? attDefs[s] : NULL;
51 }
52 
53 } // cheprep
std::set< HEPREP::HepRepAttDef * > getAttDefsFromNode()
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
const XML_Char * s
Definition: expat.h:262
const XML_Char * name
Definition: expat.h:151
virtual std::string getLowerCaseName()=0
void addAttDef(HEPREP::HepRepAttDef *hepRepAttDef)
HEPREP::HepRepAttDef * getAttDefFromNode(std::string lowerCaseName)