Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

DbObject.h

Go to the documentation of this file.
00001 //====================================================================
00002 //      DbObject definition
00003 //--------------------------------------------------------------------
00004 //
00005 //      Package    : DbCnv/DbSvc ( The LHCb Offline System)
00006 //
00007 //  Description: Generic persistable object
00008 //
00009 //      Author     : M.Frank
00010 //  History    :
00011 // +---------+----------------------------------------------+---------
00012 // |    Date |                 Comment                      | Who     
00013 // +---------+----------------------------------------------+---------
00014 // | 11/07/99| Initial version                              | MF
00015 // +---------+----------------------------------------------+---------
00016 //====================================================================
00017 #ifndef DBCNV_DBOBJECT_H
00018 #define DBCNV_DBOBJECT_H 1
00019 
00020 // Framework include files
00021 #include "GaudiDb/DbOOMs.h"
00022 // STL include files
00023 #include <string>
00024 
00025 // Forward declarations
00026 class StreamBuffer;
00027 class PersistentObject;
00028 class DbPersistentGuard;
00029 class DbTypeInfo;
00030 class DbObject;
00031 class DbLink;
00032 template <class T>  class dbVarray;
00033 template <class T>  class dbHandle;
00034 template <class T>  class DbWrapper;
00035 template <class T>  class DbFactory;
00036 
00061 class DbObject    {
00062   // That's my friend, the real persistent part!
00063   friend DbPersistent;
00064   friend class DbObjectAccessor;
00065   friend dbHandle<DbObject>;
00066   friend DbWrapper<DbObject>;
00067   friend DbFactory<DbObject>;
00068 protected:
00069   union  Internals    {
00070   public:
00071     long               m_objSize;
00072     DbPersistentGuard* m_guard;
00073   };
00074   mutable Internals m_internals;
00076   static void decreaseCounter();
00078   static void increaseCounter();
00080   static void badAssignMessage();
00082   unsigned char storageType()   const;
00084   virtual ~DbObject();
00085 public:
00087   static long numInstances();
00089   static DbObject* create(void* buffer);
00091   void* operator new(size_t size, const DbTypeInfo& info);
00093   void* operator new(size_t size, dbHandle<DbContainer>& cntHdl, const DbTypeInfo& info);
00095   void* operator new(size_t size);
00097   void operator delete(void* ptr);
00099   void operator delete(void *ptr, const DbTypeInfo& info);
00101   void operator delete(void *ptr, dbHandle<DbContainer>& cntHdl, const DbTypeInfo& info);
00103   DbObject();
00105   long addRef();
00107   long release();
00109   virtual bool deleteObject();
00111   DbResult addAssocEntry(const std::string& db, const std::string& cnt, const std::string& obj, dbHandle<DbLink>& result);
00113   long addLink(const std::string& db, const std::string& cnt, const std::string& obj, const dbHandle<DbLink>& lnk);
00115   long addInvalidLink();
00116   // Check if object is persistent
00117   bool isPersistent()   const;
00119   long numLink()    const;
00121   dbVarray< dbHandle<DbLink> >& links();
00123   const dbVarray< dbHandle<DbLink> >& links()  const;
00125   StreamBuffer& streamBuffer();
00127   StreamBuffer& linkBuffer();
00129   long bufferSize() const;
00131   long objSize()  const;
00133   void setObjSize(long length);
00135   long linkSize()  const   {
00136     return bufferSize() - objSize();
00137   }
00138 };
00139 
00140 #endif  // DBCNV_DBOBJECT_H

Generated at Wed Nov 21 12:22:20 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000