3 #include "cheprep/DefaultHepRepDefinition.h"
4 #include "cheprep/DefaultHepRepAttDef.h"
18 DefaultHepRepDefinition::DefaultHepRepDefinition()
19 : DefaultHepRepAttribute() {
22 DefaultHepRepDefinition::~DefaultHepRepDefinition() {
23 set<HepRepAttDef *> list = getAttDefsFromNode();
24 for (set<HepRepAttDef*>::iterator i1 = list.begin(); i1 != list.end(); i1++) {
29 set<HepRepAttDef *> DefaultHepRepDefinition::getAttDefsFromNode() {
30 set<HepRepAttDef*> attSet;
31 for (map<string, HepRepAttDef*>::iterator i = attDefs.begin(); i != attDefs.end(); i++) {
32 attSet.insert((*i).second);
37 void DefaultHepRepDefinition::addAttDef(HepRepAttDef* hepRepAttDef) {
38 string lowerCaseName = hepRepAttDef->getLowerCaseName();
39 if (attDefs[lowerCaseName] != NULL)
delete attDefs[lowerCaseName];
40 attDefs[lowerCaseName] = hepRepAttDef;
43 void DefaultHepRepDefinition::addAttDef(
string name,
string desc,
string type,
string extra) {
44 addAttDef(
new DefaultHepRepAttDef(name, desc, type, extra));
47 HepRepAttDef* DefaultHepRepDefinition::getAttDefFromNode(
string name) {
49 transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
50 return (attDefs.count(s) > 0) ? attDefs[s] : NULL;