ifw-daq  3.0.0-pre2
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...
 
 Config (const Config &)=delete
 
Configoperator= (const Config &)=delete
 Disable copy constructor. More...
 
bool ParseOptions (int argc, char *argv[])
 Disable assignment operator. 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 & GetDbPrefix () const
 
std::chrono::seconds 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::config::ManagerGetMgr ()
 
daq::DpmClientParams const & GetDpmClientParams () const
 

Public Attributes

daq::config::Manager m_mgr
 
std::optional< elt::configng::CiiConfigDocument > m_config
 
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_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::chrono::hours m_stale_acquiring = std::chrono::hours(14)
 
std::chrono::hours m_stale_merging = std::chrono::hours(2 * 24)
 

Detailed Description

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

Definition at line 60 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 39 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 317 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 299 of file config.cpp.

◆ GetDbTimeout()

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

Definition at line 308 of file config.cpp.

◆ GetDpmClientParams()

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

Definition at line 337 of file config.cpp.

◆ GetLogLevel()

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

Definition at line 327 of file config.cpp.

◆ GetLogProperties()

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

Definition at line 332 of file config.cpp.

◆ GetMgr()

daq::config::Manager& server::Config::GetMgr ( )
inline

Definition at line 151 of file config.hpp.

◆ 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 289 of file config.cpp.

◆ GetProcName()

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

Definition at line 322 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 294 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 312 of file config.cpp.

◆ GetWorkspace()

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

Definition at line 145 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 166 of file config.cpp.

◆ operator=()

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

Disable copy constructor.

◆ ParseOptions()

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

Disable assignment operator.

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 90 of file config.cpp.

Member Data Documentation

◆ m_config

std::optional<elt::configng::CiiConfigDocument> server::Config::m_config

Definition at line 159 of file config.hpp.

◆ m_config_filename

std::string server::Config::m_config_filename

Definition at line 165 of file config.hpp.

◆ m_db_prefix

std::string server::Config::m_db_prefix

Definition at line 167 of file config.hpp.

◆ m_db_timeout_sec

int server::Config::m_db_timeout_sec

Definition at line 168 of file config.hpp.

◆ m_dpm_params

daq::DpmClientParams server::Config::m_dpm_params

Definition at line 173 of file config.hpp.

◆ m_instrument_id

std::string server::Config::m_instrument_id

Definition at line 162 of file config.hpp.

◆ m_log_level

std::string server::Config::m_log_level

Definition at line 163 of file config.hpp.

◆ m_log_properties

std::string server::Config::m_log_properties

Definition at line 164 of file config.hpp.

◆ m_mgr

daq::config::Manager server::Config::m_mgr

Definition at line 156 of file config.hpp.

◆ m_out_path

std::string server::Config::m_out_path

Definition at line 171 of file config.hpp.

◆ m_proc_name

std::string server::Config::m_proc_name

Definition at line 161 of file config.hpp.

◆ m_pub_endpoint

std::string server::Config::m_pub_endpoint

Definition at line 170 of file config.hpp.

◆ m_req_endpoint

std::string server::Config::m_req_endpoint

Definition at line 169 of file config.hpp.

◆ m_scxml_filename

std::string server::Config::m_scxml_filename

Definition at line 166 of file config.hpp.

◆ m_stale_acquiring

std::chrono::hours server::Config::m_stale_acquiring = std::chrono::hours(14)

Definition at line 174 of file config.hpp.

◆ m_stale_merging

std::chrono::hours server::Config::m_stale_merging = std::chrono::hours(2 * 24)

Definition at line 175 of file config.hpp.

◆ m_workspace

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

Definition at line 172 of file config.hpp.


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