Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Types | List of all members
RTC::ModuleManager Class Reference

ModuleManager class. More...

#include <ModuleManager.h>

Classes

struct  DLLEntity
 Structure for DLL management. More...
 
class  DllPred
 Module list that has already loaded. More...
 
struct  Error
 Structure for exception handling when file open is failed. More...
 
struct  FileNotFound
 Structure for exception handling when specified file cannot be found. More...
 
struct  InvalidArguments
 Structure for exception handling when specified argument is invalid. More...
 
struct  InvalidOperation
 Structure for exception handling when specified operation is invalid. More...
 
struct  ModuleNotFound
 Structure for exception handling when specified module cannot be found. More...
 
struct  NotAllowedOperation
 Structure for exception handling when specified operation cannot be allowed. More...
 
struct  NotFound
 Structure for exception handling of unimplemented part and specified module missing. More...
 
struct  SymbolNotFound
 Structure for exception handling when specified symbol cannot be found. More...
 
class  UnloadPred
 Module unloading functor. More...
 

Public Types

typedef void(* ModuleInitFunc) (Manager *)
 

Public Member Functions

void addLoadpath (const std::vector< std::string > &load_path)
 Add the module load path. More...
 
void allowAbsolutePath ()
 Allow absolute path when specify module path. More...
 
void allowModuleDownload ()
 Allow URL when specify module path. More...
 
void disallowAbsolutePath ()
 Disallow absolute path when specify module path. More...
 
void disallowModuleDownload ()
 Disallow URL when specify module path. More...
 
bool fileExist (const std::string &filename)
 Check whether the file exists. More...
 
std::string findFile (const std::string &fname, const std::vector< std::string > &load_path)
 Search the file from the LoadPath. More...
 
std::string getInitFuncName (const std::string &file_path)
 Create initialization function symbol. More...
 
std::vector< coil::PropertiesgetLoadableModules ()
 Get the loadable module list. More...
 
std::vector< coil::PropertiesgetLoadedModules ()
 Get the module list that has been loaded. More...
 
std::vector< std::string > getLoadPath ()
 Get the module load path. More...
 
std::string load (const std::string &file_name)
 Load the module. More...
 
std::string load (const std::string &file_name, const std::string &init_func)
 Load and intialize the module. More...
 
 ModuleManager (coil::Properties &prop)
 Constructor. More...
 
void setLoadpath (const std::vector< std::string > &load_path)
 Set the module load path. More...
 
void * symbol (const std::string &file_name, const std::string &func_name) throw (ModuleNotFound, SymbolNotFound)
 Refer to the symbol of the module. More...
 
void unload (const std::string &file_name)
 Unload the module. More...
 
void unloadAll ()
 Unload all modules. More...
 
 ~ModuleManager (void)
 Destructor. More...
 

Protected Types

typedef std::vector< DLLEntityDllMap
 
typedef DllMap::const_iterator DllMapConstItr
 
typedef DllMap::iterator DllMapItr
 
typedef std::vector< std::string > StringVector
 
typedef StringVector::const_iterator StringVectorConstItr
 
typedef StringVector::iterator StringVectorItr
 

Protected Member Functions

void addNewFile (const std::string &fpath, coil::vstring &modules)
 Adding file path not existing cache. More...
 
void getModuleList (const std::string &lang, coil::vstring &modules)
 Getting loadable file list on the loadpath for given language. More...
 
void getModuleProfiles (const std::string &lang, const coil::vstring &modules, vProperties &modprops)
 Getting module properties from given language and file list. More...
 
void removeInvalidModules ()
 Removing incalid module profiles. More...
 

Protected Attributes

bool m_absoluteAllowed
 Flag of absolute path when specify module for the load. More...
 
StringVector m_configPath
 Configuration path list. More...
 
bool m_downloadAllowed
 Flag of URL when specify module for the load. More...
 
std::string m_initFuncPrefix
 Initial execution function prefix. More...
 
std::string m_initFuncSuffix
 Initial execution function suffix. More...
 
StringVector m_loadPath
 Module load path list. More...
 
vProperties m_modprofs
 
ObjectManager< const char *, DLLEntity, DllPredm_modules
 Module list that has already loaded. More...
 
coil::Propertiesm_properties
 Module Manager properties. More...
 
Logger rtclog
 Logger stream. More...
 

Private Types

typedef std::vector< coil::PropertiesvProperties
 

Detailed Description

ModuleManager class.

This is a class to manage for loading and unloading modules.

Since
0.4.0

Definition at line 74 of file ModuleManager.h.

Member Typedef Documentation

◆ DllMap

typedef std::vector<DLLEntity> RTC::ModuleManager::DllMap
protected

Definition at line 666 of file ModuleManager.h.

◆ DllMapConstItr

typedef DllMap::const_iterator RTC::ModuleManager::DllMapConstItr
protected

Definition at line 668 of file ModuleManager.h.

◆ DllMapItr

typedef DllMap::iterator RTC::ModuleManager::DllMapItr
protected

Definition at line 667 of file ModuleManager.h.

◆ ModuleInitFunc

typedef void(* RTC::ModuleManager::ModuleInitFunc) (Manager *)

Definition at line 232 of file ModuleManager.h.

◆ StringVector

typedef std::vector<std::string> RTC::ModuleManager::StringVector
protected

Definition at line 662 of file ModuleManager.h.

◆ StringVectorConstItr

typedef StringVector::const_iterator RTC::ModuleManager::StringVectorConstItr
protected

Definition at line 664 of file ModuleManager.h.

◆ StringVectorItr

typedef StringVector::iterator RTC::ModuleManager::StringVectorItr
protected

Definition at line 663 of file ModuleManager.h.

◆ vProperties

typedef std::vector<coil::Properties> RTC::ModuleManager::vProperties
private

Definition at line 76 of file ModuleManager.h.

Constructor & Destructor Documentation

◆ ModuleManager()

RTC::ModuleManager::ModuleManager ( coil::Properties prop)

Constructor.

Constructor. Initialize based on information in the set Property object.

Parameters
propProperties for initialization

Definition at line 46 of file ModuleManager.cpp.

◆ ~ModuleManager()

RTC::ModuleManager::~ModuleManager ( void  )

Destructor.

Definition at line 66 of file ModuleManager.cpp.

Member Function Documentation

◆ addLoadpath()

void RTC::ModuleManager::addLoadpath ( const std::vector< std::string > &  load_path)

Add the module load path.

Add specified path list to search path list.

Returns
load_path List of additional module search path

Definition at line 279 of file ModuleManager.cpp.

◆ addNewFile()

void RTC::ModuleManager::addNewFile ( const std::string &  fpath,
coil::vstring modules 
)
protected

Adding file path not existing cache.

Definition at line 506 of file ModuleManager.cpp.

◆ allowAbsolutePath()

void RTC::ModuleManager::allowAbsolutePath ( )
inline

Allow absolute path when specify module path.

Set to allow the absolute path when specify the module for the load.

Definition at line 467 of file ModuleManager.h.

◆ allowModuleDownload()

void RTC::ModuleManager::allowModuleDownload ( )
inline

Allow URL when specify module path.

Allow URL when specify module for the load. When this setup is allowed, downloading and loading the module will be allowed.

Definition at line 507 of file ModuleManager.h.

◆ disallowAbsolutePath()

void RTC::ModuleManager::disallowAbsolutePath ( )
inline

Disallow absolute path when specify module path.

Set to disallow the absolute path when specify the module for the load.

Definition at line 485 of file ModuleManager.h.

◆ disallowModuleDownload()

void RTC::ModuleManager::disallowModuleDownload ( )
inline

Disallow URL when specify module path.

Disallow URL when specify module for the load.

Definition at line 525 of file ModuleManager.h.

◆ fileExist()

bool RTC::ModuleManager::fileExist ( const std::string &  filename)

Check whether the file exists.

Check whether the specified file exists.

Parameters
filenameName of file existence for checking
Returns
File existence result(File existence:true, Else:false)

Definition at line 390 of file ModuleManager.cpp.

◆ findFile()

std::string RTC::ModuleManager::findFile ( const std::string &  fname,
const std::vector< std::string > &  load_path 
)

Search the file from the LoadPath.

Check whether the specified file exists in the specified path.

Parameters
fnameTarget file name of the search
load_pathPath list for the search
Returns
File name that was found

Definition at line 359 of file ModuleManager.cpp.

◆ getInitFuncName()

std::string RTC::ModuleManager::getInitFuncName ( const std::string &  file_path)

Create initialization function symbol.

Assemble names of the initialization functions.

Parameters
file_pathName of module for initialization
Returns
Assembly result of initialization function name

Definition at line 417 of file ModuleManager.cpp.

◆ getLoadableModules()

std::vector< coil::Properties > RTC::ModuleManager::getLoadableModules ( )

Get the loadable module list.

Get the loadable module list(not implemented)

Get the loadable module list (not implemented).

Returns
Loadable module list

Definition at line 320 of file ModuleManager.cpp.

◆ getLoadedModules()

std::vector< coil::Properties > RTC::ModuleManager::getLoadedModules ( )

Get the module list that has been loaded.

Get the module list that has been loaded.

Returns
List of module that has been loaded

Definition at line 301 of file ModuleManager.cpp.

◆ getLoadPath()

std::vector<std::string> RTC::ModuleManager::getLoadPath ( )
inline

Get the module load path.

Get the search path of the set module.

Returns
load_path List of module search path

Definition at line 391 of file ModuleManager.h.

◆ getModuleList()

void RTC::ModuleManager::getModuleList ( const std::string &  lang,
coil::vstring modules 
)
protected

Getting loadable file list on the loadpath for given language.

Definition at line 454 of file ModuleManager.cpp.

◆ getModuleProfiles()

void RTC::ModuleManager::getModuleProfiles ( const std::string &  lang,
const coil::vstring modules,
vProperties modprops 
)
protected

Getting module properties from given language and file list.

Definition at line 534 of file ModuleManager.cpp.

◆ load() [1/2]

std::string RTC::ModuleManager::load ( const std::string &  file_name)

Load the module.

Load file_name as DLL or a shared liblary. The file_name is specified by the relative path to default load path (manager.modules.load_path).

If Property manager.modules.abs_path_allowed is yes, the load module can be specified by the absolute path.
If Property manager.modules.download_allowed is yes, the load module can be specified with URL.

The file_name can be specified by the absolute path. If manager.modules.abs_path_allowed is no, module of file_name will be searched from the default module load path and loaded.

Parameters
file_nameThe target module name for the loading
Returns
Name of module for the specified load

Definition at line 78 of file ModuleManager.cpp.

◆ load() [2/2]

std::string RTC::ModuleManager::load ( const std::string &  file_name,
const std::string &  init_func 
)

Load and intialize the module.

Load and initialize the module.

Load the specified file as DLL or a shared library, and execute operation for specified initialization.

Parameters
file_nameThe target module name for the loading
init_funcOperation for initialization
Returns
Name of module for the specified load

Definition at line 155 of file ModuleManager.cpp.

◆ removeInvalidModules()

void RTC::ModuleManager::removeInvalidModules ( )
protected

Removing incalid module profiles.

Definition at line 433 of file ModuleManager.cpp.

◆ setLoadpath()

void RTC::ModuleManager::setLoadpath ( const std::vector< std::string > &  load_path)

Set the module load path.

Specify searching path to find the target module when loading module.

Parameters
load_pathList of module search path

Definition at line 265 of file ModuleManager.cpp.

◆ symbol()

void * RTC::ModuleManager::symbol ( const std::string &  file_name,
const std::string &  func_name 
)
throw (ModuleNotFound,
SymbolNotFound
)

Refer to the symbol of the module.

Definition at line 230 of file ModuleManager.cpp.

◆ unload()

void RTC::ModuleManager::unload ( const std::string &  file_name)

Unload the module.

Close and unload the specified module that has been loaded.

Parameters
file_nameName of module for the unloading

Definition at line 186 of file ModuleManager.cpp.

◆ unloadAll()

void RTC::ModuleManager::unloadAll ( )

Unload all modules.

Unload all modules that have been loaded.

Definition at line 209 of file ModuleManager.cpp.

Member Data Documentation

◆ m_absoluteAllowed

bool RTC::ModuleManager::m_absoluteAllowed
protected

Flag of absolute path when specify module for the load.

Definition at line 738 of file ModuleManager.h.

◆ m_configPath

StringVector RTC::ModuleManager::m_configPath
protected

Configuration path list.

Definition at line 722 of file ModuleManager.h.

◆ m_downloadAllowed

bool RTC::ModuleManager::m_downloadAllowed
protected

Flag of URL when specify module for the load.

Definition at line 730 of file ModuleManager.h.

◆ m_initFuncPrefix

std::string RTC::ModuleManager::m_initFuncPrefix
protected

Initial execution function prefix.

Definition at line 756 of file ModuleManager.h.

◆ m_initFuncSuffix

std::string RTC::ModuleManager::m_initFuncSuffix
protected

Initial execution function suffix.

Definition at line 747 of file ModuleManager.h.

◆ m_loadPath

StringVector RTC::ModuleManager::m_loadPath
protected

Module load path list.

Definition at line 714 of file ModuleManager.h.

◆ m_modprofs

vProperties RTC::ModuleManager::m_modprofs
protected

Definition at line 776 of file ModuleManager.h.

◆ m_modules

ObjectManager<const char*, DLLEntity, DllPred> RTC::ModuleManager::m_modules
protected

Module list that has already loaded.

Definition at line 705 of file ModuleManager.h.

◆ m_properties

coil::Properties& RTC::ModuleManager::m_properties
protected

Module Manager properties.

Definition at line 678 of file ModuleManager.h.

◆ rtclog

Logger RTC::ModuleManager::rtclog
protected

Logger stream.

Definition at line 647 of file ModuleManager.h.


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


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Feb 28 2022 23:00:47