Fawkes API  Fawkes Development Version
fawkes::ModuleManager Class Reference

Dynamic module manager. More...

#include <>>

List of all members.

Public Member Functions

 ModuleManager (const char *module_base_dir, Module::ModuleFlags open_flags=Module::MODULE_FLAGS_DEFAULT)
 Constructor of NetworkManagerTemplate.
virtual ~ModuleManager ()
 Destructor.
virtual Moduleopen_module (const char *filename)
 Open a module.
virtual void close_module (Module *module)
 Close a module by Module instance.
virtual void close_module (const char *filename)
 Close a module by filename.
virtual bool module_opened (const char *filename)
 Check if the module is already opened.
virtual Moduleget_module (const char *filename)
 Get a module if opened.
virtual const char * get_module_file_extension ()
 Get the file extension for the current module type.
void set_open_flags (Module::ModuleFlags open_flags)
 Set flags to open modules with.

Detailed Description

Dynamic module manager.

Manager to load and unload modules, keeps track of loaded modules and does not reload modules if they are already loaded.

Author:
Tim Niemueller

Constructor & Destructor Documentation

fawkes::ModuleManager::ModuleManager ( const char *  module_base_dir,
Module::ModuleFlags  open_flags = Module::MODULE_FLAGS_DEFAULT 
)

Constructor of NetworkManagerTemplate.

Parameters:
module_base_dirThe module basedir where to look for plugins
open_flagsflags to pass to modules when opening them

Definition at line 45 of file module_manager.cpp.

fawkes::ModuleManager::~ModuleManager ( ) [virtual]

Destructor.

Definition at line 55 of file module_manager.cpp.


Member Function Documentation

void fawkes::ModuleManager::close_module ( Module module) [virtual]

Close a module by Module instance.

Parameters:
moduleThe module that is to be closed

Definition at line 117 of file module_manager.cpp.

References fawkes::Module::get_base_filename().

Referenced by fawkes::BlackBoardInstanceFactory::delete_interface_instance().

void fawkes::ModuleManager::close_module ( const char *  filename) [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

Definition at line 129 of file module_manager.cpp.

References fawkes::Module::unref().

Module * fawkes::ModuleManager::get_module ( const char *  filename) [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.

Definition at line 153 of file module_manager.cpp.

Referenced by fawkes::BlackBoardInstanceFactory::delete_interface_instance().

const char * fawkes::ModuleManager::get_module_file_extension ( ) [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")

Definition at line 183 of file module_manager.cpp.

Referenced by fawkes::BlackBoardInstanceFactory::new_interface_instance(), and fawkes::BlackBoardInstanceFactory::delete_interface_instance().

bool fawkes::ModuleManager::module_opened ( const char *  filename) [virtual]

Check if the module 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::get_base_filename() returns
Returns:
true if module has been opened, false otherwise

Definition at line 172 of file module_manager.cpp.

Module * fawkes::ModuleManager::open_module ( const char *  filename) [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

Definition at line 87 of file module_manager.cpp.

References fawkes::Module::ref(), fawkes::Module::open(), and fawkes::Module::get_base_filename().

Referenced by fawkes::BlackBoardInstanceFactory::new_interface_instance().

void fawkes::ModuleManager::set_open_flags ( Module::ModuleFlags  open_flags)

Set flags to open modules with.

Parameters:
open_flagsflags to pass to modules when opening them

Definition at line 70 of file module_manager.cpp.

Referenced by fawkes::PluginManager::PluginManager(), and fawkes::PluginManager::set_module_flags().


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