2 * AliEMCALConfigurationObject.cxx
4 * Created on: 06.11.2014
10 #include <AliEMCALConfigurationObject.h>
12 ClassImp(AliEMCALConfigurationValue)
13 ClassImp(AliEMCALConfigurationValueInt)
14 ClassImp(AliEMCALConfigurationValueFloat)
15 ClassImp(AliEMCALConfigurationValueDouble)
16 ClassImp(AliEMCALConfigurationValueBool)
17 ClassImp(AliEMCALConfigurationValueString)
18 ClassImp(AliEMCALConfigurationObject)
20 const char* AliEMCALConfigurationValueInt::ToString() const {
21 std::stringstream stringbuilder;
22 stringbuilder << fValue;
23 return stringbuilder.str().c_str();
26 const char* AliEMCALConfigurationValueFloat::ToString() const {
27 std::stringstream stringbuilder;
28 stringbuilder << fValue;
29 return stringbuilder.str().c_str();
32 const char* AliEMCALConfigurationValueDouble::ToString() const {
33 std::stringstream stringbuilder;
34 stringbuilder << fValue;
35 return stringbuilder.str().c_str();
38 AliEMCALConfigurationObject::AliEMCALConfigurationObject(const char* key, const char* value):
42 TString valstring(value);
43 if(!valstring.CompareTo("true"))
44 fValue = new AliEMCALConfigurationValueBool(kTRUE);
45 else if(!valstring.CompareTo("false"))
46 fValue = new AliEMCALConfigurationValueBool(kFALSE);
47 else if(valstring.IsDigit()){
48 if(valstring.IsFloat())
49 fValue = new AliEMCALConfigurationValueDouble(valstring.Atof());
51 fValue = new AliEMCALConfigurationValueInt(valstring.Atoi());
53 fValue = new AliEMCALConfigurationValueString(value);
56 const char* AliEMCALConfigurationObject::ToString() const {
57 std::stringstream jsonbuilder;
58 jsonbuilder << "\"" << GetName() << "\":\"" << fValue->ToString() << "\"";
59 return jsonbuilder.str().c_str();
62 std::ostream &operator<<(std::ostream &os, const AliEMCALConfigurationValue &val){
67 std::ostream &operator<<(std::ostream &os, const AliEMCALConfigurationObject &obj){