Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
DefaultHepRepType.cc
Go to the documentation of this file.
1// Copyright FreeHEP, 2005.
2
4
5using namespace std;
6using namespace HEPREP;
7
8/**
9 * @author Mark Donszelmann
10 */
11namespace cheprep {
12
14 : DefaultHepRepDefinition(), parent(parentType), name(typeName) {
15 this->description = "No Description";
16 this->infoURL = "No Info URL";
17
18 // HepRepTypes are sometimes used without a parent (top-level)
19 if (parent != NULL) {
20 parent->addType(this);
21 }
22}
23
25 : DefaultHepRepDefinition(), parent(NULL), name(typeName) {
26 this->description = "No Description";
27 this->infoURL = "No Info URL";
28
29 parentTypeTree->addType(this);
30}
31
33 for (vector<HepRepType*>::iterator i1 = types.begin(); i1 != types.end(); i1++) {
34 delete (*i1);
35 }
36}
37
39 return parent;
40}
41
43 HepRepAttDef* def = NULL;
44 HepRepType* type = this;
45 while ((def == NULL) && (type != NULL)) {
46 def = type->getAttDefFromNode(defName);
47 type = type->getSuperType();
48 }
49 if (def == NULL) {
50 cerr << "ERROR: No HepRepDefaults, trying to get definition for: " << defName << endl;
51 // FIXME, no HepRepDefaults
52 }
53 return def;
54}
55
56/**
57 * searched for a value with given name. Search up the type tree if needed.
58 */
60 HepRepAttValue* value = NULL;
61 HepRepType* type = this;
62 while ((value == NULL) && (type != NULL)) {
63 value = type->getAttValueFromNode(attName);
64 type = type->getSuperType();
65 }
66 if (value == NULL) {
67 cerr << "ERROR: No HepRepDefaults, trying to get value for: " << attName << endl;
68 // FIXME, no HepRepDefaults
69 }
70 return value;
71}
72
74 cerr << "DefaultHepRepType::copy(HepRepType*) not implemented." << endl;
75 return NULL;
76}
77
79 return name;
80}
81
83 return (getSuperType() == NULL) ? getName() : getSuperType()->getFullName() + "/" + getName();
84}
85
87 return description;
88}
89
91 this->description = desc;
92}
93
95 return infoURL;
96}
97
99 this->infoURL = info;
100}
101
103 // FIXME should check if type already exists
104 types.push_back(type);
105}
106
107vector<HepRepType*> DefaultHepRepType::getTypeList() {
108 return types;
109}
110
111
112} // cheprep
virtual HepRepAttValue * getAttValueFromNode(std::string lowerCaseName)=0
virtual HepRepAttDef * getAttDefFromNode(std::string lowerCaseName)=0
virtual void addType(HepRepType *type)=0
virtual std::string getFullName()=0
virtual HepRepType * getSuperType()=0
virtual void addType(HepRepType *type)=0
HEPREP::HepRepType * copy(HEPREP::HepRepType *parent)
void addType(HEPREP::HepRepType *type)
void setInfoURL(std::string infoURL)
HEPREP::HepRepAttValue * getAttValue(std::string name)
HEPREP::HepRepType * getSuperType()
HEPREP::HepRepAttDef * getAttDef(std::string name)
void setDescription(std::string description)
DefaultHepRepType(HEPREP::HepRepType *parent, std::string name)
std::vector< HEPREP::HepRepType * > getTypeList()