]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- Derive value types from TObject so that they can be used in CINT
authormfasel <mfasel@lbl.gov>
Wed, 12 Nov 2014 15:04:47 +0000 (16:04 +0100)
committermfasel <mfasel@lbl.gov>
Fri, 21 Nov 2014 12:16:19 +0000 (13:16 +0100)
- Implement ostream operators

PWG/EMCAL/AliEMCALConfiguration.cxx
PWG/EMCAL/AliEMCALConfiguration.h
PWG/EMCAL/AliEMCALConfigurationObject.cxx
PWG/EMCAL/AliEMCALConfigurationObject.h
PWG/PWGEMCALLinkDef.h

index 8cc8fdd5a9425437b43f8a80dafeebd810f620f5..979b4fb4ac9166660144ed3bb092fc19476da0e8 100644 (file)
@@ -4,7 +4,9 @@
  *  Created on: 06.11.2014
  *      Author: markusfasel
  */
+#include <cstring>
 #include <sstream>
+#include <iostream>
 #include <TList.h>
 
 #include "AliEMCALJSONReader.h"
@@ -82,4 +84,16 @@ const char* AliEMCALConfiguration::CreateJSONString() const {
   }
   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;
 }
index f0a1a7e49a60eec2824e8907cae39f7a52925b8f..223f7a24d2a3d3b65c6b7d9d170f5b58c6abac92 100644 (file)
@@ -8,6 +8,7 @@
 #ifndef PWG_EMCAL_ALIEMCALCONFIGURATION_H_
 #define PWG_EMCAL_ALIEMCALCONFIGURATION_H_
 
+#include <ostream>
 #include <TNamed.h>
 
 class TList;
@@ -35,4 +36,6 @@ private:
   ClassDef(AliEMCALConfiguration, 1);
 };
 
+std::ostream &operator<<(std::ostream &, const AliEMCALConfiguration &); 
+
 #endif /* PWG_EMCAL_ALIEMCALCONFIGURATION_H_ */
index 2a0c11f14f38572e6ccc2b401a6b96254663137b..7cd68a8f0a32124373ec8f6421c57716176b50df 100644 (file)
@@ -9,6 +9,13 @@
 
 #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;
@@ -51,3 +58,14 @@ const char* AliEMCALConfigurationObject::ToString() const {
   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;
+}
+
index b64c614282cc627bc0089a7bafa78334b4ce58ad..10b8554edeabfadbf8541a1b3f0abfcd0381fedb 100644 (file)
@@ -8,14 +8,17 @@
 #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{
@@ -32,6 +35,8 @@ public:
   virtual const char *ToString() const ;
 private:
   Int_t fValue;
+
+  ClassDef(AliEMCALConfigurationValueInt,1);
 };
 
 class AliEMCALConfigurationValueFloat : public AliEMCALConfigurationValue{
@@ -48,6 +53,8 @@ public:
   virtual const char *ToString() const;
 private:
   Float_t fValue;
+
+  ClassDef(AliEMCALConfigurationValueFloat,1);
 };
 
 class AliEMCALConfigurationValueDouble : public AliEMCALConfigurationValue{
@@ -64,6 +71,8 @@ public:
   virtual const char *ToString() const;
 private:
   Double_t fValue;
+
+  ClassDef(AliEMCALConfigurationValueDouble,1);
 };
 
 class AliEMCALConfigurationValueBool : public AliEMCALConfigurationValue{
@@ -80,6 +89,8 @@ public:
   virtual const char *ToString() const { return fValue ? "true" : "false"; }
 private:
   Bool_t fValue;
+
+  ClassDef(AliEMCALConfigurationValueBool,1);
 };
 
 class AliEMCALConfigurationValueString : public AliEMCALConfigurationValue{
@@ -96,6 +107,8 @@ public:
   virtual const char *ToString() const { return fValue; }
 private:
   TString fValue;
+
+  ClassDef(AliEMCALConfigurationValueString,1);
 };
 
 class AliEMCALConfigurationObject : public TNamed {
@@ -123,6 +136,11 @@ protected:
   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_ */
index 303997a8f55522ae96af13bfdf411dfc7855dade..ad5e6c3a4eb292f9364933bbe3703cff0b661f40 100644 (file)
 #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