| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Attributes | List of all members
DLLClassManager Class Reference

`#include <src/ApplicationMgr/DLLClassManager.h>`

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

## Public Member Functions
| DLLClassManager (IInterface *iface)
| ~DLLClassManager () override=default
StatusCode | loadModule (const std::string &module, bool fireIncident=true) override
StatusCode | queryInterface (const InterfaceID &iid, void **pinterface) override
| implementation of IInterface::queryInterface More...
Public Member Functions inherited from implements< IClassManager >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| implements ()=default
| Default constructor. More...
| implements (const implements &)
| Copy constructor (zero the reference count) More...
implements & | operator= (const implements &)
| Assignment operator (do not touch the reference count). More...
| ~implements () override=default
| Virtual destructor. More...
unsigned long | addRef () override
| Reference Interface instance. More...
unsigned long | release () override
| Release Interface instance. More...
unsigned long | refCount () const override
| Current reference count. More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Private Attributes
SmartIF< ISvcLocator > | m_svclocator
SmartIF< IMessageSvc > | m_msgsvc
SmartIF< IInterface > | m_pOuter

## Additional Inherited Members
Public Types inherited from implements< IClassManager >
using | base_class = implements< Interfaces... >
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
using | iids = typename extend_interfaces_base::ext_iids
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...
Protected Attributes inherited from implements< IClassManager >
std::atomic_ulong | m_refCount
| Reference counter. More...

## Detailed Description

Definition at line 26 of file DLLClassManager.h.

## Constructor & Destructor Documentation

DLLClassManager::DLLClassManager | ( | IInterface * | iface | ) |

Definition at line 19 of file DLLClassManager.cpp.

19 {
20 m_pOuter = iface;
21 m_svclocator = m_pOuter;
22
23 assert(m_svclocator.isValid());
24
25 addRef(); // Initial count set to 1
26 }
implements< IClassManager >::addRef
unsigned long addRef() override
Reference Interface instance.
Definition: implements.h:44
SmartIF::isValid
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:62
DLLClassManager::m_svclocator
SmartIF< ISvcLocator > m_svclocator
Definition: DLLClassManager.h:40
DLLClassManager::m_pOuter
SmartIF< IInterface > m_pOuter
Definition: DLLClassManager.h:42

DLLClassManager::~DLLClassManager | ( |  | ) |
| override default

## Member Function Documentation

StatusCode DLLClassManager::loadModule | ( | const std::string & | module,
|  | bool | fireIncident = `true`
| ) |  |
| override

Definition at line 29 of file DLLClassManager.cpp.

30 {
31 // Access the message service if not yet done already
32 if (!m_msgsvc) m_msgsvc = m_svclocator;
33 MsgStream log(m_msgsvc, "DllClassManager");
34
35 std::string mod = module=="" ? System::moduleNameFull() : module;
36 if( module == "NONE" ) return StatusCode::SUCCESS;
37
38 void* libHandle = nullptr;
39 StatusCode status = StatusCode::FAILURE;
40 try
41 {
42 status = System::loadDynamicLib( module, &libHandle);
43 }
44 catch ( const std::exception & excpt )
45 {
46 if ( m_msgsvc )
47 {
48 log << MSG::ERROR << "Exception whilst loading " << module << " : " << excpt.what() << endmsg;
49 }
50 status = StatusCode::FAILURE;
51 }
52
53 if( status.isFailure() ) {
54 // DLL library not loaded
55 log << MSG::ERROR << "Could not load module " << module << endmsg;
56 log << MSG::ERROR << "System Error: " << System::getLastErrorString() << endmsg;
57 return StatusCode::FAILURE;
58 }
59 //FIXME this is a hack to avoid a very early call to moduleLoad from
60 //FIXME AppMgr::i_startup
61 if (fireIncident && !module.empty()) {
62 //now fire ModuleLoadedIncident
63 const bool CREATEIF(true);
64 auto pIncidentSvc = m_svclocator->service<IIncidentSvc>("IncidentSvc", CREATEIF);
65 if( !pIncidentSvc ) {
66 log << MSG::FATAL << "Can not locate IncidentSvc" << endmsg;
67 throw GaudiException("Error retrieving IncidentSvc",
68 "DLLClassManager::DLLClassManager", StatusCode::FAILURE);
69 }
70 pIncidentSvc->fireIncident(ModuleLoadedIncident("DLLClassManager",
71 module) );
72 }
73
74 return StatusCode::SUCCESS;
75 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode::SUCCESS
Definition: StatusCode.h:30
std::string::empty
T empty(T...args)
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
StatusCode::FAILURE
Definition: StatusCode.h:29
System::moduleNameFull
GAUDI_API const std::string & moduleNameFull()
Get the full name of the (executable/DLL) file.
Definition: ModuleInfo.cpp:77
Gaudi.CommonGaudiConfigurables.mod
mod
Definition: CommonGaudiConfigurables.py:22
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
std::string
STL class.
MSG::FATAL
Definition: IMessageSvc.h:22
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
std::exception::what
T what(T...args)
DLLClassManager::m_msgsvc
SmartIF< IMessageSvc > m_msgsvc
Definition: DLLClassManager.h:41
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
ModuleLoadedIncident
fired when a module (DLL) is loaded
Definition: ModuleIncident.h:42
std::exception
STL class.
MSG::ERROR
Definition: IMessageSvc.h:21
DLLClassManager::m_svclocator
SmartIF< ISvcLocator > m_svclocator
Definition: DLLClassManager.h:40
System::getLastErrorString
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
Definition: System.cpp:256
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23
Gaudi.Configuration.log
log
Definition: Configuration.py:13
System::loadDynamicLib
GAUDI_API unsigned long loadDynamicLib(const std::string &name, ImageHandle *handle)
Load dynamic link library.
Definition: System.cpp:126

StatusCode DLLClassManager::queryInterface | ( | const InterfaceID & | iid,
|  | void ** | pinterface
| ) |  |
| override

implementation of IInterface::queryInterface

Definition at line 78 of file DLLClassManager.cpp.

78 {
79 // try local interfaces
80 StatusCode sc = base_class::queryInterface(iid, pinterface);
81 if (sc.isSuccess()) return sc;
82 // fall back on the owner
83 return m_pOuter->queryInterface(iid, pinterface);
84 }
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
implements::queryInterface
StatusCode queryInterface(const InterfaceID &ti, void **pp) override
Implementation of IInterface::queryInterface.
Definition: implements.h:22
DLLClassManager::m_pOuter
SmartIF< IInterface > m_pOuter
Definition: DLLClassManager.h:42
IInterface::queryInterface
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)=0
Set the void** to the pointer to the requested interface of the instance.

## Member Data Documentation

SmartIF<IMessageSvc> DLLClassManager::m_msgsvc
| private

Definition at line 41 of file DLLClassManager.h.

SmartIF<IInterface> DLLClassManager::m_pOuter
| private

Definition at line 42 of file DLLClassManager.h.

SmartIF<ISvcLocator> DLLClassManager::m_svclocator
| private

Definition at line 40 of file DLLClassManager.h.

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

- GaudiCoreSvc/src/ApplicationMgr/DLLClassManager.h
- GaudiCoreSvc/src/ApplicationMgr/DLLClassManager.cpp