Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cheprep::DefaultHepRepAttribute Class Referenceabstract

#include <DefaultHepRepAttribute.h>

Inheritance diagram for cheprep::DefaultHepRepAttribute:
Collaboration 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. More...
 

Detailed Description

Definition at line 23 of file DefaultHepRepAttribute.h.

Constructor & Destructor Documentation

cheprep::DefaultHepRepAttribute::DefaultHepRepAttribute ( )

Definition at line 21 of file DefaultHepRepAttribute.cc.

21  {
22 }
cheprep::DefaultHepRepAttribute::~DefaultHepRepAttribute ( )

Definition at line 24 of file DefaultHepRepAttribute.cc.

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

Member Function Documentation

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

Adds an attValue.

Parameters
attValueto be added.

Implements HEPREP::HepRepAttribute.

Definition at line 38 of file DefaultHepRepAttribute.cc.

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

Here is the call graph for this function:

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 44 of file DefaultHepRepAttribute.cc.

44  {
45  addAttValue(key, (std::string)value, showLabel);
46 }
void addAttValue(HEPREP::HepRepAttValue *hepRepAttValue)
const XML_Char int const XML_Char * value
Definition: expat.h:331
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 48 of file DefaultHepRepAttribute.cc.

48  {
49  addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
50 }
void addAttValue(HEPREP::HepRepAttValue *hepRepAttValue)
const XML_Char int const XML_Char * value
Definition: expat.h:331
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 56 of file DefaultHepRepAttribute.cc.

56  {
57  addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
58 }
void addAttValue(HEPREP::HepRepAttValue *hepRepAttValue)
const XML_Char int const XML_Char * value
Definition: expat.h:331
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 52 of file DefaultHepRepAttribute.cc.

52  {
53  addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
54 }
void addAttValue(HEPREP::HepRepAttValue *hepRepAttValue)
const XML_Char int const XML_Char * value
Definition: expat.h:331
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 60 of file DefaultHepRepAttribute.cc.

60  {
61  addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
62 }
void addAttValue(HEPREP::HepRepAttValue *hepRepAttValue)
const XML_Char int const XML_Char * value
Definition: expat.h:331
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 64 of file DefaultHepRepAttribute.cc.

64  {
65  addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
66 }
void addAttValue(HEPREP::HepRepAttValue *hepRepAttValue)
const XML_Char int const XML_Char * value
Definition: expat.h:331
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 68 of file DefaultHepRepAttribute.cc.

68  {
69  addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
70 }
void addAttValue(HEPREP::HepRepAttValue *hepRepAttValue)
const XML_Char int const XML_Char * value
Definition: expat.h:331
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 72 of file DefaultHepRepAttribute.cc.

72  {
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 }
Definition: test07.cc:36
Definition: test07.cc:36
void addAttValue(HEPREP::HepRepAttValue *hepRepAttValue)
static const G4double alpha
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::DefaultHepRepInstance, cheprep::DefaultHepRepType, cheprep::DefaultHepRepDefinition, and cheprep::DefaultHepRepPoint.

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 81 of file DefaultHepRepAttribute.cc.

81  {
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 }
const XML_Char * name
Definition: expat.h:151
const XML_Char * s
Definition: expat.h:262
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)

Here is the call graph for this function:

Here is the caller graph for this function:

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 30 of file DefaultHepRepAttribute.cc.

30  {
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 }
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 87 of file DefaultHepRepAttribute.cc.

87  {
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 }
const XML_Char * name
Definition: expat.h:151
const XML_Char * s
Definition: expat.h:262
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)

Here is the call graph for this function:


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