OpenWalnut 1.3.1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
WModuleLoader Class Reference

Loads module prototypes from shared objects in a given directory and injects it into the module factory. More...

#include <WModuleLoader.h>

List of all members.

Public Member Functions

 WModuleLoader ()
 Constructor.
 ~WModuleLoader ()
 Destructor, closes all handles to shared libraries.
void load (WSharedAssociativeContainer< std::set< boost::shared_ptr< WModule > > >::WriteTicket ticket)
 Load the module prototypes from the shared libraries.

Static Public Member Functions

static std::string getModulePrefix ()
 Returns the prefix of a shared module library filename.

Private Member Functions

void load (WSharedAssociativeContainer< std::set< boost::shared_ptr< WModule > > >::WriteTicket ticket, boost::filesystem::path dir, unsigned int level=0)
 Load the module prototypes from the shared libraries from the specified directory.

Private Attributes

std::vector< boost::shared_ptr
< WSharedLib > > 
m_libs
 All the loaded shared libraries.

Detailed Description

Loads module prototypes from shared objects in a given directory and injects it into the module factory.

Definition at line 44 of file WModuleLoader.h.


Constructor & Destructor Documentation

WModuleLoader::WModuleLoader ( ) [explicit]

Constructor.

It does not load any files. Use load to do this.

Definition at line 39 of file WModuleLoader.cpp.

WModuleLoader::~WModuleLoader ( )

Destructor, closes all handles to shared libraries.

Definition at line 44 of file WModuleLoader.cpp.

References m_libs.


Member Function Documentation

std::string WModuleLoader::getModulePrefix ( ) [static]

Returns the prefix of a shared module library filename.

Returns:
the prefix.

Definition at line 165 of file WModuleLoader.cpp.

References WSharedLib::getSystemPrefix().

Referenced by load().

void WModuleLoader::load ( WSharedAssociativeContainer< std::set< boost::shared_ptr< WModule > > >::WriteTicket  ticket,
boost::filesystem::path  dir,
unsigned int  level = 0 
) [private]

Load the module prototypes from the shared libraries from the specified directory.

It traverses the subdirectories and searches there. Traversion depth is 1.

Parameters:
ticketA write ticket to a shared container.
dirthe directory to load
levelthe traversion level

Definition at line 50 of file WModuleLoader.cpp.

References WLogger::addLogMessage(), wlog::debug(), WLogger::getLogger(), getModulePrefix(), WPathHelper::getModuleResourcePath(), WSharedLib::getSystemSuffix(), load(), m_libs, and WException::what().

void WModuleLoader::load ( WSharedAssociativeContainer< std::set< boost::shared_ptr< WModule > > >::WriteTicket  ticket)

Load the module prototypes from the shared libraries.

Parameters:
ticketA write ticket to a shared container.

Definition at line 141 of file WModuleLoader.cpp.

References WLogger::addLogMessage(), WPathHelper::getAllModulePaths(), and WLogger::getLogger().

Referenced by load(), and WModuleFactory::load().


Member Data Documentation

std::vector< boost::shared_ptr< WSharedLib > > WModuleLoader::m_libs [private]

All the loaded shared libraries.

Get freed on destruction. So do NOT free this instance while the libs are used.

Definition at line 76 of file WModuleLoader.h.

Referenced by load(), and ~WModuleLoader().


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