OpenWalnut  1.4.0
Classes | Public Types | 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.

Classes

struct  PostponedLoad
 Helper to store information on a lib which gets initialized later. More...

Public Types

typedef boost::shared_ptr
< WModuleLoader
SPtr
 Shared pointer abbreviation.
typedef boost::shared_ptr
< const WModuleLoader
ConstSPtr
 Const pointer abbreviation.

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.
void initializeExtensions ()
 The loader also stores information on which library provides the arbitrary registration mechanism.

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.
std::vector< PostponedLoadm_arbitraryRegisterLibs
 The libs which need to be initialized when OW is loaded completely.

Detailed Description

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

Definition at line 43 of file WModuleLoader.h.


Member Typedef Documentation

typedef boost::shared_ptr< const WModuleLoader > WModuleLoader::ConstSPtr

Const pointer abbreviation.

Definition at line 54 of file WModuleLoader.h.

typedef boost::shared_ptr< WModuleLoader > WModuleLoader::SPtr

Shared pointer abbreviation.

Definition at line 49 of file WModuleLoader.h.


Constructor & Destructor Documentation

Constructor.

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

Definition at line 37 of file WModuleLoader.cpp.

Destructor, closes all handles to shared libraries.

Definition at line 42 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 200 of file WModuleLoader.cpp.

References WSharedLib::getSystemPrefix().

Referenced by load().

The loader also stores information on which library provides the arbitrary registration mechanism.

This cannot be called during load, as OW is not completely initialized at this point. So we do this here. Call this after startup, before project loading.

Definition at line 188 of file WModuleLoader.cpp.

References wlog::debug(), and m_arbitraryRegisterLibs.

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 164 of file WModuleLoader.cpp.

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

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 48 of file WModuleLoader.cpp.

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


Member Data Documentation

The libs which need to be initialized when OW is loaded completely.

Definition at line 135 of file WModuleLoader.h.

Referenced by initializeExtensions(), and load().

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 91 of file WModuleLoader.h.

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


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