ifw-sup  1.0.0
Public Member Functions | List of all members
sup::syssup::common::Config Class Reference

#include <config.hpp>

Inheritance diagram for sup::syssup::common::Config:
sup::syssup::common::IConfig

Public Member Functions

 Config ()
 
virtual ~Config ()
 
bool ParseOptions (int argc, char *argv[])
 
void LoadConfig (const std::string &filename="")
 
const std::string GetServerId () const
 
const std::string GetMsgReplierEndpoint () const
 
const std::string GetMsgPubEndpoint () const override
 
const std::string GetDbEndpoint () const
 
const timeval GetDbTimeout () const
 
const std::string GetSmScxmlFilename () const
 
const std::string GetConfigFilename () const
 
const std::string GetProcName () const
 
const std::string GetLogLevel () const
 
const int GetNumSubsystems ()
 
const int GetNumOpModes ()
 The number of defined operational modes. More...
 
const std::string GetSubsysName (const int &subsys_index)
 Returns a given subsystem name. More...
 
const std::string GetSubsysRrEndpoint (const std::string &name)
 Returs subsystem req/reply endpoint. More...
 
const std::string GetSubsysPsEndpoint (const std::string &name)
 Returs subsystem pub/sub endpoint. More...
 
const std::string GetSubsysType (const std::string &name)
 Returs subsystem type. More...
 
std::optional< ScopeEnumGetSubsysScope (const std::string &name)
 GetSubsysScope. More...
 
std::string GetSubsysScopeStr (const std::string &name)
 GetSubsysScopeStr. More...
 
bool GetSubsysAccess (const std::string &name)
 GetSubsysAccess. More...
 
void SetSubsysAccess (const std::string &name, const bool &access)
 
virtual void GetConfigList (std::vector< std::string > &cfg_list)
 Get configuration list. More...
 
const unsigned int GetCmdTout ()
 Get the command timeout. More...
 
const unsigned int GetWaitTout ()
 Get the wait timeout. More...
 
void SetCmdTout (const unsigned int cmd_tout)
 Set command timeout. More...
 
void SetWaitTout (const unsigned int wait_tout)
 Set wait timeout. More...
 
const std::string GetConfigAsString () const
 Get the actual configuration as a string. More...
 

Detailed Description

This class provide access to the command line options and the configuration parameters stored in the configuration file.

Constructor & Destructor Documentation

◆ Config()

sup::syssup::common::Config::Config ( )

Default constructor.

Initialize application configuration attributes by

  • first use the default constant values defined in the header
  • override the constant values with environment variables (if defined)

◆ ~Config()

sup::syssup::common::Config::~Config ( )
virtual

Default destructor.

Member Function Documentation

◆ GetCmdTout()

const unsigned int sup::syssup::common::Config::GetCmdTout ( )
virtual

Get the command timeout.

Returns

Implements sup::syssup::common::IConfig.

◆ GetConfigAsString()

const std::string sup::syssup::common::Config::GetConfigAsString ( ) const
virtual

Get the actual configuration as a string.

Implements sup::syssup::common::IConfig.

◆ GetConfigFilename()

const std::string sup::syssup::common::Config::GetConfigFilename ( ) const
virtual
Returns
The application configuration filename.

Implements sup::syssup::common::IConfig.

◆ GetConfigList()

void sup::syssup::common::Config::GetConfigList ( std::vector< std::string > &  cfg_list)
virtual

Get configuration list.

Parameters
cfg_listList of all configuration parameters.

This method returs the complete of configuration parameters handled by this class. This method is used to dump the list into the DB.

Implements sup::syssup::common::IConfig.

◆ GetDbEndpoint()

const std::string sup::syssup::common::Config::GetDbEndpoint ( ) const
virtual
Returns
The IP address and port used to connect to the runtime DB.

Implements sup::syssup::common::IConfig.

◆ GetDbTimeout()

const timeval sup::syssup::common::Config::GetDbTimeout ( ) const
virtual
Returns
The timeout used when communicating to the runtime DB.

Implements sup::syssup::common::IConfig.

◆ GetLogLevel()

const std::string sup::syssup::common::Config::GetLogLevel ( ) const
virtual
Returns
The configured log level.

Implements sup::syssup::common::IConfig.

◆ GetMsgPubEndpoint()

const std::string sup::syssup::common::Config::GetMsgPubEndpoint ( ) const
overridevirtual
Returns
The network endpoint to publish internally within the application. The format is the CII URI For example: "zpb.rr://127.0.0.1:12081/AppCmds"

Implements sup::syssup::common::IConfig.

◆ GetMsgReplierEndpoint()

const std::string sup::syssup::common::Config::GetMsgReplierEndpoint ( ) const
virtual
Returns
The network endpoint to send request to this application. The format is "\<protocol\>://\<ipaddr\>:\<port\>" where <protocol> is 'tcp' For example: "tcp://127.0.0.1:5577"

Implements sup::syssup::common::IConfig.

◆ GetNumOpModes()

const int sup::syssup::common::Config::GetNumOpModes ( )

The number of defined operational modes.

Returns

◆ GetNumSubsystems()

const int sup::syssup::common::Config::GetNumSubsystems ( )
virtual
Returns
The number of configured subsystems

Implements sup::syssup::common::IConfig.

◆ GetProcName()

const std::string sup::syssup::common::Config::GetProcName ( ) const
virtual
Returns
The application process name.

Implements sup::syssup::common::IConfig.

◆ GetServerId()

const std::string sup::syssup::common::Config::GetServerId ( ) const
virtual
Returns
return the server identifier

Implements sup::syssup::common::IConfig.

◆ GetSmScxmlFilename()

const std::string sup::syssup::common::Config::GetSmScxmlFilename ( ) const
virtual
Returns
The SCXML State Machine model filename used by the application.

Implements sup::syssup::common::IConfig.

◆ GetSubsysAccess()

bool sup::syssup::common::Config::GetSubsysAccess ( const std::string &  name)
virtual

GetSubsysAccess.

Parameters
nameName of the subsystem
Returns

Implements sup::syssup::common::IConfig.

◆ GetSubsysName()

const std::string sup::syssup::common::Config::GetSubsysName ( const int &  subsys_index)
virtual

Returns a given subsystem name.

Parameters
subsys_indexIndex of the subsystem in the array.
Returns

Implements sup::syssup::common::IConfig.

◆ GetSubsysPsEndpoint()

const std::string sup::syssup::common::Config::GetSubsysPsEndpoint ( const std::string &  name)

Returs subsystem pub/sub endpoint.

Parameters
nameName of the subsystem
Returns

◆ GetSubsysRrEndpoint()

const std::string sup::syssup::common::Config::GetSubsysRrEndpoint ( const std::string &  name)

Returs subsystem req/reply endpoint.

Parameters
nameName of the subsystem
Returns

◆ GetSubsysScope()

std::optional< ScopeEnum > sup::syssup::common::Config::GetSubsysScope ( const std::string &  name)
virtual

GetSubsysScope.

Parameters
nameName of the subsystem
Returns

Implements sup::syssup::common::IConfig.

◆ GetSubsysScopeStr()

std::string sup::syssup::common::Config::GetSubsysScopeStr ( const std::string &  name)

GetSubsysScopeStr.

Parameters
name
Returns

◆ GetSubsysType()

const std::string sup::syssup::common::Config::GetSubsysType ( const std::string &  name)
virtual

Returs subsystem type.

Parameters
nameName of the subsystem
Returns

Implements sup::syssup::common::IConfig.

◆ GetWaitTout()

const unsigned int sup::syssup::common::Config::GetWaitTout ( )
virtual

Get the wait timeout.

Returns

Implements sup::syssup::common::IConfig.

◆ LoadConfig()

void sup::syssup::common::Config::LoadConfig ( const std::string &  filename = "")
virtual

This method load from a configuration file the application configuration overriding the initialization done in the constructor and the command line options.

Parameters
[in]filenameApplication configuration filename.

Implements sup::syssup::common::IConfig.

◆ ParseOptions()

bool sup::syssup::common::Config::ParseOptions ( int  argc,
char *  argv[] 
)
virtual

This method parses the command line parameters overriding the initialization done in the constructor.

Parameters
[in]argcNumber of command line options.
[in]argvPointer to the array of command line options.
Returns
false if the help option has been invoked, true otherwise.

Implements sup::syssup::common::IConfig.

◆ SetCmdTout()

void sup::syssup::common::Config::SetCmdTout ( const unsigned int  cmd_tout)

Set command timeout.

Parameters
cmd_toutnew command timeout

◆ SetSubsysAccess()

void sup::syssup::common::Config::SetSubsysAccess ( const std::string &  name,
const bool &  access 
)

◆ SetWaitTout()

void sup::syssup::common::Config::SetWaitTout ( const unsigned int  wait_tout)

Set wait timeout.

Parameters
wait_toutnew wait timeout

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