application_config.h
1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef ETRADECLIENT_UTILITY_APPLICATION_CONFIG_H_INCLUDED
#define ETRADECLIENT_UTILITY_APPLICATION_CONFIG_H_INCLUDED
/*A "singleton" class to provide a universal interface to access the configuration of application.*/
#include <cstdint>
#include <string>
class ApplicationConfig
{
public:
/*Exception will be thrown if config file path not correct.*/
static ApplicationConfig& Instance();
void ModifyCfg( uint32_t msg_query_interval,
const std::string& pwd_machine_ip,
uint32_t pwd_machine_port,
uint32_t pwd_machine_time_out,
uint8_t pin_pad_pwd_len,
uint8_t pin_pad_timeout);
uint32_t MsgCountQueryInterval() const; // Return value in second.
std::string PWDMachineIP() const; // Don't worry about the cost of returning string object because we have RVO & move semantics.
uint32_t PWDMachinePort() const;
uint32_t PWDMachineTimeout() const;
uint8_t PINPadPWDLen() const; // The length of the password read from PIN pad.
uint8_t PINPadTimeout() const; // Return value in seconds.
std::string ClientCertStore() const;
std::string ClientCertSubject() const;
std::string ClientCertFileName() const;
std::string ClientCertPassword() const;
bool IsEncrypt() const;
uint8_t EncryptType() const;
private:
ApplicationConfig();
ApplicationConfig(const ApplicationConfig&);
ApplicationConfig& operator=(const ApplicationConfig&);
uint32_t m_msg_count_query_interval;
std::string m_pwd_machine_ip;
uint32_t m_pwd_machine_port;
uint32_t m_pwd_machine_timeout;
uint8_t m_pin_pad_pwd_len;
uint8_t m_pin_pad_timeout;
std::string m_client_cert_store;
std::string m_client_cert_subject;
std::string m_client_cert_filename;
std::string m_client_cert_password;
uint8_t m_is_encrypt;
uint8_t m_encrypt_type;
};
#endif // ETRADECLIENT_UTILITY_APPLICATION_CONFIG_H_INCLUDED