OpenWalnut
1.5.0dev
|
Loads module prototypes from shared objects in a given directory and injects it into the module factory. More...
#include <WModuleLoader.h>
Classes | |
struct | PostponedLoad |
Helper to store information on a lib which gets initialized later. More... | |
Public Types | |
typedef std::shared_ptr< WModuleLoader > | SPtr |
Shared pointer abbreviation. More... | |
typedef std::shared_ptr< const WModuleLoader > | ConstSPtr |
Const pointer abbreviation. More... | |
Public Member Functions | |
WModuleLoader () | |
Constructor. More... | |
~WModuleLoader () | |
Destructor, closes all handles to shared libraries. More... | |
void | load (WSharedAssociativeContainer< std::set< std::shared_ptr< WModule > > >::WriteTicket ticket) |
Load the module prototypes from the shared libraries. More... | |
void | initializeExtensions () |
The loader also stores information on which library provides the arbitrary registration mechanism. More... | |
Static Public Member Functions | |
static std::string | getModulePrefix () |
Returns the prefix of a shared module library filename. More... | |
Private Member Functions | |
void | load (WSharedAssociativeContainer< std::set< std::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. More... | |
Private Attributes | |
std::vector< std::shared_ptr< WSharedLib > > | m_libs |
All the loaded shared libraries. More... | |
std::vector< PostponedLoad > | m_arbitraryRegisterLibs |
The libs which need to be initialized when OW is loaded completely. More... | |
Loads module prototypes from shared objects in a given directory and injects it into the module factory.
Definition at line 42 of file WModuleLoader.h.
typedef std::shared_ptr< const WModuleLoader > WModuleLoader::ConstSPtr |
Const pointer abbreviation.
Definition at line 53 of file WModuleLoader.h.
typedef std::shared_ptr< WModuleLoader > WModuleLoader::SPtr |
Shared pointer abbreviation.
Definition at line 48 of file WModuleLoader.h.
|
explicit |
Constructor.
It does not load any files. Use load to do this.
Definition at line 37 of file WModuleLoader.cpp.
WModuleLoader::~WModuleLoader | ( | ) |
Destructor, closes all handles to shared libraries.
Definition at line 42 of file WModuleLoader.cpp.
References m_libs.
|
static |
Returns the prefix of a shared module library filename.
Definition at line 200 of file WModuleLoader.cpp.
References WSharedLib::getSystemPrefix().
Referenced by load().
void WModuleLoader::initializeExtensions | ( | ) |
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< std::shared_ptr< WModule > > >::WriteTicket | ticket | ) |
Load the module prototypes from the shared libraries.
ticket | A 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().
|
private |
Load the module prototypes from the shared libraries from the specified directory.
It traverses the subdirectories and searches there. Traversion depth is 1.
ticket | A write ticket to a shared container. |
dir | the directory to load |
level | the 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().
|
private |
The libs which need to be initialized when OW is loaded completely.
Definition at line 134 of file WModuleLoader.h.
Referenced by initializeExtensions(), and load().
|
private |
All the loaded shared libraries.
Get freed on destruction. So do NOT free this instance while the libs are used.
Definition at line 90 of file WModuleLoader.h.
Referenced by load(), and ~WModuleLoader().