|
Gaudi Framework, version v21r11 |
| Home | Generated: 30 Sep 2010 |
#include <DLLClassManager.h>
Public Member Functions | |
| DLLClassManager (IInterface *iface) | |
| virtual | ~DLLClassManager () |
| virtual StatusCode | loadModule (const std::string &module, bool fireIncident=true) |
| Declare a sharable library to be used for creating instances of a given algorithm type. | |
| virtual StatusCode | queryInterface (const InterfaceID &iid, void **pinterface) |
| implementation of IInterface::queryInterface | |
Private Attributes | |
| SmartIF< ISvcLocator > | m_svclocator |
| SmartIF< IMessageSvc > | m_msgsvc |
| SmartIF< IInterface > | m_pOuter |
Definition at line 28 of file DLLClassManager.h.
| DLLClassManager::DLLClassManager | ( | IInterface * | iface | ) |
Definition at line 21 of file DLLClassManager.cpp.
00021 { 00022 m_pOuter = iface; 00023 m_svclocator = m_pOuter; 00024 00025 assert(m_svclocator.isValid()); 00026 00027 addRef(); // Initial count set to 1 00028 }
| DLLClassManager::~DLLClassManager | ( | ) | [virtual] |
| StatusCode DLLClassManager::loadModule | ( | const std::string & | module, | |
| bool | fireIncident = true | |||
| ) | [virtual] |
Declare a sharable library to be used for creating instances of a given algorithm type.
Implements IClassManager.
Definition at line 35 of file DLLClassManager.cpp.
00036 { 00037 // Access the message service if not yet done already 00038 if (!m_msgsvc.isValid()) { 00039 m_msgsvc = m_svclocator; 00040 } 00041 MsgStream log(m_msgsvc, "DllClassManager"); 00042 00043 std::string mod = module=="" ? System::moduleNameFull() : module; 00044 if( module == "NONE" ) return StatusCode::SUCCESS; 00045 00046 void* libHandle = 0; 00047 StatusCode status = StatusCode::FAILURE; 00048 try 00049 { 00050 status = System::loadDynamicLib( module, &libHandle); 00051 } 00052 catch ( const std::exception & excpt ) 00053 { 00054 if ( m_msgsvc ) 00055 { 00056 log << MSG::ERROR << "Exception whilst loading " << module << " : " << excpt.what() << endmsg; 00057 } 00058 status = StatusCode::FAILURE; 00059 } 00060 00061 if( status.isFailure() ) { 00062 // DLL library not loaded 00063 log << MSG::ERROR << "Could not load module " << module << endmsg; 00064 log << MSG::ERROR << "System Error: " << System::getLastErrorString() << endmsg; 00065 return StatusCode::FAILURE; 00066 } 00067 //FIXME this is a hack to avoid a very early call to moduleLoad from 00068 //FIXME AppMgr::i_startup 00069 if (fireIncident && module != "") { 00070 //now fire ModuleLoadedIncident 00071 const bool CREATEIF(true); 00072 SmartIF<IIncidentSvc> pIncidentSvc(m_svclocator->service("IncidentSvc", CREATEIF)); 00073 if( !pIncidentSvc.isValid() ) { 00074 log << MSG::FATAL << "Can not locate IncidentSvc" << endmsg; 00075 throw GaudiException("Error retrieving IncidentSvc", 00076 "DLLClassManager::DLLClassManager", StatusCode::FAILURE); 00077 } 00078 pIncidentSvc->fireIncident(ModuleLoadedIncident("DLLClassManager", 00079 module) ); 00080 } 00081 00082 return StatusCode::SUCCESS; 00083 }
| StatusCode DLLClassManager::queryInterface | ( | const InterfaceID & | iid, | |
| void ** | pinterface | |||
| ) | [virtual] |
implementation of IInterface::queryInterface
Implements IInterface.
Definition at line 86 of file DLLClassManager.cpp.
00086 { 00087 // try local interfaces 00088 StatusCode sc = base_class::queryInterface(iid, pinterface); 00089 if (sc.isSuccess()) return sc; 00090 // fall back on the owner 00091 return m_pOuter->queryInterface(iid, pinterface); 00092 }
SmartIF<ISvcLocator> DLLClassManager::m_svclocator [private] |
Definition at line 42 of file DLLClassManager.h.
SmartIF<IMessageSvc> DLLClassManager::m_msgsvc [private] |
Definition at line 47 of file DLLClassManager.h.
SmartIF<IInterface> DLLClassManager::m_pOuter [private] |
Definition at line 48 of file DLLClassManager.h.