Class CModuleInst#
Defined in File module.h
Class Documentation#
-
class CModuleInst#
Module instance class.
Public Functions
-
CModuleInst(const std::filesystem::path &rpathModuleConfigPath, const std::filesystem::path &rpathModule) noexcept#
Constructor.
- Parameters:
rpathModuleConfigPath – [in] Reference to the path of the module as it was specified in the configuration.
rpathModule – [in] Reference to the absolute path of the module to load. If empty, the module is not instanceable, but is used as a placeholder for rewriting the configuration.
-
CModuleInst(const CModuleInst&) = delete#
Copy constructor is not allowed.
-
CModuleInst(CModuleInst&&) = delete#
Move constructor is not allowed.
-
~CModuleInst()#
Destructor.
-
CModuleInst &operator=(const CModuleInst&) = delete#
Assignment operator is not allowed.
- Returns:
Returns a reference to this class.
-
CModuleInst &operator=(CModuleInst&&) = delete#
Move operator is not allowed.
- Returns:
Returns a reference to this class.
-
bool IsValid() const noexcept#
Return whether the module instance was loaded correctly.
- Returns:
Returns ‘true’ when the module was lloaded successfully. Otherwise returns ‘false’.
-
std::string GetDefaultObjectName(const std::string &ssClassName) const#
Get the default object name.
- Parameters:
ssClassName – [in] Name of the class
- Returns:
Returns the default object name or an empty string if the class doesn’t exist.
-
bool IsSingleton(const std::string &ssClassName) const#
Is the object class marked as singleton (only one instance is allowed)?
- Parameters:
ssClassName – [in] Name of the class
- Returns:
Returns whether the object class is a singleton.
-
std::vector<std::string> GetAvailableClasses() const#
Gets the set of all available classes in the module.
- Returns:
Returns the vector of all available classes in the module
-
sdv::IInterfaceAccess *CreateObject(const std::string &ssClassName)#
Creates an object instance of a given SDV class via the loaded module.
- Parameters:
ssClassName – [in] the class from which an object is to be created
- Returns:
Returns a pointer to the created object or nullptr in case of failure
-
void DestroyObject(sdv::IInterfaceAccess *object)#
Destroys an object previously created via CreateObject.
- Parameters:
object – [in] The object to be destroyed. The object is only destroyed if it has been allocated via the loaded module and has not yet been destroyed.
-
std::filesystem::path GetModuleConfigPath() const#
Return the module config path (as it was specified in the configuration).
- Returns:
The config path of the module.
-
std::filesystem::path GetModulePath() const#
Return the module path.
- Returns:
The path of the module.
-
sdv::core::SModuleInfo GetModuleInfo() const#
Get the module information.
- Returns:
Returns the module information structure.
-
std::optional<sdv::SClassInfo> GetClassInfo(const std::string &rssClassName) const#
Return the class information of the supplied class name.
- Parameters:
rssClassName – [in] Reference to string containing the class name.
- Returns:
Returns the information structure of the requested class or an empty structure when the class could not be found.
-
bool Load(const std::filesystem::path &rpathModule) noexcept#
Load the module.
- Parameters:
rpathModule – [in] Reference to the path of the module to load.
- Returns:
Returns ‘true’ when successful; ‘false’ when not.
-
bool Unload(bool bForce) noexcept#
Unload the module and clear the module instance class.
- Attention
If there are any active objects still running, this module is not unloaded. In cooperation with the bForce flag this causes the module to stay in memory indefinitely.
- Parameters:
bForce – [in] When set, the module instance class is cleared whether or not the module is unloaded or not. Use with extreme care (e.g. during shutdown).
- Returns:
Returns ‘true’ when successfully cleared the module instance class, ‘false’ when there are still active objects blocking the unloading.
-
bool HasActiveObjects() const#
Return whether active objects created through this module are still running.
- Returns:
Returns ‘true’ when active objects are running; ‘false’ when not.
-
CModuleInst(const std::filesystem::path &rpathModuleConfigPath, const std::filesystem::path &rpathModule) noexcept#