00001 #ifndef __PXXObject__H__ 00002 #define __PXXObject__H__ 00003 00022 00023 #include <string> 00024 #include "payloads-unpacker/base/PXXTypes.h" 00025 #include "TObject.h" 00026 00027 class PXXObject; 00028 00029 #ifdef __USEROOT__ // compile with ROOT 00030 #include "TError.h" 00031 #include "TROOT.h" 00032 typedef PXXObject* PXXObjectPtr; 00033 #define SET_LOGGER(X) // It do nothing but arrow compile with ROOT... 00034 00035 #else // compile woth IceTray 00036 #include "dataclasses/StoragePolicy.h" 00037 typedef shared_ptr<PXXObject> PXXObjectPtr; 00038 00039 #endif 00040 00041 using namespace std; 00042 00043 class PXXObject : public TObject { 00044 00045 public: 00046 00047 SET_LOGGER("PXXObject"); 00048 00052 PXXObject(); 00053 //------------------------------------------------------------------------------ 00054 00058 PXXObject(const PXXObject &org):TObject(org), fMyOwnerPtr_(0){} 00059 //------------------------------------------------------------------------------ 00060 00064 PXXObject &operator=(const PXXObject &orig) { return *this; } 00065 const PXXObject &operator=(const PXXObject &orig) const { return *this; } 00066 //------------------------------------------------------------------------------ 00067 00071 virtual ~PXXObject() {} 00072 //------------------------------------------------------------------------------ 00073 00078 virtual void SetOwnerPtr(void *ownerptr); 00079 //------------------------------------------------------------------------------ 00080 00084 virtual const void *GetOwnerPtr() const { return fMyOwnerPtr_; } 00085 //------------------------------------------------------------------------------ 00086 00091 virtual void InitializePointer(PXXObjectPtr objptr); 00092 //------------------------------------------------------------------------------ 00093 00101 virtual void Delete(PXXObjectPtr objptr); 00102 //------------------------------------------------------------------------------ 00103 00107 virtual string GetTypeName() const { return fTypeName_; } 00108 //------------------------------------------------------------------------------ 00109 00113 virtual void SetTypeName(const string &s) { fTypeName_ = s; } 00114 //------------------------------------------------------------------------------ 00115 00116 #ifdef __USEROOT__ 00117 00123 virtual void log_info(const char *va_(fmt), ...) const; 00124 //------------------------------------------------------------------------------ 00125 00131 virtual void log_warn(const char *va_(fmt), ...) const; 00132 //------------------------------------------------------------------------------ 00133 00139 virtual void log_error(const char *va_(fmt), ...) const; 00140 //------------------------------------------------------------------------------ 00141 00147 virtual void log_fatal(const char *va_(fmt), ...) const; 00148 //------------------------------------------------------------------------------ 00149 00154 virtual void log_debug(const char *va_(fmt), ...) const; 00155 //------------------------------------------------------------------------------ 00156 00157 #endif // __USEROOT__ 00158 00159 private: 00160 00161 void *fMyOwnerPtr_; // pointer to its owner object 00162 string fTypeName_; // type name which can include version tag 00163 00164 00165 ClassDef(PXXObject, 0) // Base of every unpacker classes 00166 00167 }; 00168 00169 00170 #include "payloads-unpacker/base/PXXPointerCasts.h" 00171 00172 #endif // __PXXObject_H__