![]() |
|
|
Bdb packages | Design docs | Source docs | Guidelines | Recent releases |
|
Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members /BdbDistribution/BdbSimpleDbIdMgr.cc
Go to the documentation of this file.00001 // -*- C++ -*- 00002 // 00003 // Package: 00004 // Module: BdbSimpleDbIdMgr 00005 // 00006 // Description: 00007 // 00008 // Implementation: 00009 // <Notes on implementation> 00010 // 00011 // Author: Simon Patton 00012 // Created: Fri Mar 20 14:33:50 PST 1998 00013 // $Id: BdbSimpleDbIdMgr.cc,v 1.6 1999/10/24 18:53:21 patton Exp $ 00014 // 00015 00016 #include "BaBar/BaBar.hh" 00017 00018 // class include file 00019 #include "BdbDistribution/BdbSimpleDbIdMgr.hh" 00020 00021 // system include files 00022 #include <stdlib.h> 00023 00024 // user include files 00025 #include "BdbDistribution/BdbFdName.hh" 00026 00027 // 00028 // constants, enums and typedefs 00029 // 00030 00031 // 00032 // static data member definitions 00033 // 00034 00035 // 00036 // constructors and destructor 00037 // 00038 00039 BdbSimpleDbIdMgr::BdbSimpleDbIdMgr( const BdbHandle( BdbFdName ) aFdName , 00040 const char* aLabel ) 00041 : BdbDbIdManager( aLabel ) 00042 { 00043 const unsigned long kReservedDbIds( 4096 ) ; 00044 const unsigned long kSetLength( 2048 ) ; 00045 if ( (*aFdName) == "BaBar" ) { 00046 m_beginDbId = 16384 ; 00047 m_endDbId = 65536 ; 00048 } 00049 else { 00050 unsigned long setNumber ; 00051 if ( (*aFdName) == "Gromit" ) { 00052 setNumber = 0 ; 00053 } 00054 else { 00055 if ( (*aFdName) == "Wallace" ) { 00056 setNumber = 1 ; 00057 } 00058 else { 00059 setNumber = 2 ; 00060 } 00061 } 00062 m_beginDbId = setNumber * kSetLength + kReservedDbIds ; 00063 m_endDbId = ( setNumber + 1 ) * kSetLength + kReservedDbIds ; 00064 } 00065 m_nextAvailableDbId = m_beginDbId ; 00066 } 00067 00068 // BdbSimpleDbIdMgr::BdbSimpleDbIdMgr() 00069 // { 00070 // } 00071 00072 // BdbSimpleDbIdMgr::BdbSimpleDbIdMgr( const BdbSimpleDbIdMgr& ) 00073 // { 00074 // } 00075 00076 BdbSimpleDbIdMgr::~BdbSimpleDbIdMgr() 00077 { 00078 } 00079 00080 // 00081 // assignment operators 00082 // 00083 00084 // const BdbSimpleDbIdMgr& BdbSimpleDbIdMgr::operator=( const BdbSimpleDbIdMgr& ) 00085 // { 00086 // } 00087 00088 // 00089 // member functions 00090 // 00091 00092 BdbDbId 00093 BdbSimpleDbIdMgr::issueNextDbId() 00094 { 00095 if ( ( federation().isNull() ) || 00096 ( m_nextAvailableDbId == m_endDbId ) ) { 00097 return ( 0 ) ; 00098 } 00099 ooThis().update() ; 00100 return ( m_nextAvailableDbId++ ) ; 00101 } 00102 00103 d_Boolean 00104 BdbSimpleDbIdMgr::issueDbId( const BdbDbId aDbId ) 00105 { 00106 if ( ( federation().isNull() ) || 00107 ( m_nextAvailableDbId == m_endDbId ) || 00108 ( aDbId != m_nextAvailableDbId ) ) { 00109 return ( false ) ; 00110 } 00111 00112 issueNextDbId() ; 00113 return( !false ) ; 00114 } 00115 00116 d_Boolean 00117 BdbSimpleDbIdMgr::recoverDbId( const BdbDbId aDbId ) 00118 { 00119 if ( ( federation().isNull() ) || 00120 ( m_nextAvailableDbId == m_beginDbId ) || 00121 ( ( aDbId + 1 ) != m_nextAvailableDbId ) ) { 00122 return ( false ) ; 00123 } 00124 00125 ooThis().update() ; 00126 --m_nextAvailableDbId ; 00127 00128 return( !false ) ; 00129 } 00130 00131 d_Boolean 00132 BdbSimpleDbIdMgr::refresh() 00133 { 00134 return( true ) ; 00135 } 00136 00137 // 00138 // const member functions 00139 // 00140 00141 d_Boolean 00142 BdbSimpleDbIdMgr::allowedWriteAccess( const BdbDbId aDbId ) const 00143 { 00144 return ( ( aDbId >= m_beginDbId ) && 00145 ( aDbId < m_endDbId ) ) ; 00146 } 00147 00148 d_Boolean 00149 BdbSimpleDbIdMgr::hasBeenIssued( const BdbDbId aDbId ) const 00150 { 00151 return( ( aDbId >= m_beginDbId ) && 00152 ( aDbId < m_nextAvailableDbId ) ) ; 00153 } 00154 00155 d_Boolean 00156 BdbSimpleDbIdMgr::noMoreDbIds() const 00157 { 00158 return ( m_nextAvailableDbId == m_endDbId ) ; 00159 } 00160 00161 BdbDbId 00162 BdbSimpleDbIdMgr::multiWriteDbId( const char* const aName ) const 00163 { 00164 return( 0 ) ; 00165 } 00166 00167 // 00168 // static member functions 00169 // 00170 00171 void 00172 BdbSimpleDbIdMgr::linkInClass() 00173 { 00174 }
BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us
Page Owner: Jacek Becla
Last Update: October 04, 2002