The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

DLLFactory< ReturnType > Class Template Reference

This is the highest-level class of the DLLFactory system used to load InspIRCd modules and commands. More...

#include <dynamic.h>

Inheritance diagram for DLLFactory< ReturnType >:

Inheritance graph
[legend]
Collaboration diagram for DLLFactory< ReturnType >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DLLFactory (InspIRCd *Instance, const char *fname, const char *func_name)
 Default constructor.
ReturnType * CallInit ()
 Calls the 'init_module' C exported function within a module, which returns a pointer to a Module derived object.
 ~DLLFactory ()
 The destructor deletes the ModuleFactory pointer.

Protected Types

typedef ReturnType *( initfunctype )(InspIRCd *)
 This typedef represents the init_* function within each module or command.

Protected Attributes

initfunctypeinit_func
 Pointer to the init function.
InspIRCdServerInstance
 Instance pointer to be passed to init_*() when it is called.

Detailed Description

template<typename ReturnType>
class DLLFactory< ReturnType >

This is the highest-level class of the DLLFactory system used to load InspIRCd modules and commands.

All the dirty mucking around with dl*() is done by DLLManager, all this does it put a pretty shell on it and make it nice to use to load modules and core commands. This class is quite specialised for these two uses and it may not be useful more generally -- use DLLManager directly for that.

Definition at line 98 of file dynamic.h.


Member Typedef Documentation

template<typename ReturnType>
typedef ReturnType*( DLLFactory< ReturnType >::initfunctype)(InspIRCd *) [protected]
 

This typedef represents the init_* function within each module or command.

The init_module function is the only exported extern "C" declaration in any module file. In a cmd_*.cpp file the equivilant is init_command

Definition at line 105 of file dynamic.h.


Constructor & Destructor Documentation

template<typename ReturnType>
DLLFactory< ReturnType >::DLLFactory InspIRCd Instance,
const char *  fname,
const char *  func_name
[inline]
 

Default constructor.

This constructor passes its paramerers down through DLLFactoryBase and then DLLManager to load the module, then calls the factory function to retrieve a pointer to a ModuleFactory class. It is then down to the core to call the ModuleFactory::CreateModule() method and receive a Module* which it can insert into its module lists.

Definition at line 122 of file dynamic.h.

References DLLManager::GetSymbol(), and DLLManager::LastError().

template<typename ReturnType>
DLLFactory< ReturnType >::~DLLFactory  )  [inline]
 

The destructor deletes the ModuleFactory pointer.

Definition at line 157 of file dynamic.h.


Member Function Documentation

template<typename ReturnType>
ReturnType* DLLFactory< ReturnType >::CallInit  )  [inline]
 

Calls the 'init_module' C exported function within a module, which returns a pointer to a Module derived object.

Definition at line 143 of file dynamic.h.

References ServerInstance.

Referenced by ModuleManager::Load().


Member Data Documentation

template<typename ReturnType>
initfunctype* DLLFactory< ReturnType >::init_func [protected]
 

Pointer to the init function.

Definition at line 109 of file dynamic.h.

template<typename ReturnType>
InspIRCd* DLLFactory< ReturnType >::ServerInstance [protected]
 

Instance pointer to be passed to init_*() when it is called.

Definition at line 113 of file dynamic.h.


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