2 * AliEMCALConfigurationObject.h
4 * Created on: 06.11.2014
8 #ifndef _ALIJSONDATA_H_
9 #define _ALIJSONDATA_H_
14 /************************************************************
16 * Declaration of wrapper types used in the JSON handling
18 * **********************************************************/
20 class AliJSONValue : public TObject {
23 virtual ~AliJSONValue() {}
25 virtual const char *ToString() const = 0;
27 ClassDef(AliJSONValue,1);
30 class AliJSONInt : public AliJSONValue{
32 AliJSONInt(Int_t val):
36 virtual ~AliJSONInt() {}
38 void SetValue(Int_t value) { fValue = value; }
39 Int_t GetValue() const { return fValue; }
41 virtual const char *ToString() const ;
45 ClassDef(AliJSONInt,1);
48 class AliJSONFloat : public AliJSONValue{
50 AliJSONFloat(Float_t val):
54 virtual ~AliJSONFloat() {}
56 void SetValue(Float_t value) { fValue = value; }
57 Float_t GetValue() const { return fValue; }
59 virtual const char *ToString() const;
63 ClassDef(AliJSONFloat,1);
66 class AliJSONDouble : public AliJSONValue{
68 AliJSONDouble(Double_t val):
72 virtual ~AliJSONDouble() {}
74 void SetValue(Double_t value) { fValue = value; }
75 Double_t GetValue() const { return fValue; }
77 virtual const char *ToString() const;
81 ClassDef(AliJSONDouble,1);
84 class AliJSONBool : public AliJSONValue{
86 AliJSONBool(Bool_t val):
90 virtual ~AliJSONBool() {}
92 void SetValue(Bool_t value) { fValue = value; }
93 Bool_t GetValue() const { return fValue; }
95 virtual const char *ToString() const { return fValue ? "true" : "false"; }
99 ClassDef(AliJSONBool,1);
102 class AliJSONString : public AliJSONValue{
104 AliJSONString(const char *val):
108 virtual ~AliJSONString() {}
110 void SetValue(const char * value) { fValue = value; }
111 const char * GetValue() const { return fValue; }
113 virtual const char *ToString() const { return fValue; }
117 ClassDef(AliJSONString,1);
120 /********************************************************************
122 * Declaration of the JSON key-value pair *
124 ********************************************************************/
126 class AliJSONData : public TNamed {
128 AliJSONData(const char *name, AliJSONValue *value):
132 AliJSONData(const char *key, const char *value);
134 virtual ~AliJSONData(){
138 void SetValue(AliJSONValue *val){
139 if(fValue) delete fValue;
143 AliJSONValue *GetValue() const { return fValue; }
144 const char *ToString() const;
147 AliJSONData(const AliJSONData &ref);
148 AliJSONData &operator=(const AliJSONData &ref);
150 AliJSONValue *fValue;
152 ClassDef(AliJSONData, 1);
155 std::ostream &operator<<(std::ostream &, const AliJSONValue &);
156 std::ostream &operator<<(std::ostream &, const AliJSONData &);
158 #endif /* _ALIJSONDATA_H_ */