17 using namespace HEPREP;
24 std::string DefaultHepRepAttValue::labelStrings[LABELSTRINGS_LEN];
26 DefaultHepRepAttValue::DefaultHepRepAttValue(
string aName,
string aValue,
int aShowLabel)
33 , showLabelValue(aShowLabel)
44 , showLabelValue(aShowLabel)
55 , showLabelValue(aShowLabel)
66 , showLabelValue(aShowLabel)
76 , booleanValue(aValue)
77 , showLabelValue(aShowLabel)
89 , showLabelValue(aShowLabel)
140 case HepRepConstants::TYPE_COLOR:
return(
"Color");
141 case HepRepConstants::TYPE_STRING:
return(
"String");
142 case HepRepConstants::TYPE_LONG:
return(
"long");
143 case HepRepConstants::TYPE_INT:
return(
"int");
144 case HepRepConstants::TYPE_DOUBLE:
return(
"double");
145 case HepRepConstants::TYPE_BOOLEAN:
return(
"boolean");
146 default:
return "Unknown type stored in HepRepAttDef";
155 if (
type != HepRepConstants::TYPE_STRING) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'string'" << endl;
160 if (
type != HepRepConstants::TYPE_STRING) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'string'" << endl;
167 if (
type != HepRepConstants::TYPE_LONG) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'long'" << endl;
172 if (
type != HepRepConstants::TYPE_INT) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'int'" << endl;
177 if (
type != HepRepConstants::TYPE_DOUBLE) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'double'" << endl;
182 if (
type != HepRepConstants::TYPE_BOOLEAN) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'boolean'" << endl;
187 if (
type != HepRepConstants::TYPE_COLOR) cerr <<
"Trying to access AttValue '" <<
getName() <<
"' as 'color'" << endl;
195 case HepRepConstants::TYPE_STRING:
return getString();
200 default:
return "Unknown typecode";
206 sprintf(buffer,
"%4.2f, %4.2f, %4.2f, %4.2f",
210 (c.size() > 3) ? c[3] : 1.0);
216 sprintf(buffer,
"%d", i);
229 sprintf(buffer,
"%g", d);
234 return b ?
"true" :
"false";
248 if (showLabel == HepRepConstants::SHOW_NONE) {
251 for (
int i=0; i<16; i++) {
252 if (((showLabel >> i) & 0x0001) == 0x0001) {
262 sprintf(hex,
"%0x", 1 << i);