Class CModuleControl#

Inheritance Relationships#

Base Types#

Class Documentation#

class CModuleControl : public sdv::IInterfaceAccess, public sdv::core::IModuleControl, public sdv::core::IModuleControlConfig, public sdv::core::IModuleInfo#

Module control class.

Remark

This class is also used to load the object from the core library without reloading the library itself again. It uses the module file name “core_services.sdv” and the ID -1 to identify the library.

Public Functions

CModuleControl()#

Default constructor.

CModuleControl(const CModuleControl &rctrl) = delete#

No copy constructor.

Parameters:

rctrl[in] Reference to the module control class.

CModuleControl(CModuleControl &&rctrl) = delete#

No move constructor.

Parameters:

rctrl[in] Reference to the module control class.

virtual ~CModuleControl()#

Destructor unloads all modules.

CModuleControl &operator=(const CModuleControl&) = delete#

No assignment operator.

Returns:

Returns a reference to this class.

CModuleControl &operator=(CModuleControl&&) = delete#

No move operator.

Returns:

Returns a reference to this class.

virtual bool AddModuleSearchDir(const sdv::u8string &ssDir) override#

Sets a search path to a folder where a module can be found. Overload of sdv::core::IModuleControlConfig::AddModuleSearchDir.

Parameters:

ssDir[in] Relative or absolute path to an existing folder. To load a module out of the folder only the filename is required.

Returns:

returns true if folder exists, otherwise false

virtual sdv::sequence<sdv::u8string> GetModuleSearchDirs() const override#

Get a sequence containing the current module search directories.

Returns:

The sequence with the module search directories.

virtual sdv::sequence<sdv::core::SModuleInfo> GetModuleList() const override#

Get a list of loaded modules. Overload of sdv::core::IModuleInfo::GetModuleList.

Returns:

The module list.

virtual sdv::sequence<sdv::SClassInfo> GetClassList(sdv::core::TModuleID tModuleID) const override#

Get a list of classes exposed by the provided module.

Parameters:

tModuleID[in] The module ID to request the list of classes for.

Returns:

Sequence with the class information structures.

virtual sdv::core::TModuleID Load(const sdv::u8string &ssModulePath) override#

Load the module. Overload of sdv::core::IModuleControl::Load.

Parameters:

ssModulePath[in] File name of the module to load.

Returns:

Returns the ID of the module or 0 if the module could not be loaded

virtual bool Unload(sdv::core::TModuleID tModuleID) override#

Unload the module. Overload of sdv::core::IModuleControl::Unload.

Parameters:

tModuleID[in] Id representing a module, which has previous been loaded by Load

Returns:

Returns true if module is unloaded successfully otherwise false.

virtual bool HasActiveObjects(sdv::core::TModuleID tModuleID) const override#

Checking for active objects. Overload of sdv::core::IModuleControl::HasActiveObjects.

Parameters:

tModuleID[in] Id representing a module, which has previous been loaded by Load

Returns:

Returns true if there is an active object otherwise false.

std::shared_ptr<CModuleInst> FindModuleByClass(const std::string &rssClass)#

Find a module containing a class with the specified name.

Find the first module containing a class with the specified name. For main and isolated applications, if the module wasn’t loaded, the installation manifests are checked and if a module with the class has been found, the module will be loaded. The order of checking the installation manifest is core-manifest, manifest in executable directory and manifest in supplied installation directory.

Remark

Modules of system objects specified in the user installation are not returned.

Parameters:

rssClass[in] Reference to the class that should be searched for. The class is compared to the class name and the default name in the manifest.

Returns:

Returns a smart pointer to the module instance or NULL when the module hasn’t been found.

std::shared_ptr<CModuleInst> GetModule(sdv::core::TModuleID tModuleID) const#

Get a class instance for the module.

Parameters:

tModuleID[in] Id representing a module, which has previous been loaded by Load

Returns:

Returns a smart pointer to the module instance or NULL when the module hasn’t been found.

void UnloadAll(const std::vector<sdv::core::TModuleID> &rvecIgnoreModules)#

Unload all modules (with force-flag).

Parameters:

rvecIgnoreModules[in] Reference to a vector containing all the modules to not unload.

void ResetConfigBaseline()#

Reset the current config baseline.

std::string SaveConfig(const std::set<std::filesystem::path> &rsetIgnoreModule)#

Save the configuration of all modules.

Parameters:

rsetIgnoreModule[in] Set of modules not needing to add.

Returns:

The string containing all the modules.

sdv::core::TModuleID ContextLoad(const std::filesystem::path &rpathModule, const std::string &rssManifest)#

Load the module with the supplied module manifest. Only for main and isolated applications.

Remark

When running the main application all complex services, applications and utilities run in their isolated environment. If multiple components are implemented in the module, of which one is suppose to run isolated, all of them run isolated. Isolated applications cannot load other modules if one was loaded already. Maintenance applications cannot load modules. All other applications load modules in their own process. Exception to the rul are proxy and stub components. System objects cannot be loaded this way at all.

Parameters:
  • rpathModule[in] Absolute file path of the module to load.

  • rssManifest[in] The module manifest deciding on where the module should run.

Returns:

Returns the ID of the module or 0 if the module could not be loaded

bool ContextUnload(sdv::core::TModuleID tModuleID, bool bForce)#

Unload the module.

Parameters:
  • tModuleID[in] Id representing a module, which has previous been loaded by ContextLoad.

  • 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 if module is unloaded successfully otherwise false.