Geant4 9.6.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 * @version $Id: DefaultHepRepType.cc,v 1.8 2005-06-02 21:28:45 duns Exp $
11 */
12namespace cheprep {
13
15 : DefaultHepRepDefinition(), parent(parentType), name(typeName) {
16 this->description = "No Description";
17 this->infoURL = "No Info URL";
18
19 // HepRepTypes are sometimes used without a parent (top-level)
20 if (parent != NULL) {
21 parent->addType(this);
22 }
23}
24
26 : DefaultHepRepDefinition(), parent(NULL), name(typeName) {
27 this->description = "No Description";
28 this->infoURL = "No Info URL";
29
30 parentTypeTree->addType(this);
31}
32
34 for (vector<HepRepType*>::iterator i1 = types.begin(); i1 != types.end(); i1++) {
35 delete (*i1);
36 }
37}
38
40 return parent;
41}
42
44 HepRepAttDef* def = NULL;
45 HepRepType* type = this;
46 while ((def == NULL) && (type != NULL)) {
47 def = type->getAttDefFromNode(defName);
48 type = type->getSuperType();
49 }
50 if (def == NULL) {
51 cerr << "ERROR: No HepRepDefaults, trying to get definition for: " << defName << endl;
52 // FIXME, no HepRepDefaults
53 }
54 return def;
55}
56
57/**
58 * searched for a value with given name. Search up the type tree if needed.
59 */
61 HepRepAttValue* value = NULL;
62 HepRepType* type = this;
63 while ((value == NULL) && (type != NULL)) {
64 value = type->getAttValueFromNode(attName);
65 type = type->getSuperType();
66 }
67 if (value == NULL) {
68 cerr << "ERROR: No HepRepDefaults, trying to get value for: " << attName << endl;
69 // FIXME, no HepRepDefaults
70 }
71 return value;
72}
73
75 cerr << "DefaultHepRepType::copy(HepRepType*) not implemented." << endl;
76 return NULL;
77}
78
80 return name;
81}
82
84 return (getSuperType() == NULL) ? getName() : getSuperType()->getFullName() + "/" + getName();
85}
86
88 return description;
89}
90
92 this->description = desc;
93}
94
96 return infoURL;
97}
98
100 this->infoURL = info;
101}
102
104 // FIXME should check if type already exists
105 types.push_back(type);
106}
107
108vector<HepRepType*> DefaultHepRepType::getTypeList() {
109 return types;
110}
111
112
113} // 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()