Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
cheprep::DefaultHepRepAttribute Class Referenceabstract

#include <DefaultHepRepAttribute.h>

+ Inheritance diagram for cheprep::DefaultHepRepAttribute:

Public Member Functions

 DefaultHepRepAttribute ()
 
 ~DefaultHepRepAttribute ()
 
std::set< HEPREP::HepRepAttValue * > getAttValuesFromNode ()
 
void addAttValue (HEPREP::HepRepAttValue *hepRepAttValue)
 
void addAttValue (std::string key, char *value, int showLabel)
 
void addAttValue (std::string key, std::string value, int showLabel)
 
void addAttValue (std::string key, int value, int showLabel)
 
void addAttValue (std::string key, int64 value, int showLabel)
 
void addAttValue (std::string key, double value, int showLabel)
 
void addAttValue (std::string key, bool value, int showLabel)
 
void addAttValue (std::string key, std::vector< double > value, int showLabel)
 
void addAttValue (std::string key, double red, double green, double blue, double alpha, int showLabel)
 
HEPREP::HepRepAttValuegetAttValueFromNode (std::string lowerCaseName)
 
HEPREP::HepRepAttValueremoveAttValue (std::string key)
 
HEPREP::HepRepAttValuegetAttValue (std::string name)=0
 
- Public Member Functions inherited from HEPREP::HepRepAttribute
virtual ~HepRepAttribute ()
 Destructor.
 
virtual void addAttValue (HepRepAttValue *attValue)=0
 
virtual void addAttValue (std::string key, char *value, int showLabel=HepRepConstants::SHOW_NONE)=0
 
virtual void addAttValue (std::string key, std::string value, int showLabel=HepRepConstants::SHOW_NONE)=0
 
virtual void addAttValue (std::string key, int64 value, int showLabel=HepRepConstants::SHOW_NONE)=0
 
virtual void addAttValue (std::string key, int value, int showLabel=HepRepConstants::SHOW_NONE)=0
 
virtual void addAttValue (std::string key, double value, int showLabel=HepRepConstants::SHOW_NONE)=0
 
virtual void addAttValue (std::string key, bool value, int showLabel=HepRepConstants::SHOW_NONE)=0
 
virtual void addAttValue (std::string key, std::vector< double > value, int showLabel=HepRepConstants::SHOW_NONE)=0
 
virtual void addAttValue (std::string key, double red, double green, double blue, double alpha=1.0, int showLabel=HepRepConstants::SHOW_NONE)=0
 
virtual HepRepAttValueremoveAttValue (std::string key)=0
 
virtual HepRepAttValuegetAttValue (std::string name)=0
 
virtual std::set< HepRepAttValue * > getAttValuesFromNode ()=0
 
virtual HepRepAttValuegetAttValueFromNode (std::string lowerCaseName)=0
 

Detailed Description

Definition at line 22 of file DefaultHepRepAttribute.h.

Constructor & Destructor Documentation

◆ DefaultHepRepAttribute()

cheprep::DefaultHepRepAttribute::DefaultHepRepAttribute ( )

Definition at line 20 of file DefaultHepRepAttribute.cc.

20 {
21}

◆ ~DefaultHepRepAttribute()

cheprep::DefaultHepRepAttribute::~DefaultHepRepAttribute ( )

Definition at line 23 of file DefaultHepRepAttribute.cc.

23 {
24 for (map<string, HepRepAttValue*>::iterator i = attValues.begin(); i != attValues.end(); i++) {
25 delete (*i).second;
26 }
27}

Member Function Documentation

◆ addAttValue() [1/9]

void cheprep::DefaultHepRepAttribute::addAttValue ( HEPREP::HepRepAttValue attValue)
virtual

Adds an attValue.

Parameters
attValueto be added.

Implements HEPREP::HepRepAttribute.

Definition at line 37 of file DefaultHepRepAttribute.cc.

37 {
38 string lowerCaseName = hepRepAttValue->getLowerCaseName();
39 if (attValues[lowerCaseName] != NULL) delete attValues[lowerCaseName];
40 attValues[lowerCaseName] = hepRepAttValue;
41}

Referenced by addAttValue().

◆ addAttValue() [2/9]

void cheprep::DefaultHepRepAttribute::addAttValue ( std::string  key,
bool  value,
int  showLabel 
)
virtual

Adds an attValue.

Parameters
keyname of attValue
valuevalue of attValue
showLabelshow this as label

Implements HEPREP::HepRepAttribute.

Definition at line 63 of file DefaultHepRepAttribute.cc.

63 {
64 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
65}
void addAttValue(HEPREP::HepRepAttValue *hepRepAttValue)

◆ addAttValue() [3/9]

void cheprep::DefaultHepRepAttribute::addAttValue ( std::string  key,
char *  value,
int  showLabel 
)
virtual

Adds a char* attValue as a String. This call should be mapped to addAttValue(std::string, std::string, int); and necessary because C++ converts char* into bool and would thus call addAttValue(std::string, bool, int) for a call such as addAttValue("drawAs", "Cylinder", 0);

Parameters
keyname of attValue
valuevalue of attValue
showLabelshow this as label

Implements HEPREP::HepRepAttribute.

Definition at line 43 of file DefaultHepRepAttribute.cc.

43 {
44 addAttValue(key, (std::string)value, showLabel);
45}

◆ addAttValue() [4/9]

void cheprep::DefaultHepRepAttribute::addAttValue ( std::string  key,
double  red,
double  green,
double  blue,
double  alpha,
int  showLabel 
)
virtual

Adds a Color attValue.

Parameters
keyname of attValue
redcolor
greencolor
bluecolor
alphavalue
showLabelshow this as label

Implements HEPREP::HepRepAttribute.

Definition at line 71 of file DefaultHepRepAttribute.cc.

71 {
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}

◆ addAttValue() [5/9]

void cheprep::DefaultHepRepAttribute::addAttValue ( std::string  key,
double  value,
int  showLabel 
)
virtual

Adds an attValue.

Parameters
keyname of attValue
valuevalue of attValue
showLabelshow this as label

Implements HEPREP::HepRepAttribute.

Definition at line 59 of file DefaultHepRepAttribute.cc.

59 {
60 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
61}

◆ addAttValue() [6/9]

void cheprep::DefaultHepRepAttribute::addAttValue ( std::string  key,
int  value,
int  showLabel 
)
virtual

Adds an attValue.

Parameters
keyname of attValue
valuevalue of attValue
showLabelshow this as label

Implements HEPREP::HepRepAttribute.

Definition at line 55 of file DefaultHepRepAttribute.cc.

55 {
56 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
57}

◆ addAttValue() [7/9]

void cheprep::DefaultHepRepAttribute::addAttValue ( std::string  key,
int64  value,
int  showLabel 
)
virtual

Adds an attValue.

Parameters
keyname of attValue
valuevalue of attValue
showLabelshow this as label

Implements HEPREP::HepRepAttribute.

Definition at line 51 of file DefaultHepRepAttribute.cc.

51 {
52 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
53}

◆ addAttValue() [8/9]

void cheprep::DefaultHepRepAttribute::addAttValue ( std::string  key,
std::string  value,
int  showLabel 
)
virtual

Adds an attValue.

Parameters
keyname of attValue
valuevalue of attValue
showLabelshow this as label

Implements HEPREP::HepRepAttribute.

Definition at line 47 of file DefaultHepRepAttribute.cc.

47 {
48 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
49}

◆ addAttValue() [9/9]

void cheprep::DefaultHepRepAttribute::addAttValue ( std::string  key,
std::vector< double >  value,
int  showLabel 
)
virtual

Adds a Color attValue.

Parameters
keyname of attValue
valuevalue of attValue
showLabelshow this as label

Implements HEPREP::HepRepAttribute.

Definition at line 67 of file DefaultHepRepAttribute.cc.

67 {
68 addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
69}

◆ getAttValue()

HEPREP::HepRepAttValue * cheprep::DefaultHepRepAttribute::getAttValue ( std::string  name)
pure virtual

Returns the attValue specified by name. This attValue is normally searched on the node itself and then on its type, moving up the typetree.

Parameters
nameof attribute value.
Returns
attribute value.

Implements HEPREP::HepRepAttribute.

Implemented in cheprep::DefaultHepRepPoint, cheprep::DefaultHepRepInstance, cheprep::DefaultHepRepType, and cheprep::DefaultHepRepDefinition.

◆ getAttValueFromNode()

HepRepAttValue * cheprep::DefaultHepRepAttribute::getAttValueFromNode ( std::string  lowerCaseName)
virtual

Returns a named attribute value from this node.

Parameters
lowerCaseNamename in all lowercase.
Returns
corresponding HepRepAttValue.

Implements HEPREP::HepRepAttribute.

Definition at line 80 of file DefaultHepRepAttribute.cc.

80 {
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}
const char * name(G4int ptype)

Referenced by cheprep::DefaultHepRepPoint::getAttValue(), and cheprep::DefaultHepRepInstance::getAttValue().

◆ getAttValuesFromNode()

set< HepRepAttValue * > cheprep::DefaultHepRepAttribute::getAttValuesFromNode ( )
virtual

Returns a collection of all attribute values from this node.

Returns
collection of HepRepAttValues.

Implements HEPREP::HepRepAttribute.

Definition at line 29 of file DefaultHepRepAttribute.cc.

29 {
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}

◆ removeAttValue()

HepRepAttValue * cheprep::DefaultHepRepAttribute::removeAttValue ( std::string  key)
virtual

Remove the attvalue named by key.

Parameters
keyname of the attValue to be removed.
Returns
removed HepRepAttValue, or null if not removed.

Implements HEPREP::HepRepAttribute.

Definition at line 86 of file DefaultHepRepAttribute.cc.

86 {
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}

The documentation for this class was generated from the following files: