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

GenericAddress.h

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/GaudiKernel/GaudiKernel/GenericAddress.h,v 1.1.1.1 2001/04/18 18:14:18 tlindner Exp $
00002 #ifndef GAUDIKERNEL_GENERICADDRESS_H
00003 #define GAUDIKERNEL_GENERICADDRESS_H
00004 
00005 // C/C++ include files
00006 #include <string>
00007 // Framework include files
00008 #include "GaudiKernel/Kernel.h"
00009 #include "GaudiKernel/GenericLink.h"
00010 #include "GaudiKernel/IOpaqueAddress.h"
00011 #include "GaudiKernel/IDataDirectory.h"
00012 
00022 class GenericAddress   : virtual public IOpaqueAddress, public GenericLink   {
00023 public:
00025   typedef GenericAddress* (*AddressCreator)(const GenericLink&);
00026 
00027 private:
00029   unsigned long   m_refCount;
00030 
00031 protected:
00033   std::string     m_dbName;
00035   std::string     m_containerName;
00037   std::string     m_objectName;
00039   IDataDirectory* m_directory;
00040 
00041 public:
00043   GenericAddress() : m_refCount(0), m_directory(0)
00044   {
00045   }
00047   GenericAddress(const GenericAddress& copy)  
00048     : GenericLink(copy),
00049       m_refCount(0),
00050       m_dbName(copy.m_dbName),
00051       m_containerName(copy.m_containerName),
00052       m_objectName(copy.m_objectName),
00053       m_directory(copy.m_directory)
00054   {
00055   }
00057   GenericAddress(const GenericAddress* copy)  
00058     : GenericLink(copy),
00059       m_refCount(0),
00060       m_dbName(copy->m_dbName),
00061       m_containerName(copy->m_containerName),
00062       m_objectName(copy->m_objectName),
00063       m_directory(copy->m_directory)
00064   {
00065   }
00067   GenericAddress(const GenericLinkBase& lnk)  
00068     : GenericLink(lnk),
00069       m_refCount(0),
00070       m_directory(0)
00071   {
00072   }
00074   GenericAddress(const GenericLinkBase* lnk)  
00075     : GenericLink(*lnk),
00076       m_refCount(0),
00077       m_directory(0)
00078   {
00079   }
00081   GenericAddress(unsigned char type, const CLID& clid, IDataDirectory* dir = 0)
00082     : GenericLink(type, clid), m_refCount(0) 
00083   {
00084     m_directory = dir;
00085   }
00087   virtual ~GenericAddress()   {
00088   }
00089 
00091   virtual unsigned long addRef   ()   {
00092     return ++m_refCount;
00093   }
00095   virtual unsigned long release  ()   {
00096     int cnt = --m_refCount;
00097     if ( 0 == cnt )   {
00098       delete this;
00099     }
00100     return cnt;
00101   }
00103   virtual IOpaqueAddress* address()  {
00104     return this;
00105   }
00107   virtual IDataDirectory* directory()   {
00108     return m_directory;
00109   }
00111   virtual void setDirectory(IDataDirectory* pDirectory)   {
00112     m_directory = pDirectory;
00113     if ( 0 == pDirectory ) {
00114         setObjectName( "" );
00115     } else {
00116         setObjectName( pDirectory->name( ) );
00117     }
00118   }
00120   virtual void setDbName(const std::string& dbName)   {
00121     m_dbName = dbName;
00122   }
00124   virtual const std::string& dbName         () const   {
00125     return m_dbName;
00126   }
00128   virtual void setContainerName(const std::string& cntName)   {
00129     m_containerName = cntName;
00130   }
00132   virtual const std::string& containerName  () const   {
00133     return m_containerName;
00134   }
00136   virtual void setObjectName(const std::string& objName)   {
00137     m_objectName = objName;
00138   }
00140   virtual const std::string& objectName     () const   {
00141     return m_objectName;
00142   }
00144   virtual const CLID& clID()    const   {
00145     return GenericLink::clID();
00146   }
00148   virtual unsigned char svcType()  const {
00149     return GenericLink::svcType();
00150   }
00152   virtual GenericLink* genericLink   ()    {
00153     return this;
00154   }
00155 };
00156 #endif // GAUDIKERNEL_GENERICADDRESS_H
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 
00165 
00166 
00167 

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