Geant4 9.6.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 * @version $Id: DefaultHepRepAttribute.cc,v 1.8 2005-06-02 21:28:45 duns Exp $
17 */
18namespace cheprep {
19
20
22}
23
25 for (map<string, HepRepAttValue*>::iterator i = attValues.begin(); i != attValues.end(); i++) {
26 delete (*i).second;
27 }
28}
29
31 set<HepRepAttValue*> attSet;
32 for (map<string, HepRepAttValue*>::iterator i = attValues.begin(); i != attValues.end(); i++) {
33 if ((*i).first != "layer") attSet.insert((*i).second);
34 }
35 return attSet;
36}
37
39 string lowerCaseName = hepRepAttValue->getLowerCaseName();
40 if (attValues[lowerCaseName] != NULL) delete attValues[lowerCaseName];
41 attValues[lowerCaseName] = hepRepAttValue;
42}
43
44void DefaultHepRepAttribute::addAttValue(string key, char *value, int showLabel) {
45 addAttValue(key, (std::string)value, showLabel);
46}
47
48void DefaultHepRepAttribute::addAttValue(string key, string value, int showLabel) {
49 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
50}
51
52void DefaultHepRepAttribute::addAttValue(string key, int64 value, int showLabel) {
53 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
54}
55
56void DefaultHepRepAttribute::addAttValue(string key, int value, int showLabel) {
57 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
58}
59
60void DefaultHepRepAttribute::addAttValue(string key, double value, int showLabel) {
61 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
62}
63
64void DefaultHepRepAttribute::addAttValue(string key, bool value, int showLabel) {
65 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
66}
67
68void DefaultHepRepAttribute::addAttValue(string key, vector<double> value, int showLabel) {
69 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
70}
71
72void DefaultHepRepAttribute::addAttValue(string key, double red, double green, double blue, double alpha, int showLabel) {
73 vector<double> color;
74 color.push_back(red);
75 color.push_back(green);
76 color.push_back(blue);
77 color.push_back(alpha);
78 addAttValue(new DefaultHepRepAttValue(key, color, showLabel));
79}
80
82 string s = name;
83 transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
84 return (attValues.count(s) > 0) ? attValues[s] : NULL;
85}
86
88 string s = name;
89 transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
90 HepRepAttValue* attValue = attValues[s];
91 attValues.erase(s);
92 return attValue;
93}
94
95
96} // 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:31