UTILLib 2.0
Common C++ library with utilities.
Loading...
Searching...
No Matches
util::supervise::ISuperviseMaster Class Reference

Interface against a supervise master. More...

#include <isupervisemaster.h>

Public Member Functions

 ISuperviseMaster ()=default
 Default constructor.
virtual ~ISuperviseMaster ()
 Default destructor.
void ProgramName (std::string name)
 Defines the program/system name.
const std::string & ProgramName () const
 Program or system name.
void ConfigFile (std::string config_file)
 Configuration file name.
const std::string & ConfigFile () const
 Returns the configuration file name.
void EnableMqtt (bool enable)
 Enable a MQTT client.
bool EnableMqtt () const
 Returns true if a MQTT client is enabled.
virtual void Start ()
 Start the system.
virtual void Stop ()
 Stop the system.
virtual ISuperviseApplicationCreateApplication ()
 Create a supervise application.
std::vector< std::unique_ptr< ISuperviseApplication > > & Applications ()
 Returns a list af supervise applications.
const std::vector< std::unique_ptr< ISuperviseApplication > > & Applications () const
 Returns a list af supervise applications.
void ReadConfig ()
 Read in the configuration.
void SaveConfig ()
 Save the configuration.

Protected Attributes

std::vector< std::unique_ptr< ISuperviseApplication > > applications_
 List of supervise applications.

Detailed Description

A supervise master supervise one or more applications. The purpose is simplify the creation of a system. Instead of manually start several application services, the master will start the system application as normal executables.

The master is normally started as a service/Daemon but can also be used in unit tests for testing applications and systems.

Member Function Documentation

◆ Applications() [1/2]

std::vector< std::unique_ptr< ISuperviseApplication > > & util::supervise::ISuperviseMaster::Applications ( )
inline
Returns
List of supervise applications.

◆ Applications() [2/2]

const std::vector< std::unique_ptr< ISuperviseApplication > > & util::supervise::ISuperviseMaster::Applications ( ) const
inline
Returns
List of supervise applications.

◆ ConfigFile() [1/2]

const std::string & util::supervise::ISuperviseMaster::ConfigFile ( ) const
inlinenodiscard
Returns
Configuration file name.

◆ ConfigFile() [2/2]

void util::supervise::ISuperviseMaster::ConfigFile ( std::string config_file)

Sets the configuration file name. If the configuration file is defined without any paths, the class will search for the file in known directories. Note that the program name is used when searching in directories.

Parameters
config_fileConfiguration file name.

◆ CreateApplication()

virtual ISuperviseApplication * util::supervise::ISuperviseMaster::CreateApplication ( )
virtual
Returns
Smart pointer to a supervise application.

◆ EnableMqtt() [1/2]

bool util::supervise::ISuperviseMaster::EnableMqtt ( ) const
inlinenodiscard
Returns
True if the MQTT is used.

◆ EnableMqtt() [2/2]

void util::supervise::ISuperviseMaster::EnableMqtt ( bool enable)
inline
Parameters
enableTrue if the MQTT

◆ ProgramName() [1/2]

const std::string & util::supervise::ISuperviseMaster::ProgramName ( ) const
inlinenodiscard
Returns
Program name.

◆ ProgramName() [2/2]

void util::supervise::ISuperviseMaster::ProgramName ( std::string name)
inline

The program name should be without any space. It is used together with the default directories to find configuration files.

Parameters
nameProgram name or system name.

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