ModuleBase Class Reference

#include <modules.h>

Inheritance diagram for ModuleBase:

Inheritance graph
[legend]
Collaboration diagram for ModuleBase:

Collaboration graph
[legend]
List of all members.

Detailed Description

Abstract base class for Modules.

Plugins must derive their main class from this class, and override the pure virtual functions onInit() and onExit().

Definition at line 51 of file modules.h.


Public Types

enum  ModulePriority { PR_LOW = -1, PR_NORMAL = 0, PR_HIGH = 1 }
 Module priority; this affects network scheduling policy for sockets of this module. More...

Public Member Functions

 ModuleBase (const std::string &name)
virtual ~ModuleBase ()
virtual bool onInit ()=0
 Called from main application when the module is loaded.
virtual int onExit ()=0
 Called from main application when the module is about to be unloaded.
virtual std::string getDesc ()
 Retrieve a descriptive module name.
std::string getName () const
 Returns the name of this module, as declared with DECLARE_MODULE macro.
int8_t getPriority () const
void setPriority (ModulePriority pri)

Private Member Functions

 ModuleBase ()

Private Attributes

HNMODULE m_handle
 Platform-specific handle for the module.
int8_t m_priority
 This modules' priority (networking).
std::string m_name
 Name of the module, as passed to constructor.

Friends

class ModManager
 ModManager needs to access the above handle.
struct Detail::InitializerBase

Member Enumeration Documentation

enum ModuleBase::ModulePriority
 

Module priority; this affects network scheduling policy for sockets of this module.

Enumeration values:
PR_LOW 
PR_NORMAL 
PR_HIGH 

Definition at line 99 of file modules.h.


Constructor & Destructor Documentation

ModuleBase::ModuleBase const std::string &  name  ) 
 

Definition at line 97 of file modules.cpp.

ModuleBase::~ModuleBase  )  [virtual]
 

Definition at line 99 of file modules.cpp.

ModuleBase::ModuleBase  )  [private]
 


Member Function Documentation

std::string ModuleBase::getDesc  )  [virtual]
 

Retrieve a descriptive module name.

Returns:
Descriptive name for the module. The return value length should not exceed 40 characters. Overriding this virtual function is purely optional. The base class implementation of this function returns an empty string.

Definition at line 100 of file modules.cpp.

References m_name.

std::string ModuleBase::getName  )  const [inline]
 

Returns the name of this module, as declared with DECLARE_MODULE macro.

Reimplemented from Object.

Definition at line 93 of file modules.h.

Referenced by ModManager::onInit().

int8_t ModuleBase::getPriority  )  const [inline]
 

Definition at line 105 of file modules.h.

virtual int ModuleBase::onExit  )  [pure virtual]
 

Called from main application when the module is about to be unloaded.

Returns:
Standard return value indicating module exit status. Exit status 0 means everything is ok, nonzero means some kind of an error. Note that the nonzero return value serves only as informative value - the module unloading will still proceed even if the return value is nonzero.

virtual bool ModuleBase::onInit  )  [pure virtual]
 

Called from main application when the module is loaded.

Returns:
True if the module initialized successfully. False otherwise. Note: If you return false from here, the module will be unloaded immediately, and onExit() will not be called.

Referenced by ModManager::initialize(), and ModManager::onInit().

void ModuleBase::setPriority ModulePriority  pri  )  [inline]
 

Definition at line 106 of file modules.h.


Friends And Related Function Documentation

friend struct Detail::InitializerBase [friend]
 

Definition at line 118 of file modules.h.

friend class ModManager [friend]
 

ModManager needs to access the above handle.

Definition at line 117 of file modules.h.


Member Data Documentation

HNMODULE ModuleBase::m_handle [private]
 

Platform-specific handle for the module.

Definition at line 111 of file modules.h.

std::string ModuleBase::m_name [private]
 

Name of the module, as passed to constructor.

Reimplemented from Object.

Definition at line 121 of file modules.h.

Referenced by getDesc().

int8_t ModuleBase::m_priority [private]
 

This modules' priority (networking).

Definition at line 114 of file modules.h.


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