1 | // Copyright FreeHEP, 2005. |
---|
2 | #ifndef CHEPREP_DEFAULTHEPREPATTVALUE_H |
---|
3 | #define CHEPREP_DEFAULTHEPREPATTVALUE_H 1 |
---|
4 | |
---|
5 | #include "cheprep/config.h" |
---|
6 | |
---|
7 | #include <string> |
---|
8 | |
---|
9 | #include "HEPREP/HepRepAttValue.h" |
---|
10 | |
---|
11 | /** |
---|
12 | * @author Mark Donszelmann |
---|
13 | * @version $Id: DefaultHepRepAttValue.h,v 1.3 2005/06/02 21:28:45 duns Exp $ |
---|
14 | */ |
---|
15 | namespace cheprep { |
---|
16 | |
---|
17 | class DefaultHepRepAttValue : public virtual HEPREP::HepRepAttValue { |
---|
18 | |
---|
19 | private: |
---|
20 | enum { LABELSTRINGS_LEN = 4 }; |
---|
21 | std::string name; |
---|
22 | int type; |
---|
23 | |
---|
24 | // values implemented as separate items, so that they do not take up unnecessary space for an Object |
---|
25 | // only ONE of these is filled |
---|
26 | std::string stringValue; |
---|
27 | int64 longValue; |
---|
28 | double doubleValue; |
---|
29 | bool booleanValue; |
---|
30 | std::vector<double> colorValue; |
---|
31 | |
---|
32 | int showLabelValue; |
---|
33 | static std::string labelStrings[LABELSTRINGS_LEN]; |
---|
34 | |
---|
35 | void init(); |
---|
36 | |
---|
37 | public: |
---|
38 | DefaultHepRepAttValue(std::string name, std::string value, int showLabel); |
---|
39 | DefaultHepRepAttValue(std::string name, int64 value, int showLabel); |
---|
40 | DefaultHepRepAttValue(std::string name, int value, int showLabel); |
---|
41 | DefaultHepRepAttValue(std::string name, double value, int showLabel); |
---|
42 | DefaultHepRepAttValue(std::string name, bool value, int showLabel); |
---|
43 | DefaultHepRepAttValue(std::string name, std::vector<double> value, int showLabel); |
---|
44 | ~DefaultHepRepAttValue(); |
---|
45 | |
---|
46 | HEPREP::HepRepAttValue* copy(); |
---|
47 | |
---|
48 | std::string getName(); |
---|
49 | std::string getLowerCaseName(); |
---|
50 | int getType(); |
---|
51 | std::string getTypeName(); |
---|
52 | int showLabel(); |
---|
53 | std::string getString(); |
---|
54 | std::string getLowerCaseString(); |
---|
55 | int64 getLong(); |
---|
56 | int getInteger(); |
---|
57 | double getDouble(); |
---|
58 | bool getBoolean(); |
---|
59 | std::vector<double> getColor(); |
---|
60 | |
---|
61 | std::string getAsString(); |
---|
62 | static std::string getAsString(std::vector<double> c); |
---|
63 | static std::string getAsString(int i); |
---|
64 | static std::string getAsString(int64 i); |
---|
65 | static std::string getAsString(double d); |
---|
66 | static std::string getAsString(bool b); |
---|
67 | |
---|
68 | std::string toShowLabel(); |
---|
69 | static std::string toShowLabel(int showLabel); |
---|
70 | }; |
---|
71 | |
---|
72 | } // cheprep |
---|
73 | |
---|
74 | |
---|
75 | #endif |
---|
76 | |
---|