00001 // $Header: /local/reps/Gaudi/GaudiKernel/GaudiKernel/DataObject.h,v 1.10 2008/11/12 23:39:47 marcocle Exp $ 00002 #ifndef GAUDIKERNEL_DATAOBJECT_H 00003 #define GAUDIKERNEL_DATAOBJECT_H 00004 00005 // Framework include files 00006 #include "GaudiKernel/ClassID.h" 00007 #include "GaudiKernel/StatusCode.h" 00008 00009 // STL includes 00010 #include <string> 00011 #include <ostream> 00012 00013 // Forward declarations 00014 class IOpaqueAddress; 00015 class StreamBuffer; 00016 class LinkManager; 00017 class IRegistry; 00018 00019 00020 // Definition of the CLID for this class 00021 static const CLID CLID_DataObject = 1; 00022 00031 class DataObject { 00032 private: 00034 unsigned long m_refCount; 00036 unsigned char m_version; 00038 IRegistry* m_pRegistry; 00040 LinkManager* m_pLinkMgr; 00041 00042 public: 00044 DataObject(); 00046 DataObject(const DataObject&); 00048 virtual ~DataObject(); 00050 virtual unsigned long addRef(); 00052 virtual unsigned long release(); 00054 virtual const CLID& clID() const; 00056 static const CLID& classID(); 00058 const std::string& name() const; 00059 00061 virtual StreamBuffer& serialize(StreamBuffer& s); 00063 virtual StreamBuffer& serialize(StreamBuffer& s) const; 00064 00066 00067 void setRegistry(IRegistry* pRegistry) { 00068 m_pRegistry = pRegistry; 00069 } 00071 IRegistry* registry() const { 00072 return m_pRegistry; 00073 } 00075 LinkManager* linkMgr() const { 00076 return m_pLinkMgr; 00077 } 00079 unsigned char version() const { 00080 return m_version; 00081 } 00083 void setVersion(unsigned char vsn) { 00084 m_version = vsn; 00085 } 00087 unsigned long refCount() const { 00088 return m_refCount; 00089 } 00091 virtual std::ostream& fillStream( std::ostream& s ) const { 00092 s << "DataObject at " << std::hex << this; 00093 return s; 00094 } 00096 friend std::ostream& operator<< ( std::ostream& s, const DataObject& obj ) { 00097 return obj.fillStream(s); 00098 } 00099 }; 00100 00101 // Additional functions to support the Serialialization of objects in the transient store 00102 00103 namespace Gaudi 00104 { 00105 void pushCurrentDataObject(DataObject** pobjAddr); 00106 void popCurrentDataObject(); 00107 DataObject* getCurrentDataObject(); 00108 } 00109 00110 00111 #endif // GAUDIKERNEL_DATAOBJECT_H