Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
structs.hpp
Go to the documentation of this file.
1#ifndef IV_SRC_CACHE_STRUCTS_HPP_
2#define IV_SRC_CACHE_STRUCTS_HPP_
3
5#include "third_party/JSON.hpp"
6
7using JSON = nlohmann::json;
8
9namespace iv::cache::editor
10{
11
13{
14 friend struct GeneralCache;
15 explicit StringWithTimestamp(const JSON &cacheJSON);
16
21
22 [[nodiscard]] JSON toJSON() const;
23
24 [[nodiscard]] std::string_view getValue() const
25 {
26 return value;
27 }
28
29private:
30 struct Fields
31 {
32 static constexpr std::string_view value {"value"};
33 static constexpr std::string_view timestamp {"timestamp"};
34 };
35
36 std::string value;
38};
39
45{
46
51 void write(JSON &cacheJSON) const;
52
58 void read(const JSON &cacheJSON);
59
60 void addLastDirectoryOpened(const StringWithTimestamp &directory);
61
62 struct Fields
63 {
64 struct Key
65 {
66 static constexpr std::string_view generalKey {"general"};
67 };
68
69 static constexpr std::string_view language {"language"};
70
72 {
73 struct Key
74 {
75 static constexpr std::string_view startCommsKey {"startComms"};
76 };
77 static constexpr std::string_view gatewayIp {"gatewayIp"};
78 static constexpr std::string_view gatewayPort {"gatewayPort"};
79 static constexpr std::string_view stationPort {"stationPort"};
80 static constexpr std::string_view stationDataIp {"stationDataIp"};
81 static constexpr std::string_view socketCanInterface {"socketCanInterface"};
82 static constexpr std::string_view ixxatSerialNumber {"ixxatSerialNumber"};
83 static constexpr std::string_view askUnitInfo {"askUnitInfo"};
84 };
85
87 {
88 struct Key
89 {
90 static constexpr std::string_view fileOpeningKey {"fileOpening"};
91 };
92 static constexpr std::string_view lastProjectOpened {"lastProjectOpened"};
93 static constexpr std::string_view lastDirectoriesOpened {"lastDirectoriesOpened"};
94 };
95 };
96
98
99 std::optional<iv::types::ipAddress> gatewayIp;
100 std::optional<iv::types::ipPort> gatewayPort;
101 std::optional<iv::types::ipPort> stationPort;
102 std::optional<iv::types::ipAddress> stationDataIp;
103 std::optional<bool> askUnitInfo;
104
105 std::optional<std::string> socketCanInterface;
106 std::optional<std::string> ixxatSerialNumber;
107
108 std::optional<std::string> lastProjectOpened;
109 std::optional<std::vector<StringWithTimestamp>> lastDirectoriesOpened;
110};
111
117{
118 void write(JSON &cacheJSON) const;
119
120 void read(const JSON &cacheJSON);
121
122 struct Fields
123 {
124 struct Key
125 {
126 static constexpr std::string_view controlsEditorKey {"controlsEditor"};
127 };
128
130 {
131 struct Key
132 {
133 static constexpr std::string_view valveKey {"valve"};
134 };
135
136 static constexpr std::string_view lastGeneratedLibrary {"lastGeneratedLibrary"};
137 };
138
140 {
141 struct Key
142 {
143 static constexpr std::string_view damperKey {"damper"};
144 };
145
146 static constexpr std::string_view lastGeneratedLibrary {"lastGeneratedLibrary"};
147 static constexpr std::string_view lastDamperDescription {"lastDamperDescription"};
148 };
149 };
150
152 {
153 std::optional<iv::types::logic::customBlockId> lastGeneratedLibraryId;
154 };
155
157 {
158 std::optional<iv::types::logic::customBlockId> lastGeneratedLibraryId;
159 std::optional<iv::types::control::damper::damperDescription> lastDamperDescription;
160 };
161
164};
165
171{
173
178 void write(JSON &cacheJSON) const;
179
185 void read(const JSON &cacheJSON);
186
187 struct Fields
188 {
189 struct Key
190 {
191 static constexpr std::string_view specificProjectKey {"specificProjects"};
192 };
193
195 {
196 struct Key
197 {
198 static constexpr std::string_view exportImportChannelsKey {"exportImportChannels"};
199 };
200
201 static constexpr std::string_view lastDirectoryExportedTo {"lastDirectoryExportedTo"};
202 static constexpr std::string_view lastImportedFile {"lastImportedFile"};
203 };
204
206 {
207 struct Key
208 {
209 static constexpr std::string_view lastSelectedUnitKey {"lastSelectedUnit"};
210 };
211 };
212 };
213
214 std::optional<std::string> lastDirectoryExportedTo;
215 std::optional<std::string> lastImportedFile;
216 std::optional<iv::types::unitId> lastSelectedUnitId;
218};
219
220}// namespace iv::cache::editor
221
222#endif//IV_SRC_CACHE_STRUCTS_HPP_
nlohmann::json JSON
Definition structs.hpp:7
Definition EditDiamarCache.cpp:7
uint64_t timestamp
Definition types.hpp:21
eLanguage
Definition enums.hpp:37
std::optional< iv::types::control::damper::damperDescription > lastDamperDescription
Definition structs.hpp:159
std::optional< iv::types::logic::customBlockId > lastGeneratedLibraryId
Definition structs.hpp:158
static constexpr std::string_view damperKey
Definition structs.hpp:143
static constexpr std::string_view lastDamperDescription
Definition structs.hpp:147
static constexpr std::string_view lastGeneratedLibrary
Definition structs.hpp:146
static constexpr std::string_view controlsEditorKey
Definition structs.hpp:126
static constexpr std::string_view valveKey
Definition structs.hpp:133
static constexpr std::string_view lastGeneratedLibrary
Definition structs.hpp:136
std::optional< iv::types::logic::customBlockId > lastGeneratedLibraryId
Definition structs.hpp:153
Controls editor cache.
Definition structs.hpp:117
ValveEditor valveEditor
Definition structs.hpp:162
void write(JSON &cacheJSON) const
Write controls editor cache to JSON.
Definition structs.cpp:169
DamperEditor damperEditor
Definition structs.hpp:163
void read(const JSON &cacheJSON)
Read controls editor cache from JSON.
Definition structs.cpp:199
static constexpr std::string_view fileOpeningKey
Definition structs.hpp:90
static constexpr std::string_view lastDirectoriesOpened
Definition structs.hpp:93
static constexpr std::string_view lastProjectOpened
Definition structs.hpp:92
static constexpr std::string_view generalKey
Definition structs.hpp:66
static constexpr std::string_view startCommsKey
Definition structs.hpp:75
static constexpr std::string_view askUnitInfo
Definition structs.hpp:83
static constexpr std::string_view socketCanInterface
Definition structs.hpp:81
static constexpr std::string_view stationDataIp
Definition structs.hpp:80
static constexpr std::string_view gatewayIp
Definition structs.hpp:77
static constexpr std::string_view stationPort
Definition structs.hpp:79
static constexpr std::string_view ixxatSerialNumber
Definition structs.hpp:82
static constexpr std::string_view gatewayPort
Definition structs.hpp:78
static constexpr std::string_view language
Definition structs.hpp:69
General cache.
Definition structs.hpp:45
std::optional< iv::types::ipAddress > gatewayIp
Definition structs.hpp:99
iv::eLanguage language
Definition structs.hpp:97
std::optional< bool > askUnitInfo
Definition structs.hpp:103
std::optional< std::string > socketCanInterface
Definition structs.hpp:105
std::optional< iv::types::ipAddress > stationDataIp
Definition structs.hpp:102
std::optional< std::string > ixxatSerialNumber
Definition structs.hpp:106
void addLastDirectoryOpened(const StringWithTimestamp &directory)
Definition structs.cpp:136
void write(JSON &cacheJSON) const
Write cache to JSON.
Definition structs.cpp:32
std::optional< std::string > lastProjectOpened
Definition structs.hpp:108
std::optional< iv::types::ipPort > gatewayPort
Definition structs.hpp:100
std::optional< iv::types::ipPort > stationPort
Definition structs.hpp:101
std::optional< std::vector< StringWithTimestamp > > lastDirectoriesOpened
Definition structs.hpp:109
void read(const JSON &cacheJSON)
Read cache from JSON.
Definition structs.cpp:65
static constexpr std::string_view exportImportChannelsKey
Definition structs.hpp:198
static constexpr std::string_view lastDirectoryExportedTo
Definition structs.hpp:201
static constexpr std::string_view lastImportedFile
Definition structs.hpp:202
static constexpr std::string_view specificProjectKey
Definition structs.hpp:191
static constexpr std::string_view lastSelectedUnitKey
Definition structs.hpp:209
Specific project cache.
Definition structs.hpp:171
std::optional< std::string > lastDirectoryExportedTo
Definition structs.hpp:214
ControlsEditor controlsEditor
Definition structs.hpp:217
void read(const JSON &cacheJSON)
Read cache from JSON.
Definition structs.cpp:247
void write(JSON &cacheJSON) const
Write cache to JSON.
Definition structs.cpp:237
std::optional< iv::types::unitId > lastSelectedUnitId
Definition structs.hpp:216
std::optional< std::string > lastImportedFile
Definition structs.hpp:215
static constexpr std::string_view value
Definition structs.hpp:32
static constexpr std::string_view timestamp
Definition structs.hpp:33
std::string value
Definition structs.hpp:36
StringWithTimestamp(const JSON &cacheJSON)
Definition structs.cpp:10
std::string_view getValue() const
Definition structs.hpp:24
JSON toJSON() const
Definition structs.cpp:23
StringWithTimestamp(std::string value, iv::types::timestamp timestamp)
Definition structs.hpp:17
iv::types::timestamp timestamp
Definition structs.hpp:37