17 using namespace HEPREP;
25 std::string DefaultHepRepAttValue::labelStrings[LABELSTRINGS_LEN];
27 DefaultHepRepAttValue::DefaultHepRepAttValue(
string aName,
string aValue,
int aShowLabel)
34 , showLabelValue(aShowLabel)
45 , showLabelValue(aShowLabel)
56 , showLabelValue(aShowLabel)
67 , showLabelValue(aShowLabel)
77 , booleanValue(aValue)
78 , showLabelValue(aShowLabel)
90 , showLabelValue(aShowLabel)
131 transform(s.begin(), s.end(), s.begin(), (
int(*)(
int)) tolower);
141 case HepRepConstants::TYPE_COLOR:
return(
"Color");
142 case HepRepConstants::TYPE_STRING:
return(
"String");
143 case HepRepConstants::TYPE_LONG:
return(
"long");
144 case HepRepConstants::TYPE_INT:
return(
"int");
145 case HepRepConstants::TYPE_DOUBLE:
return(
"double");
146 case HepRepConstants::TYPE_BOOLEAN:
return(
"boolean");
147 default:
return "Unknown type stored in HepRepAttDef";
156 if (
type != HepRepConstants::TYPE_STRING) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'string'" << endl;
161 if (
type != HepRepConstants::TYPE_STRING) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'string'" << endl;
163 transform(s.begin(), s.end(), s.begin(), (
int(*)(
int)) tolower);
168 if (
type != HepRepConstants::TYPE_LONG) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'long'" << endl;
173 if (
type != HepRepConstants::TYPE_INT) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'int'" << endl;
178 if (
type != HepRepConstants::TYPE_DOUBLE) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'double'" << endl;
183 if (
type != HepRepConstants::TYPE_BOOLEAN) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'boolean'" << endl;
188 if (
type != HepRepConstants::TYPE_COLOR) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'color'" << endl;
196 case HepRepConstants::TYPE_STRING:
return getString();
201 default:
return "Unknown typecode";
207 sprintf(buffer,
"%4.2f, %4.2f, %4.2f, %4.2f",
211 (c.size() > 3) ? c[3] : 1.0);
217 sprintf(buffer,
"%d", i);
230 sprintf(buffer,
"%g", d);
235 return b ?
"true" :
"false";
249 if (showLabel == HepRepConstants::SHOW_NONE) {
252 for (
int i=0; i<16; i++) {
253 if (((showLabel >> i) & 0x0001) == 0x0001) {
263 sprintf(hex,
"%0x", 1 << i);
std::string getLowerCaseName()
std::string getAsString()
std::string toShowLabel()
std::string getTypeName()
static std::string labelStrings[LABELSTRINGS_LEN]
HEPREP::HepRepAttValue * copy()
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
#define CHEPREP_INT64_FORMAT
DefaultHepRepAttValue(std::string name, std::string value, int showLabel)
std::string getLowerCaseString()
std::vector< double > getColor()
std::vector< double > colorValue