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

DbBase.h

Go to the documentation of this file.
00001 //====================================================================
00002 //      DbCnv Base class definitions
00003 //--------------------------------------------------------------------
00004 //
00005 //      Package    : DbCnv ( The LHCb Offline System)
00006 //      Author     : M.Frank
00007 //====================================================================
00008 #ifndef DBCNV_DBBASE_H
00009 #define DBCNV_DBBASE_H 1
00010 
00011 // Framework include files
00012 #include "GaudiDb/DbOOMs.h"
00013 
00035 #include <cstdio>
00036 template <class T> class dbHandleBase    {
00037 protected:
00039   typedef  T             _DataType;
00041   mutable  _DataType*    m_ptr;
00043   mutable  unsigned char m_type;
00045   dbHandleBase() : m_ptr(0), m_type(0)      {
00046   }
00048   virtual ~dbHandleBase()     {
00049     if ( m_type == 0 || m_type > 15 )    {
00050       printf("Unknown storage TYPE!!!!\n");
00051     }
00052   }
00054   void setType(unsigned char type)   const  {
00055     m_type = type;
00056   }
00057 public:
00059   _DataType* operator->()             {    
00060     return const_cast<_DataType*>(m_ptr);
00061   }
00063   const _DataType* operator->() const {    
00064     return m_ptr;
00065   }
00067   _DataType* ptr()             {    
00068     return const_cast<_DataType*>(m_ptr);
00069   }
00071   const _DataType* ptr() const {    
00072     return m_ptr;
00073   }
00075   operator bool()   const             {    
00076     return isValid();
00077   }
00079   bool operator!()  const             {    
00080     return !isValid();
00081   }
00083   bool isValid()  const               {    
00084     return 0 != m_ptr;
00085   }
00087   bool is_null()    const             {
00088     return isValid() ? false : true;
00089   }
00091   unsigned char type()   const   {
00092     return m_type;
00093   }
00094 };
00095 
00096 #endif  // DBCNV_DBBASE_H

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