20 #ifndef RTC_MODULEMANAGER_H 21 #define RTC_MODULEMANAGER_H 29 #include <coil/DynamicLib.h> 33 #include <coil/Properties.h> 37 #define CONFIG_EXT "manager.modules.config_ext" 38 #define CONFIG_PATH "manager.modules.config_path" 39 #define DETECT_MOD "manager.modules.detect_loadable" 40 #define MOD_LOADPTH "manager.modules.load_path" 41 #define INITFUNC_SFX "manager.modules.init_func_suffix" 42 #define INITFUNC_PFX "manager.modules.init_func_prefix" 43 #define ALLOW_ABSPATH "manager.modules.abs_path_allowed" 44 #define ALLOW_URL "manager.modules.download_allowed" 45 #define MOD_DWNDIR "manager.modules.download_dir" 46 #define MOD_DELMOD "manager.modules.download_cleanup" 47 #define MOD_PRELOAD "manager.modules.preload" 50 #pragma warning( disable : 4290 ) 279 std::string
load(
const std::string& file_name);
308 std::string
load(
const std::string& file_name,
309 const std::string& init_func);
328 void unload(
const std::string& file_name);
352 void*
symbol(
const std::string& file_name,
const std::string& func_name)
372 void setLoadpath(
const std::vector<std::string>& load_path);
413 void addLoadpath(
const std::vector<std::string>& load_path);
553 std::string
findFile(
const std::string& fname,
554 const std::vector<std::string>& load_path);
577 bool fileExist(
const std::string& filename);
691 DllPred(
const char* filepath) : m_filepath(filepath) {}
782 #pragma warning( default : 4290 ) 785 #endif // RTC_MODULEMANAGER_H void * symbol(const std::string &file_name, const std::string &func_name)
Refer to the symbol of the module.
void(* ModuleInitFunc)(Manager *)
Structure for exception handling of unimplemented part and specified module missing.
std::vector< coil::Properties > vProperties
std::string getInitFuncName(const std::string &file_path)
Create initialization function symbol.
NotAllowedOperation(const std::string &_reason)
bool m_absoluteAllowed
Flag of absolute path when specify module for the load.
void operator()(DLLEntity *dll)
NotFound(const std::string &_name)
Structure for exception handling when file open is failed.
void addLoadpath(const std::vector< std::string > &load_path)
Add the module load path.
coil::Properties & m_properties
Module Manager properties.
Module list that has already loaded.
Error(const std::string &_reason)
~ModuleManager(void)
Destructor.
std::vector< coil::Properties > getLoadableModules()
Get the loadable module list.
InvalidArguments(const std::string &_reason)
ObjectManager< const char *, DLLEntity, DllPred > m_modules
Module list that has already loaded.
void setLoadpath(const std::vector< std::string > &load_path)
Set the module load path.
void disallowAbsolutePath()
Disallow absolute path when specify module path.
coil::Properties properties
ModuleNotFound(const std::string &_name)
Structure for exception handling when specified symbol cannot be found.
std::string load(const std::string &file_name)
Load the module.
void allowAbsolutePath()
Allow absolute path when specify module path.
DllMap::const_iterator DllMapConstItr
Module unloading functor.
std::vector< coil::Properties > getLoadedModules()
Get the module list that has been loaded.
void disallowModuleDownload()
Disallow URL when specify module path.
RTComponent manager class.
InvalidOperation(const std::string &_reason)
bool m_downloadAllowed
Flag of URL when specify module for the load.
Structure for exception handling when specified operation is invalid.
std::vector< std::string > vstring
StringVector m_loadPath
Module load path list.
Logger rtclog
Logger stream.
StringVector m_configPath
Configuration path list.
Structure for exception handling when specified argument is invalid.
bool fileExist(const std::string &filename)
Check whether the file exists.
void addNewFile(const std::string &fpath, coil::vstring &modules)
Adding file path not existing cache.
Class for managing objects.
StringVector::iterator StringVectorItr
Structure for exception handling when specified module cannot be found.
void removeInvalidModules()
Removing incalid module profiles.
std::vector< std::string > StringVector
DllPred(const char *filepath)
prop
Organization::get_organization_property ();.
std::vector< std::string > getLoadPath()
Get the module load path.
bool operator()(DLLEntity *dllentity)
Class represents a set of properties.
void unloadAll()
Unload all modules.
Structure for exception handling when specified file cannot be found.
StringVector::const_iterator StringVectorConstItr
Structure for DLL management.
void unload(const std::string &file_name)
Unload the module.
virtual int close(void)
Unload of the Dynamic link library.
void allowModuleDownload()
Allow URL when specify module path.
ModuleManager(coil::Properties &prop)
Constructor.
DllPred(const DLLEntity *dll)
void getModuleProfiles(const std::string &lang, const coil::vstring &modules, vProperties &modprops)
Getting module properties from given language and file list.
std::vector< DLLEntity > DllMap
std::string findFile(const std::string &fname, const std::vector< std::string > &load_path)
Search the file from the LoadPath.
DllMap::iterator DllMapItr
void getModuleList(const std::string &lang, coil::vstring &modules)
Getting loadable file list on the loadpath for given language.
std::string m_initFuncSuffix
Initial execution function suffix.
Structure for exception handling when specified operation cannot be allowed.
std::string m_initFuncPrefix
Initial execution function prefix.
FileNotFound(const std::string &_name)
const std::string & getProperty(const std::string &key) const
Search for the property with the specified key in this property.
SymbolNotFound(const std::string &_name)