Fawkes API Fawkes Development Version

fawkes::ModuleManagerTemplate< MODULE_CLASS > Class Template Reference

Manager to load and unload modules, keeps track of loaded modules and does not reload modules if they are already loaded This implementation is a simple template that takes the Module implementation class name as its template parameter. More...

#include <module_manager_template.h>

Inheritance diagram for fawkes::ModuleManagerTemplate< MODULE_CLASS >:

List of all members.

Public Member Functions

 ModuleManagerTemplate (const char *module_base_dir="")
 Constructor of NetworkManagerTemplate.
 ~ModuleManagerTemplate ()
 Destructor.
MODULE_CLASS * open_module (const char *filename)
 Open a module.
void close_module (Module *module)
 Close a module by Module instance.
void close_module (const char *filename)
 Close a module by filename.
Moduleget_module (const char *filename)
 Get a module if opened.
bool module_opened (const char *filename)
 Check if the module for the given filename is already opened.
const char * get_module_file_extension ()
 Get the file extension for the current module type.

Detailed Description

template<class MODULE_CLASS>
class fawkes::ModuleManagerTemplate< MODULE_CLASS >

Manager to load and unload modules, keeps track of loaded modules and does not reload modules if they are already loaded This implementation is a simple template that takes the Module implementation class name as its template parameter.

Definition at line 42 of file module_manager_template.h.


Constructor & Destructor Documentation

template<class MODULE_CLASS>
fawkes::ModuleManagerTemplate< MODULE_CLASS >::ModuleManagerTemplate ( const char *  module_base_dir = "") [inline]

Constructor of NetworkManagerTemplate.

Parameters:
module_base_dirThe module basedir where to look for plugins

Definition at line 49 of file module_manager_template.h.

template<class MODULE_CLASS>
fawkes::ModuleManagerTemplate< MODULE_CLASS >::~ModuleManagerTemplate ( ) [inline]

Destructor.

Definition at line 57 of file module_manager_template.h.


Member Function Documentation

template<class MODULE_CLASS>
void fawkes::ModuleManagerTemplate< MODULE_CLASS >::close_module ( Module module) [inline, virtual]

Close a module by Module instance.

Parameters:
moduleThe module that is to be closed

Implements fawkes::ModuleManager.

Definition at line 90 of file module_manager_template.h.

References fawkes::Module::get_base_filename().

template<class MODULE_CLASS>
void fawkes::ModuleManagerTemplate< MODULE_CLASS >::close_module ( const char *  filename) [inline, virtual]

Close a module by filename.

Parameters:
filenamethe name of the module file that should be closed, this is compared to loaded modules and must match what Module::GetBaseFilename() returns

Implements fawkes::ModuleManager.

Definition at line 95 of file module_manager_template.h.

References fawkes::Mutex::lock(), and fawkes::Mutex::unlock().

template<class MODULE_CLASS>
Module* fawkes::ModuleManagerTemplate< MODULE_CLASS >::get_module ( const char *  filename) [inline, virtual]

Get a module if opened.

This will return a pointer to a module if it had already been opened! The reference count is increased and you have to manually unref the module once you are done with it! This method works similar to open_module() with the difference that it is not tried to load the module if it is not open.

Parameters:
filenamefile name of the module
Returns:
a pointer to the module with the reference cound incremented by one if the module had been opened already or NULL if it was not opened.

Implements fawkes::ModuleManager.

Definition at line 109 of file module_manager_template.h.

template<class MODULE_CLASS>
const char* fawkes::ModuleManagerTemplate< MODULE_CLASS >::get_module_file_extension ( ) [inline, virtual]

Get the file extension for the current module type.

Returns:
Returns a string with the file extension that has to be used for modules on the current system (for example "so")

Implements fawkes::ModuleManager.

Definition at line 127 of file module_manager_template.h.

template<class MODULE_CLASS>
bool fawkes::ModuleManagerTemplate< MODULE_CLASS >::module_opened ( const char *  filename) [inline, virtual]

Check if the module for the given filename is already opened.

Parameters:
filenamethe name of the module file to check if it is opened. It is compared to loaded modules and must match what Module::GetBaseFilename() returns
Returns:
true if module has been opened, false otherwise

Implements fawkes::ModuleManager.

Definition at line 121 of file module_manager_template.h.

template<class MODULE_CLASS>
MODULE_CLASS* fawkes::ModuleManagerTemplate< MODULE_CLASS >::open_module ( const char *  filename) [inline, virtual]

Open a module.

Parameters:
filenameThe file name of the module that should be opened. If the ModuleManager implementation takes a base dir argument (recommended) this filename is relative to that base dir
Returns:
Returns the module if the file was opened successfully or NULL otherwise. Do NOT delete the module after usage but use closeModule to close it.
Exceptions:
ModuleOpenExceptionthrown if the module could not be opened

Implements fawkes::ModuleManager.

Definition at line 66 of file module_manager_template.h.

References fawkes::Mutex::lock(), and fawkes::Mutex::unlock().


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends