00001
00002
00003
00004
00005
00006
00007
00008 #include "BaBar/BaBar.hh"
00009
00010 #include "CdbBdbTable/CdbBdbNTupleProxy.hh"
00011 #include "CdbBdbTable/CdbBdbNTupleP2T.hh"
00012
00013 #include "CdbBdb/CdbBdbProxyElement.hh"
00014
00015 #include <assert.h>
00016 #include <iostream>
00017 using std::cout;
00018 using std::endl;
00019
00020 template< class T, unsigned int NCOL >
00021 CdbBdbNTupleProxy<T,NCOL>::CdbBdbNTupleProxy( const char* theConditionPathName,
00022 BdbCondDefStrategy* theStrategy ) :
00023 CdbBdbProxyBase< CdbCPtr< CdbNTuple< T, NCOL > > >( theStrategy )
00024 {
00025 assert( 0 != theConditionPathName );
00026
00027 subscribeCondition( theConditionPathName );
00028 }
00029
00030 template< class T, unsigned int NCOL >
00031 CdbBdbNTupleProxy<T,NCOL>::~CdbBdbNTupleProxy( )
00032 { }
00033
00034 template< class T, unsigned int NCOL >
00035 CdbCPtr< CdbNTuple< T, NCOL > >*
00036 CdbBdbNTupleProxy<T,NCOL>::redefinedFaultHandler( const std::vector<CdbBdbProxyElement>& listOfElements )
00037 {
00038
00039
00040 assert( 1 == listOfElements.size( ));
00041
00042 BdbRef(BdbObject) objectRef = listOfElements[0].objectRef();
00043 assert( objectRef.isValid( ));
00044
00045
00046
00047 CdbCPtr< CdbNTuple< T, NCOL > >* ptr = new CdbCPtr< CdbNTuple< T, NCOL > >( );
00048
00049 if( CdbStatus::Success != CdbBdbNTupleP2T<>::convert( *ptr,
00050 objectRef )) {
00051
00052 cout << "CdbBdbNTupleProxy<T,NCOL>::redefinedFaultHandler() - ERROR." << endl
00053 << " failed to convert the persistent object " << objectRef.sprint( ) << " got from the database" << endl
00054 << " for condition \"" << listOfElements[0].name( ).c_str( ) << "\" into a transient tuple." << endl;
00055
00056 delete ptr;
00057 return 0;
00058 }
00059
00060
00061
00062
00063 return ptr;
00064 }
00065
00066
00067
00068