* Created on: 06.11.2014
* Author: markusfasel
*/
+#include <cstring>
#include <sstream>
+#include <iostream>
#include <TList.h>
#include "AliEMCALJSONReader.h"
}
jsonbuilder << "}";
return jsonbuilder.str().c_str();
+/*
+ std::cout << "My json string " << jsonbuilder.str().c_str() << std::endl;
+ char * result = new char[jsonbuilder.str().length()];
+ strcpy(result, jsonbuilder.str().c_str());
+ return result;
+*/
+
+}
+
+std::ostream &operator<<(std::ostream & os, const AliEMCALConfiguration &conf){
+ os << conf.CreateJSONString();
+ return os;
}
#ifndef PWG_EMCAL_ALIEMCALCONFIGURATION_H_
#define PWG_EMCAL_ALIEMCALCONFIGURATION_H_
+#include <ostream>
#include <TNamed.h>
class TList;
ClassDef(AliEMCALConfiguration, 1);
};
+std::ostream &operator<<(std::ostream &, const AliEMCALConfiguration &);
+
#endif /* PWG_EMCAL_ALIEMCALCONFIGURATION_H_ */
#include <AliEMCALConfigurationObject.h>
+ClassImp(AliEMCALConfigurationValue)
+ClassImp(AliEMCALConfigurationValueInt)
+ClassImp(AliEMCALConfigurationValueFloat)
+ClassImp(AliEMCALConfigurationValueDouble)
+ClassImp(AliEMCALConfigurationValueBool)
+ClassImp(AliEMCALConfigurationValueString)
+ClassImp(AliEMCALConfigurationObject)
const char* AliEMCALConfigurationValueInt::ToString() const {
std::stringstream stringbuilder;
jsonbuilder << "\"" << GetName() << "\":\"" << fValue->ToString() << "\"";
return jsonbuilder.str().c_str();
}
+
+std::ostream &operator<<(std::ostream &os, const AliEMCALConfigurationValue &val){
+ os << val.ToString();
+ return os;
+}
+
+std::ostream &operator<<(std::ostream &os, const AliEMCALConfigurationObject &obj){
+ os << obj.ToString();
+ return os;
+}
+
#ifndef PWG_EMCAL_ALIEMCALCONFIGURATIONOBJECT_H_
#define PWG_EMCAL_ALIEMCALCONFIGURATIONOBJECT_H_
+#include <ostream>
#include <TNamed.h>
-class AliEMCALConfigurationValue {
+class AliEMCALConfigurationValue : public TObject {
public:
AliEMCALConfigurationValue() {}
virtual ~AliEMCALConfigurationValue() {}
virtual const char *ToString() const = 0;
+
+ ClassDef(AliEMCALConfigurationValue,1);
};
class AliEMCALConfigurationValueInt : public AliEMCALConfigurationValue{
virtual const char *ToString() const ;
private:
Int_t fValue;
+
+ ClassDef(AliEMCALConfigurationValueInt,1);
};
class AliEMCALConfigurationValueFloat : public AliEMCALConfigurationValue{
virtual const char *ToString() const;
private:
Float_t fValue;
+
+ ClassDef(AliEMCALConfigurationValueFloat,1);
};
class AliEMCALConfigurationValueDouble : public AliEMCALConfigurationValue{
virtual const char *ToString() const;
private:
Double_t fValue;
+
+ ClassDef(AliEMCALConfigurationValueDouble,1);
};
class AliEMCALConfigurationValueBool : public AliEMCALConfigurationValue{
virtual const char *ToString() const { return fValue ? "true" : "false"; }
private:
Bool_t fValue;
+
+ ClassDef(AliEMCALConfigurationValueBool,1);
};
class AliEMCALConfigurationValueString : public AliEMCALConfigurationValue{
virtual const char *ToString() const { return fValue; }
private:
TString fValue;
+
+ ClassDef(AliEMCALConfigurationValueString,1);
};
class AliEMCALConfigurationObject : public TNamed {
AliEMCALConfigurationObject &operator=(const AliEMCALConfigurationObject &ref);
AliEMCALConfigurationValue *fValue;
+
+ ClassDef(AliEMCALConfigurationObject, 1);
};
+std::ostream &operator<<(std::ostream &, const AliEMCALConfigurationValue &);
+std::ostream &operator<<(std::ostream &, const AliEMCALConfigurationObject &);
+
#endif /* PWG_EMCAL_ALIEMCALCONFIGURATIONOBJECT_H_ */
#pragma link C++ class AliEMCALJSONReader+;
#pragma link C++ class AliEMCALConfiguration+;
#pragma link C++ class AliEMCALConfigHandler+;
+#pragma link C++ class AliEMCALConfigurationObject+;
+#pragma link C++ class AliEMCALConfigurationValue+;
+#pragma link C++ class AliEMCALConfigurationValueInt+;
+#pragma link C++ class AliEMCALConfigurationValueFloat+;
+#pragma link C++ class AliEMCALConfigurationValueDouble+;
+#pragma link C++ class AliEMCALConfigurationValueBool+;
+#pragma link C++ class AliEMCALConfigurationValueString+;
#endif