Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

CdbBdb2RooPayloadConvertersDict.cc

Go to the documentation of this file.
00001 // File and Version Information:
00002 //      $Id: CdbBdb2RooPayloadConvertersDict.cc,v 1.4 2005/07/14 19:36:38 gapon Exp $
00003 
00004 /// The implementation of the CdbBdb2RooPayloadConvertersDict class.
00005 /**
00006   * @see CdbBdb2RooPayloadConvertersDict
00007   */
00008 #include "BaBar/BaBar.hh"
00009 
00010 #include "CdbRooConversionFwk/CdbBdb2RooPayloadConvertersDict.hh"
00011 #include "CdbRooConversionFwk/CdbRooConverterBase.hh"
00012 
00013 #include <iostream>
00014 using std::cout;
00015 using std::endl;
00016 
00017 CdbBdb2RooPayloadConvertersDict::CdbBdb2RooPayloadConvertersDict( )
00018 { }
00019 
00020 CdbBdb2RooPayloadConvertersDict::CdbBdb2RooPayloadConvertersDict( const CdbBdb2RooPayloadConvertersDict& theOther ) :
00021     _byInputClassName (theOther._byInputClassName ),
00022     _byOutputClassName(theOther._byOutputClassName)
00023 { }
00024 
00025 CdbBdb2RooPayloadConvertersDict::~CdbBdb2RooPayloadConvertersDict( )
00026 { }
00027 
00028 CdbBdb2RooPayloadConvertersDict&
00029 CdbBdb2RooPayloadConvertersDict::operator=( const CdbBdb2RooPayloadConvertersDict& theOther )
00030 {
00031     if( this != &theOther ) {
00032         _byInputClassName  = theOther._byInputClassName;
00033         _byOutputClassName = theOther._byOutputClassName;
00034     }
00035     return *this;
00036 }
00037 
00038 CdbStatus
00039 CdbBdb2RooPayloadConvertersDict::add( const CdbCPtr< CdbRooConverterBase >& theConverterPtr )
00040 {
00041     if( theConverterPtr.isNull( )) return CdbStatus::IllegalParameters;
00042 
00043   // Check if a converter with the same input and/or output class names doesn't
00044   // already exist in local registries.
00045 
00046     if( !findByInputClassName ( theConverterPtr->inputClassName ( )).isNull( )) return CdbStatus::Error;
00047     if( !findByOutputClassName( theConverterPtr->outputClassName( )).isNull( )) return CdbStatus::Error;
00048 
00049   // Register the converter
00050 
00051     _byInputClassName [theConverterPtr->inputClassName ( )] = theConverterPtr;
00052     _byOutputClassName[theConverterPtr->outputClassName( )] = theConverterPtr;
00053 
00054     return CdbStatus::Success;
00055 }
00056 
00057 CdbCPtr< CdbRooConverterBase >
00058 CdbBdb2RooPayloadConvertersDict::findByInputClassName( const std::string& theName ) const
00059 {
00060     CdbCPtr< CdbRooConverterBase > result;
00061     std::map< std::string, CdbCPtr< CdbRooConverterBase > >::const_iterator itr = _byInputClassName.find( theName );
00062     if( itr != _byInputClassName.end( )) result = (*itr).second;
00063     return result;
00064 }
00065 
00066 CdbCPtr< CdbRooConverterBase >
00067 CdbBdb2RooPayloadConvertersDict::findByOutputClassName( const std::string& theName ) const
00068 {
00069     CdbCPtr< CdbRooConverterBase > result;
00070     std::map< std::string, CdbCPtr< CdbRooConverterBase > >::const_iterator itr = _byOutputClassName.find( theName );
00071     if( itr != _byOutputClassName.end( )) result = (*itr).second;
00072     return result;
00073 }
00074 
00075 /////////////////
00076 // End Of File //
00077 /////////////////

Generated on Mon Dec 5 18:21:59 2005 for CDB by doxygen1.3-rc3