Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
DefaultHepRepType.cc
이 파일의 문서화 페이지로 가기
1 // Copyright FreeHEP, 2005.
2 
4 
5 using namespace std;
6 using namespace HEPREP;
7 
12 namespace cheprep {
13 
14 DefaultHepRepType::DefaultHepRepType(HepRepType* parentType, string typeName)
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 
25 DefaultHepRepType::DefaultHepRepType(HepRepTypeTree* parentTypeTree, string typeName)
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 
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 
108 vector<HepRepType*> DefaultHepRepType::getTypeList() {
109  return types;
110 }
111 
112 
113 } // cheprep
virtual void addType(HepRepType *type)=0
const XML_Char XML_Encoding * info
Definition: expat.h:530
const XML_Char * name
Definition: expat.h:151
std::vector< HEPREP::HepRepType * > types
HEPREP::HepRepType * getSuperType()
virtual std::string getFullName()=0
virtual HepRepAttValue * getAttValueFromNode(std::string lowerCaseName)=0
void setDescription(std::string description)
void addType(HEPREP::HepRepType *type)
void setInfoURL(std::string infoURL)
virtual HepRepType * getSuperType()=0
const XML_Char int const XML_Char * value
Definition: expat.h:331
virtual HepRepAttDef * getAttDefFromNode(std::string lowerCaseName)=0
std::vector< HEPREP::HepRepType * > getTypeList()
DefaultHepRepType(HEPREP::HepRepType *parent, std::string name)
HEPREP::HepRepType * parent
HEPREP::HepRepType * copy(HEPREP::HepRepType *parent)
virtual void addType(HepRepType *type)=0
HEPREP::HepRepAttValue * getAttValue(std::string name)
HEPREP::HepRepAttDef * getAttDef(std::string name)