00001
00002
00003 #include "BaBar/BaBar.hh"
00004
00005
00006
00007
00008
00009
00010 #include "CdbBdb/CdbBdbObjectConvertor.hh"
00011
00012 #include "CdbBase/Cdb.hh"
00013 #include "CdbBase/CdbDatabase.hh"
00014 #include "CdbBase/CdbCondition.hh"
00015 #include "CdbBase/CdbObject.hh"
00016
00017 #include "CdbBdb/CdbBdb.hh"
00018 #include "CdbBdb/CdbBdbObject.hh"
00019
00020 #include <string.h>
00021 #include <iostream>
00022 using std::cout;
00023 using std::endl;
00024
00025 CdbStatus
00026 CdbBdbObjectConvertor::narrow( BdbHandle(BdbObject)& thePersObj,
00027 const CdbObjectPtr& thePtr )
00028 {
00029 CdbStatus result = CdbStatus::Error;
00030
00031 do {
00032
00033
00034
00035 CdbPtr cdbPtr = thePtr->parent( )->parentDatabase( )->parent( );
00036 if( cdbPtr.isNull( )) break;
00037
00038
00039
00040
00041 const char* objectTechnology = cdbPtr->technologyName( );
00042
00043 if( 0 != strcmp( CdbBdb::technology( ),
00044 objectTechnology )) {
00045
00046 cout << "CdbBdbObjectConvertor::narrow() -- ERROR." << endl
00047 << " The object pointer passed into this procedure does not" << endl
00048 << " match the expected database technology." << endl
00049 << " EXPECTED: \"" << CdbBdb::technology( ) << "\"" << endl
00050 << " FOUND: \"" << objectTechnology << "\"" << endl;
00051 break;
00052 }
00053
00054
00055
00056 CdbBdbObject* oPtr = dynamic_cast<CdbBdbObject*>( thePtr.get( ));
00057 thePersObj = oPtr->objectRef( );
00058
00059 result = CdbStatus::Success;
00060
00061 } while( false );
00062
00063 return result;
00064 }
00065
00066
00067
00068