fawkes::Module Class Reference

Interface representing a dynamically loaded software module. More...

#include <utils/system/dynamic_module/module.h>

Inheritance diagram for fawkes::Module:

[legend]
List of all members.

Public Types

 MODULE_FLAGS_NONE = 0
 No flags.
 MODULE_FLAGS_DEFAULT = 0x000E
 Default flags, these are MODULE_BIND_GLOBAL, MODULE_BIND_NOW and MODULE_BIND_DEEP.
 MODULE_BIND_LAZY = 0x0001
 Perform lazy binding.
 MODULE_BIND_NOW = 0x0002
 Resolve all symbols immediately when loading the library.
 MODULE_BIND_LOCAL = 0x0000
 Symbols defined in this library are not made available to resolve references in subsequently loaded libraries.
 MODULE_BIND_GLOBAL = 0x0004
 Symbols defined in this library are not made available to resolve references in subsequently loaded libraries.
 MODULE_BIND_MASK = 0x0003
 Can be used to encode flags in a longer data field.
 MODULE_BIND_DEEP = 0x0008
 Place the lookup scope of the symbols in this library ahead of the global scope.
enum  ModuleFlags {
  MODULE_FLAGS_NONE = 0, MODULE_FLAGS_DEFAULT = 0x000E, MODULE_BIND_LAZY = 0x0001, MODULE_BIND_NOW = 0x0002,
  MODULE_BIND_LOCAL = 0x0000, MODULE_BIND_GLOBAL = 0x0004, MODULE_BIND_MASK = 0x0003, MODULE_BIND_DEEP = 0x0008
}
 Flags for the loading process. More...

Public Member Functions

virtual ~Module ()
 Virtual empty destructor.
virtual void open ()=0
 Open the module
Exceptions:
ModuleOpenException thrown if there was any problem loading the module.

virtual bool close ()=0
 Close the module.
virtual void ref ()=0
 Increment the reference count of this module.
virtual void unref ()=0
 Decrease the reference count of this module.
virtual bool notref ()=0
 Check if there are no reference to this module.
virtual unsigned int get_ref_count ()=0
 Get the reference count of this module.
virtual bool has_symbol (const char *symbol_name)=0
 Check if the module has the given symbol.
virtual void * get_symbol (const char *symbol_name)=0
 Get a symbol from the module.
virtual std::string get_filename ()=0
 Get the full file name of the module.
virtual std::string get_base_filename ()=0
 Get the base file name of the module.

Detailed Description

Interface representing a dynamically loaded software module.

Author:
Tim Niemueller

Definition at line 39 of file module.h.


Member Enumeration Documentation

enum fawkes::Module::ModuleFlags

Flags for the loading process.

Enumerator:
MODULE_FLAGS_NONE  No flags.
MODULE_FLAGS_DEFAULT  Default flags, these are MODULE_BIND_GLOBAL, MODULE_BIND_NOW and MODULE_BIND_DEEP.
MODULE_BIND_LAZY  Perform lazy binding.

Only resolve symbols as thecode that references them is executed. If the symbol is never referenced,then it is never resolved. (Lazy binding is only performed for function references; references to variables are always immediately bound when the library is loaded.)

MODULE_BIND_NOW  Resolve all symbols immediately when loading the library.

It's the opposite of MODULE_BIND_LAZY. It shall be the the default (makes sense for the framework robotics).

MODULE_BIND_LOCAL  Symbols defined in this library are not made available to resolve references in subsequently loaded libraries.

It's the opposite of MODULE_BIND_GLOBAL. It shall be the default and MODULE_BIND_GLOBAL shall automatically override it.

MODULE_BIND_GLOBAL  Symbols defined in this library are not made available to resolve references in subsequently loaded libraries.
MODULE_BIND_MASK  Can be used to encode flags in a longer data field.
MODULE_BIND_DEEP  Place the lookup scope of the symbols in this library ahead of the global scope.

This means that a self-contained library will use its own symbols in preference to global symbols with the same name contained in libraries that have already been loaded.

Definition at line 43 of file module.h.


Constructor & Destructor Documentation

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

Virtual empty destructor.

Definition at line 90 of file module.cpp.


Member Function Documentation

bool fawkes::Module::close (  )  [pure virtual]

Close the module.

Returns:
Returns true if the module could be closed, false otherwise

Implemented in fawkes::ModuleDL.

std::string fawkes::Module::get_base_filename (  )  [pure virtual]

Get the base file name of the module.

Returns:
Returns the base file name of the module. On Unix systems this is everything after the last slash

Implemented in fawkes::ModuleDL.

Referenced by fawkes::ModuleManagerTemplate< MODULE_CLASS >::close_module().

std::string fawkes::Module::get_filename (  )  [pure virtual]

Get the full file name of the module.

Returns:
Returns a string with the full file name of the module

Implemented in fawkes::ModuleDL.

unsigned int fawkes::Module::get_ref_count (  )  [pure virtual]

Get the reference count of this module.

Returns:
Returns the number of references to this module

Implemented in fawkes::ModuleDL.

void * fawkes::Module::get_symbol ( const char *  symbol_name  )  [pure virtual]

Get a symbol from the module.

Parameters:
symbol_name The name of the symbol.
Returns:
Returns a pointer to the symbol or NULL if symbol was not found

Implemented in fawkes::ModuleDL.

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

bool fawkes::Module::has_symbol ( const char *  symbol_name  )  [pure virtual]

Check if the module has the given symbol.

Parameters:
symbol_name The name of the symbol.
Returns:
Returns true if the symbol was found, false otherwise

Implemented in fawkes::ModuleDL.

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

bool fawkes::Module::notref (  )  [pure virtual]

Check if there are no reference to this module.

Returns:
Returns true if there are no references to this module, false if there is at least one reference

Implemented in fawkes::ModuleDL.

void fawkes::Module::open (  )  [pure virtual]

Open the module

Exceptions:
ModuleOpenException thrown if there was any problem loading the module.

Implemented in fawkes::ModuleDL.

void fawkes::Module::ref (  )  [pure virtual]

Increment the reference count of this module.

Implemented in fawkes::ModuleDL.

void fawkes::Module::unref (  )  [pure virtual]

Decrease the reference count of this module.

Implemented in fawkes::ModuleDL.

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


The documentation for this class was generated from the following files:
Generated on Tue Feb 22 13:31:41 2011 for Fawkes API by  doxygen 1.4.7