Class CAppControl#
Defined in File app_control.h
Inheritance Relationships#
Base Types#
public sdv::IInterfaceAccess(Struct IInterfaceAccess)public sdv::app::IAppEvent(Struct IAppEvent)
Class Documentation#
-
class CAppControl : public sdv::IInterfaceAccess, public sdv::app::IAppEvent#
Application control class.
Public Functions
-
CAppControl() = default#
Default constructor; doesn’t start the application control.
-
inline CAppControl(const std::string &rssConfig)#
Constructor; starts the application control with the supplied configuration.
- Parameters:
rssConfig – [in] Reference to the configuration string.
-
inline ~CAppControl()#
Shuts down during destruction if not explicitly done before.
-
inline bool Startup(const std::string &rssConfig)#
Starts the application control with the supplied configuration.
- Parameters:
rssConfig – [in] Reference to the configuration string.
- Returns:
Returns ‘true’ on success; otherwise returns ‘false’.
-
inline bool RunLoop()#
Running loop until shutdown request is triggered.
- Returns:
Returns whether running the loop was successful.
-
inline void Shutdown()#
Shutdown the application control.
- Attention
The created objects are destroyed and the module unloaded in reverse order of their creation.
-
inline bool IsRunning() const#
Is the system running?
- Returns:
Returns whether the system is running.
-
inline EAppContext GetAppContext() const#
Get the application context.
- Returns:
The application context.
-
inline uint32_t GetInstanceID() const#
Get the core instance ID.
- Returns:
The core instance ID.
-
inline void SetRunningMode()#
Set the operation to running mode.
- Pre:
The system is operating in configuration mode.
-
inline bool IsConfiguring() const#
Is the system in configuration state?
- Returns:
Returns whether the system is being configured.
-
inline void SetConfigMode()#
Set the operation to config mode.
- Pre:
The system is operating in running mode.
-
inline core::EConfigProcessResult ProcessConfig(const sdv::u8string &ssContent)#
Process the provided configuration by loading modules and creating objects/stubs/proxies defined in the configuration string.
- Attention
Configuration changes can only occur when the system is in configuration mode.
- Parameters:
ssContent – [in] The contents of the configuration file (TOML).
- Returns:
Returns ‘true’ on success; ‘false’ otherwise.
-
inline core::EConfigProcessResult LoadConfig(const sdv::u8string &ssFilename)#
Read file pointed to by the provided file path and load modules and create objects/stubs/proxies as defined in the configuration file.
- Attention
Configuration changes can only occur when the system is in configuration mode.
- Parameters:
ssFilename – [in] Path to the file containing the configuration (TOML). The path can be absolute as well as relative. In case a relative path is provided, the current directory is searched as well as all directories supplied through the AddConfigSearchDir function.
- Returns:
Returns a config process result enum value.
-
inline bool SaveConfig(sdv::u8string ssConfigPath) const#
Save a configuration file pointed to by the provided file path. All components are saved that were added after the last baseline with the configuration specific settings.
Remark
The function will only save when the configuration has changed.
- Parameters:
ssConfigPath – [in] Path to the file containing the configuration (TOML). The path can be an absolute as well as a relative path. In case a relative path is provided, the configuration is stored relative to the executable directory.
- Returns:
Returns ‘true’ on success (or no changes detected); ‘false’ otherwise.
-
inline sdv::u8string GenerateConfigString() const#
Generate the configuration TOML string.
- Returns:
The generated configuration string.
-
inline void CloseConfig()#
Close the current configuration.
This will close und unload the components and modules from the current configuration as well as dependent components that builds on top of the components being closed. Components that the current configuration depends on are not closed.
-
inline bool AddConfigSearchDir(const std::filesystem::path &rpathDir)#
Add a search path to a folder where a config file can be found.
- Parameters:
rpathDir – [in] Reference to the relative or absolute path to an existing folder.
- Returns:
Returns ‘true’ on success; ‘false’ otherwise.
-
inline bool AddConfigSearchDir(const sdv::u8string &ssDir)#
Add a search path to a folder where a config file can be found.
- Parameters:
ssDir – [in] Relative or absolute path to an existing folder.
- Returns:
Returns ‘true’ on success; ‘false’ otherwise.
-
inline bool AddConfigSearchDir(const std::string &ssDir)#
Add a search path to a folder where a config file can be found.
- Parameters:
ssDir – [in] Relative or absolute path to an existing folder.
- Returns:
Returns ‘true’ on success; ‘false’ otherwise.
-
inline bool AddConfigSearchDir(const char *szDir)#
Add a search path to a folder where a config file can be found.
- Parameters:
szDir – [in] Zero terminated string to the relative or absolute path to an existing folder.
- Returns:
Returns ‘true’ on success; ‘false’ otherwise.
-
inline bool AddModuleSearchDir(const std::filesystem::path &rpathDir)#
Add a search path to a folder where a module can be found.
- Parameters:
rpathDir – [in] Reference to the relative or absolute path to an existing folder.
- Returns:
Returns ‘true’ on success; ‘false’ otherwise.
-
inline bool AddModuleSearchDir(const sdv::u8string &rssDir)#
Add a search path to a folder where a module can be found.
- Parameters:
rssDir – [in] Reference to the relative or absolute path to an existing folder.
- Returns:
Returns ‘true’ on success; ‘false’ otherwise.
-
inline bool AddModuleSearchDir(const std::string &rssDir)#
Add a search path to a folder where a module can be found.
- Parameters:
rssDir – [in] Reference to the relative or absolute path to an existing folder.
- Returns:
Returns ‘true’ on success; ‘false’ otherwise.
-
inline bool AddModuleSearchDir(const char *szDir)#
Add a search path to a folder where a module can be found.
- Parameters:
szDir – [in] Zero terminated string to the relative or absolute path to an existing folder.
- Returns:
Returns ‘true’ on success; ‘false’ otherwise.
Public Static Functions
-
static inline std::filesystem::path GetFrameworkRuntimeDirectory()#
Get the SDV_FRAMEWORK_RUNTIME environment variable for this application.
- Returns:
Path directing to the SDV V-API Framework directory if available or an empty path if not.
-
static inline void SetFrameworkRuntimeDirectory(const std::filesystem::path &rpathDir)#
Set or overwrite the SDV_FRAMEWORK_RUNTIME environment variable for this application.
- Parameters:
rpathDir – [in] Reference of the path directing to the SDV V-API Framework directory.
-
static inline std::filesystem::path GetComponentInstallDirectory()#
Get the SDV_COMPONENT_INSTALL environment variable for this application.
- Returns:
Path directing to the SDV V-API component installation directory if available or an empty path if not.
-
static inline void SetComponentInstallDirectory(const std::filesystem::path &rpathDir)#
Set or overwrite the SDV_COMPONENT_INSTALL environment variable for this application.
- Parameters:
rpathDir – [in] Reference of the path directing to the SDV V-API component installation directory.
-
CAppControl() = default#