ifw-daq  2.1.0-pre1
IFW Data Acquisition modules
Public Member Functions | Public Attributes | List of all members
server::Config Class Reference

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

#include <config.hpp>

Public Member Functions

 Config ()
 Default constructor. More...
 
virtual ~Config ()
 Default destructor. More...
 
bool ParseOptions (int argc, char *argv[])
 This method parses the command line parameters overriding the initialization done in the constructor. More...
 
void LoadConfig (const std::string &filename="")
 This method load from a configuration file the application configuration overriding the initialization done in the constructor and the command line options. More...
 
const std::string & GetMsgReplierEndpoint () const
 
const std::string & GetPubEndpoint () const
 
const std::string & GetDbEndpoint () const
 
const std::string & GetDbPrefix () 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 std::string & GetLogProperties () const
 
std::filesystem::path GetWorkspace () const
 
daq::DpmClientParams const & GetDpmClientParams () const
 
 Config (const Config &)=delete
 
Configoperator= (const Config &)=delete
 Disable copy constructor. More...
 

Public Attributes

YAML::Node m_config_node
 Disable assignment operator. More...
 
std::string m_proc_name
 
std::string m_instrument_id
 
std::string m_log_level
 
std::string m_log_properties
 
std::string m_config_filename
 
std::string m_scxml_filename
 
std::string m_db_host_endpoint
 
std::string m_db_prefix
 
int m_db_timeout_sec
 
std::string m_req_endpoint
 
std::string m_pub_endpoint
 
std::string m_out_path
 
std::filesystem::path m_workspace
 
daq::DpmClientParams m_dpm_params
 
std::optional< std::chrono::hours > m_stale_acquiring
 
std::optional< std::chrono::hours > m_stale_merging
 

Detailed Description

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

Definition at line 46 of file config.hpp.

Constructor & Destructor Documentation

◆ Config() [1/2]

server::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)

Definition at line 27 of file config.cpp.

◆ ~Config()

server::Config::~Config ( )
virtual

Default destructor.

Definition at line 67 of file config.cpp.

◆ Config() [2/2]

server::Config::Config ( const Config )
delete

Member Function Documentation

◆ GetConfigFilename()

const std::string & server::Config::GetConfigFilename ( ) const
Returns
The application configuration filename.

Definition at line 350 of file config.cpp.

◆ GetDbEndpoint()

const std::string & server::Config::GetDbEndpoint ( ) const
Returns
The IP address and port used to connect to the runtime DB.

Definition at line 325 of file config.cpp.

◆ GetDbPrefix()

const std::string & server::Config::GetDbPrefix ( ) const
Returns
The DB key prefix and port used to connect to the runtime DB.

Definition at line 330 of file config.cpp.

◆ GetDbTimeout()

const timeval server::Config::GetDbTimeout ( ) const
Returns
The timeout used when communicating to the runtime DB.

Definition at line 339 of file config.cpp.

◆ GetDpmClientParams()

daq::DpmClientParams const & server::Config::GetDpmClientParams ( ) const

Definition at line 370 of file config.cpp.

◆ GetLogLevel()

const std::string & server::Config::GetLogLevel ( ) const
Returns
The configured log level.

Definition at line 360 of file config.cpp.

◆ GetLogProperties()

const std::string & server::Config::GetLogProperties ( ) const
Returns
The log properties config filename.

Definition at line 365 of file config.cpp.

◆ GetMsgReplierEndpoint()

const std::string & server::Config::GetMsgReplierEndpoint ( ) const
Returns
The network endpoint to send request to this application. The format is "<middleware>.<protocol>://<ipaddr>:<port>". For example: "zpb.rr://127.0.0.1:12081/"

Definition at line 315 of file config.cpp.

◆ GetProcName()

const std::string & server::Config::GetProcName ( ) const
Returns
The application process name.

Definition at line 355 of file config.cpp.

◆ GetPubEndpoint()

const std::string & server::Config::GetPubEndpoint ( ) const
Returns
The network endpoint used to publish topics from this application. The format is "<middleware>.<protocol>://<ipaddr>:<port>". For example: "zpb.ps://127.0.0.1:12082/"

Definition at line 320 of file config.cpp.

◆ GetSmScxmlFilename()

const std::string & server::Config::GetSmScxmlFilename ( ) const
Returns
The SCXML State Machine model filename used by the application.

Definition at line 345 of file config.cpp.

◆ GetWorkspace()

std::filesystem::path server::Config::GetWorkspace ( ) const
inline
Returns
Workspace root (absolute path)

Definition at line 138 of file config.hpp.

◆ LoadConfig()

void server::Config::LoadConfig ( const std::string &  filename = "")

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.

Definition at line 151 of file config.cpp.

◆ operator=()

Config& server::Config::operator= ( const Config )
delete

Disable copy constructor.

◆ ParseOptions()

bool server::Config::ParseOptions ( int  argc,
char *  argv[] 
)

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.

Definition at line 71 of file config.cpp.

Member Data Documentation

◆ m_config_filename

std::string server::Config::m_config_filename

Definition at line 155 of file config.hpp.

◆ m_config_node

YAML::Node server::Config::m_config_node

Disable assignment operator.

Definition at line 150 of file config.hpp.

◆ m_db_host_endpoint

std::string server::Config::m_db_host_endpoint

Definition at line 157 of file config.hpp.

◆ m_db_prefix

std::string server::Config::m_db_prefix

Definition at line 158 of file config.hpp.

◆ m_db_timeout_sec

int server::Config::m_db_timeout_sec

Definition at line 159 of file config.hpp.

◆ m_dpm_params

daq::DpmClientParams server::Config::m_dpm_params

Definition at line 164 of file config.hpp.

◆ m_instrument_id

std::string server::Config::m_instrument_id

Definition at line 152 of file config.hpp.

◆ m_log_level

std::string server::Config::m_log_level

Definition at line 153 of file config.hpp.

◆ m_log_properties

std::string server::Config::m_log_properties

Definition at line 154 of file config.hpp.

◆ m_out_path

std::string server::Config::m_out_path

Definition at line 162 of file config.hpp.

◆ m_proc_name

std::string server::Config::m_proc_name

Definition at line 151 of file config.hpp.

◆ m_pub_endpoint

std::string server::Config::m_pub_endpoint

Definition at line 161 of file config.hpp.

◆ m_req_endpoint

std::string server::Config::m_req_endpoint

Definition at line 160 of file config.hpp.

◆ m_scxml_filename

std::string server::Config::m_scxml_filename

Definition at line 156 of file config.hpp.

◆ m_stale_acquiring

std::optional<std::chrono::hours> server::Config::m_stale_acquiring

Definition at line 165 of file config.hpp.

◆ m_stale_merging

std::optional<std::chrono::hours> server::Config::m_stale_merging

Definition at line 166 of file config.hpp.

◆ m_workspace

std::filesystem::path server::Config::m_workspace

Definition at line 163 of file config.hpp.


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