| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Public Member Functions | Private Attributes

# 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< ISvcLocator > | m_svclocator
SmartIF< IMessageSvc > | m_msgsvc
SmartIF< IInterface > | m_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.

                                                        {
      m_pOuter = iface;
      m_svclocator = m_pOuter;

      assert(m_svclocator.isValid());

      addRef(); // Initial count set to 1
    }

DLLClassManager::~DLLClassManager | ( | ) | `[virtual]`

Definition at line 31 of file DLLClassManager.cpp.

                                      {
    }

## 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.

                                                                {
      // Access the message service if not yet done already
      if (!m_msgsvc.isValid()) {
        m_msgsvc = m_svclocator;
      }
      MsgStream log(m_msgsvc, "DllClassManager");

      std::string mod = module=="" ? System::moduleNameFull() : module;
      if( module == "NONE" ) return StatusCode::SUCCESS;

      void* libHandle = 0;
      StatusCode status = StatusCode::FAILURE;
      try
      {
        status = System::loadDynamicLib( module, &libHandle);
      }
      catch ( const std::exception & excpt )
      {
        if ( m_msgsvc )
        {
          log << MSG::ERROR << "Exception whilst loading " << module << " : " << excpt.what() << endmsg;
        }
        status = StatusCode::FAILURE;
      }

      if( status.isFailure() ) {
        // DLL library not loaded
        log << MSG::ERROR << "Could not load module " << module << endmsg;
        log << MSG::ERROR << "System Error: " << System::getLastErrorString() << endmsg;
        return StatusCode::FAILURE;
      }
      //FIXME this is a hack to avoid a very early call to moduleLoad from
      //FIXME AppMgr::i_startup
      if (fireIncident && module != "") {
        //now fire ModuleLoadedIncident
        const bool CREATEIF(true);
        SmartIF<IIncidentSvc> pIncidentSvc(m_svclocator->service("IncidentSvc", CREATEIF));
        if( !pIncidentSvc.isValid() )  {
          log << MSG::FATAL << "Can not locate IncidentSvc" << endmsg;
          throw GaudiException("Error retrieving IncidentSvc",
                               "DLLClassManager::DLLClassManager", StatusCode::FAILURE);
        }
        pIncidentSvc->fireIncident(ModuleLoadedIncident("DLLClassManager",
                                                         module) );
      }

      return StatusCode::SUCCESS;
    }

StatusCode DLLClassManager::queryInterface | ( | const InterfaceID & | iid,
|  | void ** | pinterface
| ) |  | `[virtual]`

implementation of IInterface::queryInterface

Implements IInterface.

Definition at line 86 of file DLLClassManager.cpp.

                                                                                        {
      // try local interfaces
      StatusCode sc = base_class::queryInterface(iid, pinterface);
      if (sc.isSuccess()) return sc;
      // fall back on the owner
      return m_pOuter->queryInterface(iid, pinterface);
    }

## Member Data Documentation

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.

SmartIF<ISvcLocator> DLLClassManager::m_svclocator`[private]`

Definition at line 42 of file DLLClassManager.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiCoreSvc/src/ApplicationMgr/DLLClassManager.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiCoreSvc/src/ApplicationMgr/DLLClassManager.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines