20 #ifndef RTC_MODULEMANAGER_H 21 #define RTC_MODULEMANAGER_H 25 #include <coil/DynamicLib.h> 29 #include <coil/Properties.h> 38 #define CONFIG_EXT "manager.modules.config_ext" 39 #define CONFIG_PATH "manager.modules.config_path" 40 #define DETECT_MOD "manager.modules.detect_loadable" 41 #define MOD_LOADPTH "manager.modules.load_path" 42 #define INITFUNC_SFX "manager.modules.init_func_suffix" 43 #define INITFUNC_PFX "manager.modules.init_func_prefix" 44 #define ALLOW_ABSPATH "manager.modules.abs_path_allowed" 45 #define ALLOW_URL "manager.modules.download_allowed" 46 #define MOD_DWNDIR "manager.modules.download_dir" 47 #define MOD_DELMOD "manager.modules.download_cleanup" 48 #define MOD_PRELOAD "manager.modules.preload" 73 using vProperties = std::vector<coil::Properties>;
121 :
reason(std::move(_reason)) {}
136 : name(std::move(_name)) {}
276 std::string
load(
const std::string& file_name);
305 std::string
load(
const std::string& file_name,
306 const std::string& init_func);
325 void unload(
const std::string& file_name);
349 void*
symbol(
const std::string& file_name,
const std::string& func_name);
368 void setLoadpath(
const std::vector<std::string>& load_path);
409 void addLoadpath(
const std::vector<std::string>& load_path);
549 std::string
findFile(
const std::string& fname,
550 const std::vector<std::string>& load_path);
573 bool fileExist(
const std::string& filename);
615 void getModuleList(
const std::string& lang, coil::vstring& modules);
624 void addNewFile(
const std::string& fpath, coil::vstring& modules,
const std::string& lang);
634 const coil::vstring& modules, vProperties& modprops);
685 std::string m_filepath;
687 explicit DllPred(
const char* filepath) : m_filepath(filepath) {}
689 : m_filepath(dll->properties[
"file_path"]) {}
692 return m_filepath == dllentity->
properties.getProperty(
"file_path");
788 #endif // RTC_MODULEMANAGER_H Structure for exception handling of unimplemented part and specified module missing.
Definition: ModuleManager.h:133
std::string getInitFuncName(const std::string &file_path)
Create initialization function symbol.
NotAllowedOperation(const std::string &_reason)
Definition: ModuleManager.h:196
bool m_absoluteAllowed
Flag of absolute path when specify module for the load.
Definition: ModuleManager.h:735
void operator()(DLLEntity *dll)
Definition: ModuleManager.h:775
Structure for exception handling when file open is failed.
Definition: ModuleManager.h:118
void addLoadpath(const std::vector< std::string > &load_path)
Add the module load path.
coil::Properties & m_properties
Module Manager properties.
Definition: ModuleManager.h:674
Module list that has already loaded.
Definition: ModuleManager.h:683
InvalidArguments(const std::string &_reason)
Definition: ModuleManager.h:211
ObjectManager< const char *, DLLEntity, DllPred > m_modules
Module list that has already loaded.
Definition: ModuleManager.h:702
coil::vstring m_supported_languages
Definition: ModuleManager.h:762
coil::DynamicLib dll
Definition: ModuleManager.h:655
void setLoadpath(const std::vector< std::string > &load_path)
Set the module load path.
std::vector< DLLEntity > DllMap
Definition: ModuleManager.h:662
void disallowAbsolutePath()
Disallow absolute path when specify module path.
Definition: ModuleManager.h:481
std::string reason
Definition: ModuleManager.h:122
StringVector::const_iterator StringVectorConstItr
Definition: ModuleManager.h:660
coil::Properties properties
Definition: ModuleManager.h:654
Manager class.
Definition: Manager.h:90
ModuleNotFound(const std::string &_name)
Definition: ModuleManager.h:166
Structure for exception handling when specified symbol cannot be found.
Definition: ModuleManager.h:178
std::string load(const std::string &file_name)
Load the module.
void allowAbsolutePath()
Allow absolute path when specify module path.
Definition: ModuleManager.h:463
Module unloading functor.
Definition: ModuleManager.h:771
void disallowModuleDownload()
Disallow URL when specify module path.
Definition: ModuleManager.h:521
NotFound(std::string _name)
Definition: ModuleManager.h:135
~ModuleManager()
Destructor.
std::vector< coil::Properties > getLoadedModules()
Get the module list that has been loaded.
InvalidOperation(const std::string &_reason)
Definition: ModuleManager.h:226
bool m_downloadAllowed
Flag of URL when specify module for the load.
Definition: ModuleManager.h:727
Structure for exception handling when specified operation is invalid.
Definition: ModuleManager.h:223
StringVector m_loadPath
Module load path list.
Definition: ModuleManager.h:711
std::map< std::string, coil::vstring > m_loadfailmods
Definition: ModuleManager.h:783
Logger rtclog
Logger stream.
Definition: ModuleManager.h:643
StringVector m_configPath
Configuration path list.
Definition: ModuleManager.h:719
StringVector::iterator StringVectorItr
Definition: ModuleManager.h:659
Structure for exception handling when specified argument is invalid.
Definition: ModuleManager.h:208
bool fileExist(const std::string &filename)
Check whether the file exists.
Class for managing objects.
Definition: ObjectManager.h:51
Structure for exception handling when specified module cannot be found.
Definition: ModuleManager.h:163
Error(std::string _reason)
Definition: ModuleManager.h:120
void removeInvalidModules()
Removing incalid module profiles.
Logger class.
Definition: SystemLogger.h:99
DllPred(const char *filepath)
Definition: ModuleManager.h:687
ModuleManager class.
Definition: ModuleManager.h:71
vProperties m_modprofs
Definition: ModuleManager.h:782
std::vector< coil::Properties > getLoadableModules()
Get the loadable module list.
std::vector< std::string > getLoadPath()
Get the module load path.
Definition: ModuleManager.h:387
bool operator()(DLLEntity *dllentity)
Definition: ModuleManager.h:690
void unloadAll()
Unload all modules.
Structure for exception handling when specified file cannot be found.
Definition: ModuleManager.h:148
void * symbol(const std::string &file_name, const std::string &func_name)
Refer to the symbol of the module.
DllMap::const_iterator DllMapConstItr
Definition: ModuleManager.h:664
void addNewFile(const std::string &fpath, coil::vstring &modules, const std::string &lang)
Adding file path not existing cache.
Structure for DLL management.
Definition: ModuleManager.h:652
void(*)(Manager *) ModuleInitFunc
Definition: ModuleManager.h:229
DllMap::iterator DllMapItr
Definition: ModuleManager.h:663
void unload(const std::string &file_name)
Unload the module.
void allowModuleDownload()
Allow URL when specify module path.
Definition: ModuleManager.h:503
ModuleManager(coil::Properties &prop)
Constructor.
DllPred(const DLLEntity *dll)
Definition: ModuleManager.h:688
void getModuleProfiles(const std::string &lang, const coil::vstring &modules, vProperties &modprops)
Getting module properties from given language and file list.
std::string findFile(const std::string &fname, const std::vector< std::string > &load_path)
Search the file from the LoadPath.
void getModuleList(const std::string &lang, coil::vstring &modules)
Getting loadable file list on the loadpath for given language.
coil::Properties Properties
Definition: RTC.h:72
std::string m_initFuncSuffix
Initial execution function suffix.
Definition: ModuleManager.h:744
Structure for exception handling when specified operation cannot be allowed.
Definition: ModuleManager.h:193
std::string m_initFuncPrefix
Initial execution function prefix.
Definition: ModuleManager.h:753
FileNotFound(const std::string &_name)
Definition: ModuleManager.h:151
std::vector< std::string > StringVector
Definition: ModuleManager.h:658
SymbolNotFound(const std::string &_name)
Definition: ModuleManager.h:181
std::string name
Definition: ModuleManager.h:137