Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
DefaultHepRepAttribute.cc
Go to the documentation of this file.
1// Copyright FreeHEP, 2005.
2
3#include "cheprep/config.h"
4
5#include <iostream>
6#include <algorithm>
7
10
11using namespace std;
12using namespace HEPREP;
13
14/**
15 * @author Mark Donszelmann
16 */
17namespace cheprep {
18
19
21}
22
24 for (map<string, HepRepAttValue*>::iterator i = attValues.begin(); i != attValues.end(); i++) {
25 delete (*i).second;
26 }
27}
28
30 set<HepRepAttValue*> attSet;
31 for (map<string, HepRepAttValue*>::iterator i = attValues.begin(); i != attValues.end(); i++) {
32 if ((*i).first != "layer") attSet.insert((*i).second);
33 }
34 return attSet;
35}
36
38 string lowerCaseName = hepRepAttValue->getLowerCaseName();
39 if (attValues[lowerCaseName] != NULL) delete attValues[lowerCaseName];
40 attValues[lowerCaseName] = hepRepAttValue;
41}
42
43void DefaultHepRepAttribute::addAttValue(string key, char *value, int showLabel) {
44 addAttValue(key, (std::string)value, showLabel);
45}
46
47void DefaultHepRepAttribute::addAttValue(string key, string value, int showLabel) {
48 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
49}
50
51void DefaultHepRepAttribute::addAttValue(string key, int64 value, int showLabel) {
52 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
53}
54
55void DefaultHepRepAttribute::addAttValue(string key, int value, int showLabel) {
56 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
57}
58
59void DefaultHepRepAttribute::addAttValue(string key, double value, int showLabel) {
60 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
61}
62
63void DefaultHepRepAttribute::addAttValue(string key, bool value, int showLabel) {
64 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
65}
66
67void DefaultHepRepAttribute::addAttValue(string key, vector<double> value, int showLabel) {
68 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
69}
70
71void DefaultHepRepAttribute::addAttValue(string key, double red, double green, double blue, double alpha, int showLabel) {
72 vector<double> color;
73 color.push_back(red);
74 color.push_back(green);
75 color.push_back(blue);
76 color.push_back(alpha);
77 addAttValue(new DefaultHepRepAttValue(key, color, showLabel));
78}
79
81 string s = name;
82 transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
83 return (attValues.count(s) > 0) ? attValues[s] : NULL;
84}
85
87 string s = name;
88 transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
89 HepRepAttValue* attValue = attValues[s];
90 attValues.erase(s);
91 return attValue;
92}
93
94
95} // cheprep
virtual std::string getLowerCaseName()=0
HEPREP::HepRepAttValue * getAttValueFromNode(std::string lowerCaseName)
void addAttValue(HEPREP::HepRepAttValue *hepRepAttValue)
std::set< HEPREP::HepRepAttValue * > getAttValuesFromNode()
HEPREP::HepRepAttValue * removeAttValue(std::string key)
long long int64
Definition: config.h:30