![]() |
|
|
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 /BdbEventStore/BdbTreeCollTFactory.cc
Go to the documentation of this file.00001 #if !defined(BDBTREECOLLTFACTORY_CC) 00002 #define BDBTREECOLLTFACTORY_CC 00003 //------------------------------------------------------------------------------ 00004 // File and Version Information: 00005 // $Id: BdbTreeCollTFactory.cc,v 1.1 2002/05/31 07:06:04 becla Exp $ 00006 // 00007 // Description: 00008 // Class BdbTreeCollTFactory interface (.cc) file. This file declares the 00009 // factory of tree collections. 00010 // 00011 // Environment: 00012 // Software developed for the BaBar Detector at the SLAC B-Factory 00013 // 00014 // Author List: 00015 // Simon Patton Original Author (source in BdbTreeCollFactory) 00016 // Jacek Becla Modified to break dependency between Event Store 00017 // and BdbEvent 00018 // 00019 // Copyright Information: 00020 // Copyright (C) 2002 Stanford Linear Accelerator Center 00021 // 00022 //------------------------------------------------------------------------------ 00023 00024 00025 //----------------------- 00026 // This Class's Header -- 00027 //----------------------- 00028 #include "BdbEventStore/BdbTreeCollTFactory.hh" 00029 00030 //------------- 00031 // C Headers -- 00032 //------------- 00033 extern "C" { 00034 #include <stdlib.h> 00035 } 00036 00037 //--------------- 00038 // C++ Headers -- 00039 //--------------- 00040 00041 //---------------- 00042 // BaBar Header -- 00043 //---------------- 00044 #include "BaBar/BaBar.hh" 00045 00046 //------------------------------- 00047 // Collaborating Class Headers -- 00048 //------------------------------- 00049 00050 //------------------------------------ 00051 // Collaborating Class Declarations -- 00052 //------------------------------------ 00053 #include "BdbEvent/BdbEvent.hh" 00054 #include "BdbEventStore/BdbTreeCollectionT.hh" 00055 #include "BdbEventStore/BdbTreeCollectionP.hh" 00056 #include "BdbEventStore/BdbOptBridgeOnly.hh" 00057 #include "BdbEventStore/BdbEventStore.hh" 00058 #include "BdbEventStore/BdbEventStoreErrors.hh" 00059 #include "ErrLogger/ErrLog.hh" 00060 00061 //----------------------------------------------------------------------- 00062 // Local Macros, Typedefs, Structures, Unions and Forward Declarations -- 00063 //----------------------------------------------------------------------- 00064 00065 // ----------------------------------------------- 00066 // -- Static Data & Function Member Definitions -- 00067 // ----------------------------------------------- 00068 00069 // --------------------------------- 00070 // -- Member Function Definitions -- 00071 // --------------------------------- 00072 00073 //---------------- 00074 // Constructors -- 00075 //---------------- 00076 00077 template < class T > 00078 BdbTreeCollTFactory< T >::BdbTreeCollTFactory( BdbAbstractClusteringHint& theCollectionHint, 00079 BdbAbstractClusteringHint& theTreeNodeHint ) 00080 : BdbCollectionTFactory< T >( theCollectionHint, 00081 theTreeNodeHint ) 00082 { 00083 } 00084 00085 // template < class T > 00086 // BdbTreeCollTFactory< T >::BdbTreeCollTFactory() 00087 // { 00088 // } 00089 00090 // template < class T > 00091 // BdbTreeCollTFactory< T >::BdbTreeCollTFactory( const BdbTreeCollTFactory< T >& aRhs ) 00092 // { 00093 // } 00094 00095 //-------------- 00096 // Destructor -- 00097 //-------------- 00098 00099 template < class T > 00100 BdbTreeCollTFactory< T >::~BdbTreeCollTFactory() 00101 { 00102 } 00103 00104 //------------- 00105 // Operators -- 00106 //------------- 00107 00108 // template < class T > 00109 // const BdbTreeCollTFactory< T >& BdbTreeCollTFactory< T >::operator=( const BdbTreeCollTFactory< T >& aRhs ) 00110 // { 00111 // } 00112 00113 //------------- 00114 // Selectors -- 00115 //------------- 00116 00117 template < class T > 00118 const char* 00119 BdbTreeCollTFactory< T >::typeName() const 00120 { 00121 return( "Tree" ) ; 00122 } 00123 00124 template < class T > 00125 BdbStatus 00126 BdbTreeCollTFactory< T >::existsError( const char* theName ) const 00127 { 00128 if( kExistsFailure != getResult() ) { 00129 return ( BdbcSuccess ); 00130 } 00131 return( BdbcError ); 00132 /** return( BdbSignal( BdbcUserError , 00133 BdbEventStoreErrExistsFailure, 00134 0 , 00135 "BdbTreeCollTFactory::getCollection" , 00136 theName ) ) ;*/ 00137 } 00138 00139 template < class T > 00140 BdbStatus 00141 BdbTreeCollTFactory< T >::lockError( const BdbRefAny& persObj ) const 00142 { 00143 if( kLockFailure != getResult() ) { 00144 return ( BdbcSuccess ); 00145 } 00146 00147 // Maximum length is '[' + 5 + ',' + 5 + ']' + '\0' = 14 00148 char idDescription[16]; 00149 ooId objId = persObj; 00150 sprintf( idDescription, 00151 "[%d,%d]", 00152 objId.get_DB(), 00153 objId.get_OC() ); 00154 return( BdbSignal( BdbcUserError , 00155 BdbEventStoreErrUpdateFailure , 00156 0 , 00157 "BdbTreeCollTFactory::getCollection" , 00158 idDescription ) ) ; 00159 } 00160 00161 template < class T > 00162 BdbStatus 00163 BdbTreeCollTFactory< T >::nameError() const 00164 { 00165 if( kNameFailure != getResult() ) { 00166 return ( BdbcSuccess ); 00167 } 00168 return( BdbSignal( BdbcUserError , 00169 BdbEventStoreErrCollectionNotNamed , 00170 0 , 00171 "BdbTreeCollTFactory::getCollection" ) ) ; 00172 } 00173 00174 template < class T > 00175 BdbStatus 00176 BdbTreeCollTFactory< T >::authError( const char* theName ) const 00177 { 00178 if( kAuthFailure != getResult() ) { 00179 return ( BdbcSuccess ); 00180 } 00181 return( BdbSignal( BdbcUserError , 00182 BdbEventStoreErrAuthFailure , 00183 0 , 00184 "BdbTreeCollTFactory::getCollection" , 00185 theName ) ) ; 00186 } 00187 00188 //------------- 00189 // Modifiers -- 00190 //------------- 00191 00192 template < class T > 00193 BdbAbsCollectionT< T >* 00194 BdbTreeCollTFactory< T >::createCollectionAtNode( BdbHandleAny& theHint, 00195 BdbHandle( BdbTreeNodeP )& theNode , 00196 const char* theName , 00197 d_ULong theInitialSize ) 00198 { 00199 if( BdbOptBridgeOnly::isSet( *(BdbEventStore::instance()) ) ) { 00200 ErrMsg( fatal ) << "Can allowed to create " 00201 << typeName() 00202 << " collections in this" 00203 << " federation" 00204 << endmsg ; 00205 exit( -1 ); 00206 } 00207 00208 return( new BdbTreeCollectionT< T >( theHint , 00209 theNode , 00210 theName , 00211 theInitialSize ) ) ; 00212 } 00213 00214 #endif // BDBTREECOLLTFACTORY_CC
BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us
Page Owner: Jacek Becla
Last Update: October 04, 2002