Gaudi Framework, version v21r11

Home   Generated: 30 Sep 2010

DLLClassManager Class Reference

#include <DLLClassManager.h>

Inheritance diagram for DLLClassManager:
[legend]
Collaboration diagram for DLLClassManager:
[legend]

List of all members.

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< ISvcLocatorm_svclocator
SmartIF< IMessageSvcm_msgsvc
SmartIF< IInterfacem_pOuter


Detailed Description

Definition at line 28 of file DLLClassManager.h.


Constructor & Destructor Documentation

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]

Definition at line 31 of file DLLClassManager.cpp.

00031                                   {
00032 }


Member Function Documentation

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 }


Member Data Documentation

Definition at line 42 of file DLLClassManager.h.

Definition at line 47 of file DLLClassManager.h.

Definition at line 48 of file DLLClassManager.h.


The documentation for this class was generated from the following files:

Generated at Thu Sep 30 09:58:25 2010 for Gaudi Framework, version v21r11 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004