| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

SoConversionSvc.cpp

Go to the documentation of this file.
00001 // $Id: SoConversionSvc.cpp,v 1.14 2009/01/27 08:38:28 cattanem Exp $ 
00002 // ============================================================================
00003 
00004 // this :
00005 #include <OnXSvc/SoConversionSvc.h>
00006 
00007 #include <GaudiKernel/MsgStream.h>
00008 #include <GaudiKernel/SvcFactory.h>
00009 #include <GaudiKernel/DataObject.h>
00010 #include <GaudiKernel/IDataProviderSvc.h>
00011 
00012 #include <DetDesc/IDetectorElement.h>
00013 #include <DetDesc/ILVolume.h>
00014 #include <DetDesc/CLIDDetectorElement.h>
00015 #include <DetDesc/CLIDLVolume.h>
00016 
00017 #include <AIDA/IHistogram.h>
00018 
00019 #include <OnXSvc/ClassID.h>
00020 
00021 DECLARE_SERVICE_FACTORY( SoConversionSvc );
00022 
00024 SoConversionSvc::SoConversionSvc(
00025  const std::string& aName
00026 ,ISvcLocator* aSvcLoc
00027 )
00028 :ConversionSvc(aName, aSvcLoc, So_TechnologyType) 
00031 { 
00032 }
00034 SoConversionSvc::~SoConversionSvc(
00035 ) 
00036 
00037 
00038 { 
00039 }
00041 StatusCode SoConversionSvc::queryInterface(
00042  const InterfaceID& aRIID
00043 ,void** aPPVIF
00044 ) 
00045 
00046 
00047 {
00048   if(ISoConversionSvc::interfaceID() == aRIID) {
00049     *aPPVIF = static_cast<ISoConversionSvc*> (this);
00050     addRef();
00051     return StatusCode::SUCCESS;
00052   } else if(IConversionSvc::interfaceID() == aRIID) {
00053     *aPPVIF = static_cast<IConversionSvc*> (this);
00054     addRef();
00055     return StatusCode::SUCCESS;
00056   } else {
00057     return ConversionSvc::queryInterface(aRIID, aPPVIF);
00058   }
00059 }
00060 
00062 StatusCode SoConversionSvc::initialize(
00063 ) 
00064 
00065 
00066 {
00067   StatusCode status = ConversionSvc::initialize();
00068   if( status.isFailure() ) return status;
00069 
00070   MsgStream log(messageService(), name());
00071   log << MSG::INFO << this->name() << " initialized successfully" << endreq;
00072   
00073   return status;
00074 }
00076 StatusCode SoConversionSvc::createRep ( 
00077  DataObject* aObject
00078 ,IOpaqueAddress*& aAddress
00079 ) 
00080 
00081 
00088 
00089 {
00090   aAddress = 0;
00091 
00093   if(!aObject) {
00094     MsgStream log( msgSvc() , name() );
00095     log << MSG::ERROR 
00096         << " DataObject* points to NULL! " << endreq ;
00097     return StatusCode::FAILURE ;
00098   }
00099 
00101   if(dynamic_cast<const IDetectorElement*>(aObject)) {
00102     IConverter* cnv = converter( CLID_DetectorElement );
00103     if(!cnv) {
00104       MsgStream log( msgSvc() , name() );
00105       log << MSG::ERROR
00106           << " Converter is not found for Object/CLID='" 
00107           << System::typeinfoName( typeid( *aObject ) ) << "'/'"
00108           << aObject->clID()                            << "'"   << endreq ;
00109       return StatusCode::FAILURE ;
00110     }
00111     return cnv->createRep( aObject ,  aAddress ) ;
00112   }
00113 
00115   if(dynamic_cast<const ILVolume*>(aObject)) {
00116     IConverter* cnv = converter( CLID_LVolume );
00117     if(!cnv) {
00118       MsgStream log( msgSvc() , name() );
00119       log << MSG::ERROR
00120           << " Converter is not found for Object/CLID='" 
00121           << System::typeinfoName( typeid( *aObject ) ) << "'/'"
00122           << aObject->clID()                            << "'"   << endreq ;
00123       return StatusCode::FAILURE ;
00124     }
00125     return cnv->createRep( aObject ,  aAddress ) ;
00126   }
00127 
00129   if(dynamic_cast<const AIDA::IHistogram*>(aObject)) {
00130     IConverter* cnv = converter( CLID_Histogram );
00131     if(!cnv) {
00132       MsgStream log( msgSvc() , name() );
00133       log << MSG::ERROR
00134           << " Histogram converter is not found for Object/CLID='" 
00135           << System::typeinfoName( typeid( *aObject ) ) << "'/'"
00136           << aObject->clID()                            << "'"   << endreq ;
00137       return StatusCode::FAILURE ;
00138     }
00139     return cnv->createRep( aObject ,  aAddress ) ;
00140   }
00141 
00143   IConverter* cnv = converter( aObject->clID()       ) ; 
00144   if(!cnv) {
00145     MsgStream log( msgSvc() , name() );
00146     log << MSG::INFO
00147         << " Converter is not found for Object/CLID='" 
00148         << System::typeinfoName( typeid( *aObject ) ) << "'/'"
00149         << aObject->clID()                            << "'"   
00150         << endreq ;
00151         
00152     log << MSG::ALWAYS << aObject->fillStream(log.stream()) << endreq;    
00153     
00154     return StatusCode::SUCCESS ;
00155   }
00156   return cnv->createRep( aObject ,  aAddress ) ;
00157 
00158 };
00159 
00160 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:02:00 2011 for OnXSvc by doxygen 1.4.7