11#include <framework/core/FrameworkExceptions.h>
27 class ModuleProxyBase;
121 std::shared_ptr<Module>
registerModule(
const std::string& moduleName,
122 std::string sharedLibPath =
"")
noexcept(
false);
141 static std::list< std::shared_ptr<Module> >
getModulesByProperties(
const std::list< std::shared_ptr<Module> >& modulePathList,
142 unsigned int propertyFlags);
145 static bool allModulesHaveFlag(
const std::list<std::shared_ptr<Module>>& list,
unsigned int flag);
170 const std::filesystem::directory_entry& mapPath);
void registerModuleProxy(ModuleProxyBase *moduleProxy)
Registers a module proxy.
const std::map< std::string, std::string > & getAvailableModules() const
Returns a map of all modules that were found in the module search paths.
const std::list< std::shared_ptr< Module > > & getCreatedModules() const
Returns a reference to the list of created modules.
std::list< std::shared_ptr< Module > > m_createdModulesList
List of all created modules.
static std::list< std::shared_ptr< Module > > getModulesByProperties(const std::list< std::shared_ptr< Module > > &modulePathList, unsigned int propertyFlags)
Returns a list of those modules which carry property flags matching the specified ones.
const std::list< std::string > & getModuleSearchPaths() const
Returns a reference to the list of the modules search filepaths.
std::shared_ptr< Module > registerModule(const std::string &moduleName, std::string sharedLibPath="") noexcept(false)
Creates an instance of a module and registers it to the ModuleManager.
ModuleManager(const ModuleManager &)
Disable/Hide the copy constructor.
std::list< std::string > m_moduleSearchPathList
List of all checked and validated filepaths that are searched for map files.
static ModuleManager & Instance()
Exception is thrown if the requested module could not be created by the ModuleManager.
std::map< std::string, std::string > m_moduleNameLibMap
Maps the module name to the filename of the shared library which containes the module.
static void fillModuleNameLibMap(std::map< std::string, std::string > &moduleNameLibMap, const std::filesystem::directory_entry &mapPath)
Adds the module names defined in the map file to the list of known module names.
~ModuleManager()
The ModuleManager destructor.
ModuleManager & operator=(const ModuleManager &)
Disable/Hide the copy assignment operator.
ModuleManager()
The constructor is hidden to avoid that someone creates an instance of this class.
std::map< std::string, ModuleProxyBase * > m_registeredProxyMap
Maps the module name to a pointer of its proxy.
void reset()
Delete all created modules.
void addModuleSearchPath(const std::string &path)
Adds a new filepath to the list of filepaths which are searched for a requested module.
static bool allModulesHaveFlag(const std::list< std::shared_ptr< Module > > &list, unsigned int flag)
Returns true if and only if all modules in list have the given flag (or list is empty).
The base module proxy class is used to create new instances of a module.
#define BELLE2_DEFINE_EXCEPTION(ClassName, Message)
Macro that defines an exception with the given message template.
Abstract base class for different kinds of events.