forked from heliumchain/squorum
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmasternodeconfig.h
121 lines (97 loc) · 2.63 KB
/
masternodeconfig.h
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2017 The PIVX developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef SRC_MASTERNODECONFIG_H_
#define SRC_MASTERNODECONFIG_H_
#include <string>
#include <vector>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
class CMasternodeConfig;
extern CMasternodeConfig masternodeConfig;
class CMasternodeConfig
{
public:
class CMasternodeEntry
{
private:
std::string alias;
std::string ip;
std::string privKey;
std::string txHash;
std::string outputIndex;
public:
CMasternodeEntry(std::string alias, std::string ip, std::string privKey, std::string txHash, std::string outputIndex)
{
this->alias = alias;
this->ip = ip;
this->privKey = privKey;
this->txHash = txHash;
this->outputIndex = outputIndex;
}
const std::string& getAlias() const
{
return alias;
}
void setAlias(const std::string& alias)
{
this->alias = alias;
}
const std::string& getOutputIndex() const
{
return outputIndex;
}
bool castOutputIndex(int& n);
void setOutputIndex(const std::string& outputIndex)
{
this->outputIndex = outputIndex;
}
const std::string& getPrivKey() const
{
return privKey;
}
void setPrivKey(const std::string& privKey)
{
this->privKey = privKey;
}
const std::string& getTxHash() const
{
return txHash;
}
void setTxHash(const std::string& txHash)
{
this->txHash = txHash;
}
const std::string& getIp() const
{
return ip;
}
void setIp(const std::string& ip)
{
this->ip = ip;
}
};
CMasternodeConfig()
{
entries = std::vector<CMasternodeEntry>();
}
void clear();
bool read(std::string& strErr);
void add(std::string alias, std::string ip, std::string privKey, std::string txHash, std::string outputIndex);
std::vector<CMasternodeEntry>& getEntries()
{
return entries;
}
int getCount()
{
int c = -1;
for (CMasternodeEntry e : entries) {
if (e.getAlias() != "") c++;
}
return c;
}
private:
std::vector<CMasternodeEntry> entries;
};
#endif /* SRC_MASTERNODECONFIG_H_ */