![]() |
|
|
Generated: 8 Jan 2009 |
#include <DLLClassManager.h>


Definition at line 28 of file DLLClassManager.h.
Public Member Functions | |
| DLLClassManager (IInterface *iface) | |
| virtual | ~DLLClassManager () |
| virtual StatusCode | loadModule (const std::string &module, bool fireIncident=true) |
| Declare a shareable library to be used for creating instances of a given algorithm type. | |
| virtual unsigned long | addRef () |
| Increment the reference count of Interface instance. | |
| virtual unsigned long | release () |
| Release Interface instance. | |
| virtual StatusCode | queryInterface (const InterfaceID &iid, void **pinterface) |
| Query interfaces of Interface. | |
Private Attributes | |
| unsigned long | m_refcount |
| ISvcLocator * | m_svclocator |
| IAlgManager * | m_algmanager |
| ISvcManager * | m_svcmanager |
| ICnvManager * | m_cnvmanager |
| IObjManager * | m_objmanager |
| IMessageSvc * | m_msgsvc |
| IInterface * | m_pOuter |
| DLLClassManager::DLLClassManager | ( | IInterface * | iface | ) |
Definition at line 18 of file DLLClassManager.cpp.
00018 { 00019 m_pOuter = iface; 00020 m_pOuter->queryInterface(IID_ISvcLocator, pp_cast<void>(&m_svclocator)).ignore(); 00021 assert( 0 != m_svclocator ); 00022 m_msgsvc = 0; 00023 // m_algmanager = 0; 00024 // m_svcmanager = 0; 00025 // m_cnvmanager = 0; 00026 // m_objmanager = 0; 00027 m_refcount = 1; 00028 }
| DLLClassManager::~DLLClassManager | ( | ) | [virtual] |
Definition at line 31 of file DLLClassManager.cpp.
00031 { 00032 if( m_msgsvc ) m_msgsvc->release(); 00033 //if( m_algmanager ) m_algmanager->release(); 00034 //if( m_svcmanager ) m_svcmanager->release(); 00035 //if( m_cnvmanager ) m_cnvmanager->release(); 00036 //if( m_objmanager ) m_objmanager->release(); 00037 if( m_svclocator ) m_svclocator->release(); 00038 }
| StatusCode DLLClassManager::loadModule | ( | const std::string & | module, | |
| bool | fireIncident = true | |||
| ) | [virtual] |
Declare a shareable library to be used for creating instances of a given algorithm type.
Implements IClassManager.
Definition at line 41 of file DLLClassManager.cpp.
00042 { 00043 // Access the message service if not yet done already 00044 if( m_msgsvc == 0 ) { 00045 m_svclocator->getService( "MessageSvc", IID_IMessageSvc, *pp_cast<IInterface>(&m_msgsvc) ).ignore(); 00046 } 00047 MsgStream log(m_msgsvc, "DllClassManager"); 00048 00049 std::string mod = module=="" ? System::moduleNameFull() : module; 00050 if( module == "NONE" ) return StatusCode::SUCCESS; 00051 00052 void* libHandle = 0; 00053 StatusCode status = StatusCode::FAILURE; 00054 try 00055 { 00056 status = System::loadDynamicLib( module, &libHandle); 00057 } 00058 catch ( const std::exception & excpt ) 00059 { 00060 if ( m_msgsvc ) 00061 { 00062 log << MSG::ERROR << "Exception whilst loading " << module << " : " << excpt.what() << endmsg; 00063 } 00064 status = StatusCode::FAILURE; 00065 } 00066 00067 if( status.isFailure() ) { 00068 // DLL library not loaded 00069 log << MSG::ERROR << "Could not load module " << module << endmsg; 00070 log << MSG::ERROR << "System Error: " << System::getLastErrorString() << endmsg; 00071 return StatusCode::FAILURE; 00072 } 00073 //FIXME this is a hack to avoid a very early call to moduleLoad from 00074 //FIXME AppMgr::i_startup 00075 if (fireIncident && module != "") { 00076 //now fire ModuleLoadedIncident 00077 IIncidentSvc* pIncidentSvc(0); 00078 const bool CREATEIF(true); 00079 StatusCode sc(m_svclocator->service("IncidentSvc", pIncidentSvc, CREATEIF)); 00080 if( !sc.isSuccess() ) { 00081 log << MSG::FATAL << "Can not locate IncidentSvc" << endreq; 00082 throw GaudiException("Error retrieving IncidentSvc", 00083 "DLLClassManager::DLLClassManager", sc); 00084 } 00085 pIncidentSvc->fireIncident(ModuleLoadedIncident("DLLClassManager", 00086 module) ); 00087 pIncidentSvc->release(); 00088 } 00089 00090 return StatusCode::SUCCESS; 00091 }
| unsigned long DLLClassManager::addRef | ( | ) | [virtual] |
Increment the reference count of Interface instance.
Implements IInterface.
Definition at line 94 of file DLLClassManager.cpp.
00094 { 00095 m_refcount++; 00096 return m_refcount; 00097 }
| unsigned long DLLClassManager::release | ( | ) | [virtual] |
Release Interface instance.
Implements IInterface.
Definition at line 100 of file DLLClassManager.cpp.
00100 { 00101 unsigned long count = --m_refcount; 00102 if( count <= 0) { 00103 delete this; 00104 } 00105 return count; 00106 }
| StatusCode DLLClassManager::queryInterface | ( | const InterfaceID & | riid, | |
| void ** | ppvInterface | |||
| ) | [virtual] |
Query interfaces of Interface.
| riid | ID of Interface to be retrieved | |
| ppvInterface | Pointer to Location for interface pointer |
Implements IInterface.
Definition at line 109 of file DLLClassManager.cpp.
00109 { 00110 if( iid == IID_IInterface ) { 00111 *pinterface = (IInterface*)this; 00112 addRef(); 00113 return StatusCode::SUCCESS; 00114 } 00115 else if ( iid == IID_IClassManager ) { 00116 *pinterface = (IClassManager*)this; 00117 addRef(); 00118 return StatusCode::SUCCESS; 00119 } 00120 else { 00121 return m_pOuter->queryInterface(iid, pinterface); 00122 } 00123 return StatusCode::SUCCESS; 00124 }
unsigned long DLLClassManager::m_refcount [private] |
Definition at line 46 of file DLLClassManager.h.
ISvcLocator* DLLClassManager::m_svclocator [private] |
Definition at line 47 of file DLLClassManager.h.
IAlgManager* DLLClassManager::m_algmanager [private] |
Definition at line 48 of file DLLClassManager.h.
ISvcManager* DLLClassManager::m_svcmanager [private] |
Definition at line 49 of file DLLClassManager.h.
ICnvManager* DLLClassManager::m_cnvmanager [private] |
Definition at line 50 of file DLLClassManager.h.
IObjManager* DLLClassManager::m_objmanager [private] |
Definition at line 51 of file DLLClassManager.h.
IMessageSvc* DLLClassManager::m_msgsvc [private] |
Definition at line 52 of file DLLClassManager.h.
IInterface* DLLClassManager::m_pOuter [private] |
Definition at line 53 of file DLLClassManager.h.