00001 // File and Version Information: 00002 // $Id: CdbRooSimpleConverter.cc,v 1.1 2005/07/14 16:11:05 jtinslay Exp $ 00003 00004 /// The implementation of the CdbBdb2RooPayloadConverterPTR class. 00005 /** 00006 * @see CdbBdb2RooPayloadConverterPTR 00007 */ 00008 #include "BaBar/BaBar.hh" 00009 00010 #include "CdbRooConversionFwk/CdbRooSimpleConverter.hh" 00011 00012 template < class P, 00013 class T, 00014 class R > 00015 CdbStatus 00016 CdbRooSimpleConverter<P,T,R>::userDefinedConversion( const BdbRef(BdbObject)& theInputObjectRef, 00017 R*& theOutputObjectPtr ) const 00018 { 00019 // Try to get to the final type. Complain to a caller in case of a type 00020 // mismatch (the assignment operator/c-tor will detect it). 00021 00022 const BdbHandle(P) inputObjectH = (const BdbRef(P)&)theInputObjectRef; 00023 if( !inputObjectH.isValid( )) return CdbStatus::IllegalParameters; 00024 00025 // Try getting the "mediator" object. If the input persistent class's interface 00026 // doesn't have the corresponding method the compiler will complain right below. 00027 // 00028 // We're expecting that the following form of the method to exist: 00029 // 00030 // class P ... { 00031 // puiblic: 00032 // T* transient( ) const; 00033 // }; 00034 00035 T* t = inputObjectH->transient( ); 00036 00037 // Create an output object. If the output persistent class's interface 00038 // doesn't have the corresponding method the compiler will complain right below. 00039 // 00040 // We're expecting that the following form of the c-tor to exist: 00041 // 00042 // class R ... { 00043 // puiblic: 00044 // R( const T& ); 00045 // }; 00046 00047 theOutputObjectPtr = new R( *t ); 00048 00049 // The "mediator" type should have a public destructor: 00050 // 00051 // class T { 00052 // public: 00053 // ~T(); 00054 // }; 00055 00056 delete t; 00057 00058 return CdbStatus::Success; 00059 } 00060 00061 ///////////////// 00062 // End Of File // 00063 /////////////////
1.3-rc3