ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DefaultHepRepType.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DefaultHepRepType.cc
1 // Copyright FreeHEP, 2005.
2 
4 
5 using namespace std;
6 using namespace HEPREP;
7 
11 namespace cheprep {
12 
13 DefaultHepRepType::DefaultHepRepType(HepRepType* parentType, string typeName)
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 
24 DefaultHepRepType::DefaultHepRepType(HepRepTypeTree* parentTypeTree, string typeName)
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 
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 
107 vector<HepRepType*> DefaultHepRepType::getTypeList() {
108  return types;
109 }
110 
111 
112 } // cheprep