CMS 3D CMS Logo

IgModuleDef Class Reference

A base class for modules. More...

#include <Iguana/Framework/interface/IgModuleDef.h>

Inheritance diagram for IgModuleDef:

IgSimpleModuleDef

List of all members.

Public Member Functions

virtual void attach (void)
void bind (IgModule *module)
virtual void detach (void)
 IgModuleDef (void)
IgModulemodule (void) const
virtual void query (void)
void release (void)
virtual ~IgModuleDef (void)

Private Member Functions

 IgModuleDef (const IgModuleDef &)
IgModuleDefoperator= (const IgModuleDef &)

Private Attributes

IgModulem_module


Detailed Description

A base class for modules.

This class is a bridge between IgModule and a dynamically loaded shared library. A IgModule exists for a shared library even when it is not resident in memory. A IgModuleDef exists for each module that is loaded in memory, usually just the simple proxy generated with DEFINE_IGUANA_MODULE().

The purpose of this class is to allow a module to appear as an object. The class is not meant to be generally visible however, DEFINE_IGUANA_MODULE() and DEFINE_SEAL_PLUGIN() macros should be sufficient to most users.

A module has three entry points each of which is a virtual method in this class: attach(), detach() and query(). The methods are invoked by respective methods in the IgModule, thus causing them to be executed in the context of the loaded shared library.

Subclasses should override at least query() to describe the properties of the module. The implementation should invoke declare() in the appropriate IgPluginFactory subclasses to register the capabilities of the module. DEFINE_IGUANA_PLUGIN() arranges such calls to take place.

The subclass can also override the attach() and detach() methods to execute actions. Plug-ins registered in query() must be given factories in attach() by invoking the installFactory() method in the appropriate IgPluginFactory. DEFINE_IGUANA_PLUGIN() arranges that to happen. Additional actions can be arranged to execute at attach() time with IG_MODULE_ATTACH_ACTION(), for example to initialize external third-party libraries. There is no normally no reas to override detach(); it's purpose is to undo attach(), but as factories don't need to be removed, there is often little to do. Use IG_MODULE_DETACH_ACTION() to register actions to be executed in detach().

Subclasses should not define a constructor or a destructor, or should at the very least make them very simple.

Definition at line 174 of file IgModuleDef.h.


Constructor & Destructor Documentation

IgModuleDef::IgModuleDef ( void   ) 

Definition at line 20 of file IgModuleDef.cc.

00021     : m_module (0)
00022 {}

IgModuleDef::~IgModuleDef ( void   )  [virtual]

Definition at line 24 of file IgModuleDef.cc.

References LFplugin_manager, LOG, m_module, and warning.

00025 {
00026     if (m_module)
00027         LOG (0, warning, LFplugin_manager, "Attached IgModuleDef destroyed\n");
00028 }

IgModuleDef::IgModuleDef ( const IgModuleDef  )  [private]


Member Function Documentation

void IgModuleDef::attach ( void   )  [virtual]

Reimplemented in IgSimpleModuleDef.

Definition at line 31 of file IgModuleDef.cc.

Referenced by IgModule::attach().

00032 {}

void IgModuleDef::bind ( IgModule module  ) 

Definition at line 43 of file IgModuleDef.cc.

References ASSERT, and m_module.

Referenced by IgModule::attach(), and IgModule::query().

00044 {
00045     ASSERT (! m_module);
00046     ASSERT (module);
00047     m_module = module;
00048 }

void IgModuleDef::detach ( void   )  [virtual]

Reimplemented in IgSimpleModuleDef.

Definition at line 35 of file IgModuleDef.cc.

Referenced by IgModule::detach().

00036 {}

IgModule * IgModuleDef::module ( void   )  const

Definition at line 58 of file IgModuleDef.cc.

References ASSERT, and m_module.

Referenced by IgPluginFactoryImplBase< Types >::declare(), and IgPluginFactoryImpl< Proto >::installFactory().

00059 {
00060     ASSERT (m_module);
00061     return m_module;
00062 }

IgModuleDef& IgModuleDef::operator= ( const IgModuleDef  )  [private]

void IgModuleDef::query ( void   )  [virtual]

Reimplemented in IgSimpleModuleDef.

Definition at line 39 of file IgModuleDef.cc.

Referenced by IgModule::query().

00040 {}

void IgModuleDef::release ( void   ) 

Definition at line 51 of file IgModuleDef.cc.

References ASSERT, and m_module.

Referenced by IgModule::detach(), and IgModule::query().

00052 {
00053     ASSERT (m_module);
00054     m_module = 0;
00055 }


Member Data Documentation

IgModule* IgModuleDef::m_module [private]

Definition at line 195 of file IgModuleDef.h.

Referenced by bind(), module(), release(), and ~IgModuleDef().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:13 2009 for CMSSW by  doxygen 1.5.4