fawkes::ModuleDL Class Reference

A Module implementation for the dl dynamic loader library that comes with glibc, applicable for Linux Systems. More...

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

Inheritance diagram for fawkes::ModuleDL:

[legend]
List of all members.

Public Member Functions

 ModuleDL (std::string filename, Module::ModuleFlags flags=Module::MODULE_FLAGS_DEFAULT)
 Constructor for ModuleDL.
virtual ~ModuleDL ()
 Destructor of ModuleDL.
virtual void open ()
 Open the module.
virtual bool close ()
 Close the module.
virtual void ref ()
 Increment the reference count of this module.
virtual void unref ()
 Decrease the reference count of this module.
virtual bool notref ()
 Check if there are no reference to this module.
virtual unsigned int get_ref_count ()
 Get the reference count of this module.
virtual bool has_symbol (const char *symbol_name)
 Check if the module has the given symbol.
virtual void * get_symbol (const char *symbol_name)
 Get a symbol from the module.
virtual bool operator== (ModuleDL &cmod)
 Compare to another ModuleDL instance.
virtual std::string get_filename ()
 Get the full file name of the module.
virtual std::string get_base_filename ()
 Get the base file name of the module.

Static Public Member Functions

static const char * get_file_extension ()
 Get file extension for dl modules.

Detailed Description

A Module implementation for the dl dynamic loader library that comes with glibc, applicable for Linux Systems.

Definition at line 33 of file module_dl.h.


Constructor & Destructor Documentation

fawkes::ModuleDL::ModuleDL ( std::string  filename,
Module::ModuleFlags  flags = Module::MODULE_FLAGS_DEFAULT 
)

Constructor for ModuleDL.

Parameters:
filename Full filename of the module
flags Module flags,
See also:
Module

Definition at line 52 of file module_dl.cpp.

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

Destructor of ModuleDL.

Definition at line 66 of file module_dl.cpp.

References close().


Member Function Documentation

bool fawkes::ModuleDL::close (  )  [virtual]

Close the module.

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

Implements fawkes::Module.

Definition at line 138 of file module_dl.cpp.

Referenced by ~ModuleDL().

std::string fawkes::ModuleDL::get_base_filename (  )  [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

Implements fawkes::Module.

Definition at line 274 of file module_dl.cpp.

const char * fawkes::ModuleDL::get_file_extension (  )  [static]

Get file extension for dl modules.

Returns:
Returns the file extension for dl modules, this is "so"

Definition at line 253 of file module_dl.cpp.

std::string fawkes::ModuleDL::get_filename (  )  [virtual]

Get the full file name of the module.

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

Implements fawkes::Module.

Definition at line 263 of file module_dl.cpp.

Referenced by operator==().

unsigned int fawkes::ModuleDL::get_ref_count (  )  [virtual]

Get the reference count of this module.

Returns:
Returns the number of references to this module

Implements fawkes::Module.

Definition at line 189 of file module_dl.cpp.

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

Get a symbol from the module.

Parameters:
symbol_name The name of the symbol. NOTE: C++ symbols are mangled with type info and thus are not plainly available as symbol name. Use extern "C" to avoid this. Read http://www.isotton.com/howtos/C++-dlopen-mini-HOWTO/C++-dlopen-mini-HOWTO.html for more information on this topic.
Returns:
Returns a pointer to the symbol or NULL if symbol was not found

Implements fawkes::Module.

Definition at line 240 of file module_dl.cpp.

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

Check if the module has the given symbol.

Parameters:
symbol_name The name of the symbol. NOTE: C++ symbols are mangled with type info and thus are not plainly available as symbol name. Use extern "C" to avoid this. Read http://www.isotton.com/howtos/C++-dlopen-mini-HOWTO/C++-dlopen-mini-HOWTO.html for more information on this topic.
Returns:
Returns true if the symbol was found, false otherwise

Implements fawkes::Module.

Definition at line 217 of file module_dl.cpp.

bool fawkes::ModuleDL::notref (  )  [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

Implements fawkes::Module.

Definition at line 179 of file module_dl.cpp.

void fawkes::ModuleDL::open (  )  [virtual]

Open the module.

Returns:
Returns true if the module could be opened, false otherwise
Exceptions:
ModuleOpenException Thrown if there was any problem while loading the module

Implements fawkes::Module.

Definition at line 78 of file module_dl.cpp.

References fawkes::Exception::append(), fawkes::File::is_regular(), fawkes::Module::MODULE_BIND_DEEP, fawkes::Module::MODULE_BIND_GLOBAL, fawkes::Module::MODULE_BIND_LAZY, fawkes::Module::MODULE_BIND_LOCAL, and fawkes::Module::MODULE_BIND_NOW.

bool fawkes::ModuleDL::operator== ( ModuleDL cmod  )  [virtual]

Compare to another ModuleDL instance.

Parameters:
cmod a reference to the other comparison instance
Returns:
Returns true, if the full file names of both modules are the same, false otherwise

Definition at line 201 of file module_dl.cpp.

References get_filename().

void fawkes::ModuleDL::ref (  )  [virtual]

Increment the reference count of this module.

Implements fawkes::Module.

Definition at line 158 of file module_dl.cpp.

void fawkes::ModuleDL::unref (  )  [virtual]

Decrease the reference count of this module.

Implements fawkes::Module.

Definition at line 166 of file module_dl.cpp.


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