-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathproto.h
More file actions
406 lines (308 loc) · 12.7 KB
/
proto.h
File metadata and controls
406 lines (308 loc) · 12.7 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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
//------------------------------------------------------------------------------
// Automatically generated by the Fast Binary Encoding compiler, do not modify!
// https://github.com/chronoxor/FastBinaryEncoding
// Source: proto.fbe
// FBE version: 1.15.0.0
//------------------------------------------------------------------------------
#pragma once
#if defined(__clang__)
#pragma clang system_header
#elif defined(__GNUC__)
#pragma GCC system_header
#elif defined(_MSC_VER)
#pragma system_header
#endif
#include "fbe.h"
namespace proto {
using namespace FBE;
} // namespace proto
namespace FBE {
using namespace ::proto;
} // namespace FBE
namespace proto {
enum class OrderSide : uint8_t
{
buy,
sell,
};
std::ostream& operator<<(std::ostream& stream, OrderSide value);
#if defined(FMT_VERSION) && (FMT_VERSION >= 90000)
} template <> struct fmt::formatter<proto::OrderSide> : ostream_formatter {}; namespace proto {
#endif
#if defined(LOGGING_PROTOCOL)
CppLogging::Record& operator<<(CppLogging::Record& record, OrderSide value);
#endif
enum class OrderType : uint8_t
{
market,
limit,
stop,
};
std::ostream& operator<<(std::ostream& stream, OrderType value);
#if defined(FMT_VERSION) && (FMT_VERSION >= 90000)
} template <> struct fmt::formatter<proto::OrderType> : ostream_formatter {}; namespace proto {
#endif
#if defined(LOGGING_PROTOCOL)
CppLogging::Record& operator<<(CppLogging::Record& record, OrderType value);
#endif
enum class State : uint8_t
{
unknown = (uint8_t)0x00u,
invalid = (uint8_t)0x01u,
initialized = (uint8_t)0x02u,
calculated = (uint8_t)0x04u,
broken = (uint8_t)0x08u,
good = initialized | calculated,
bad = unknown | invalid | broken,
};
FBE_ENUM_FLAGS(State)
std::ostream& operator<<(std::ostream& stream, State value);
#if defined(FMT_VERSION) && (FMT_VERSION >= 90000)
} template <> struct fmt::formatter<proto::State> : ostream_formatter {}; namespace proto {
#endif
#if defined(LOGGING_PROTOCOL)
CppLogging::Record& operator<<(CppLogging::Record& record, State value);
#endif
struct Order
{
int32_t id;
std::string symbol;
::proto::OrderSide side;
::proto::OrderType type;
double price;
double volume;
size_t fbe_type() const noexcept { return 1; }
Order();
Order(int32_t arg_id, const std::string& arg_symbol, const ::proto::OrderSide& arg_side, const ::proto::OrderType& arg_type, double arg_price, double arg_volume);
Order(const Order& other) = default;
Order(Order&& other) = default;
~Order() = default;
Order& operator=(const Order& other) = default;
Order& operator=(Order&& other) = default;
bool operator==(const Order& other) const noexcept;
bool operator!=(const Order& other) const noexcept { return !operator==(other); }
bool operator<(const Order& other) const noexcept;
bool operator<=(const Order& other) const noexcept { return operator<(other) || operator==(other); }
bool operator>(const Order& other) const noexcept { return !operator<=(other); }
bool operator>=(const Order& other) const noexcept { return !operator<(other); }
std::string string() const { std::stringstream ss; ss << *this; return ss.str(); }
friend std::ostream& operator<<(std::ostream& stream, const Order& value);
void swap(Order& other) noexcept;
friend void swap(Order& value1, Order& value2) noexcept { value1.swap(value2); }
};
} // namespace proto
#if defined(FMT_VERSION) && (FMT_VERSION >= 90000)
template <> struct fmt::formatter<proto::Order> : ostream_formatter {};
#endif
template<>
struct std::hash<proto::Order>
{
typedef proto::Order argument_type;
typedef size_t result_type;
result_type operator() (const argument_type& value) const
{
result_type result = 17;
result = result * 31 + std::hash<decltype(value.id)>()(value.id);
return result;
}
};
namespace proto {
struct Balance
{
std::string currency;
double amount;
size_t fbe_type() const noexcept { return 2; }
Balance();
Balance(const std::string& arg_currency, double arg_amount);
Balance(const Balance& other) = default;
Balance(Balance&& other) = default;
~Balance() = default;
Balance& operator=(const Balance& other) = default;
Balance& operator=(Balance&& other) = default;
bool operator==(const Balance& other) const noexcept;
bool operator!=(const Balance& other) const noexcept { return !operator==(other); }
bool operator<(const Balance& other) const noexcept;
bool operator<=(const Balance& other) const noexcept { return operator<(other) || operator==(other); }
bool operator>(const Balance& other) const noexcept { return !operator<=(other); }
bool operator>=(const Balance& other) const noexcept { return !operator<(other); }
std::string string() const { std::stringstream ss; ss << *this; return ss.str(); }
friend std::ostream& operator<<(std::ostream& stream, const Balance& value);
void swap(Balance& other) noexcept;
friend void swap(Balance& value1, Balance& value2) noexcept { value1.swap(value2); }
};
} // namespace proto
#if defined(FMT_VERSION) && (FMT_VERSION >= 90000)
template <> struct fmt::formatter<proto::Balance> : ostream_formatter {};
#endif
template<>
struct std::hash<proto::Balance>
{
typedef proto::Balance argument_type;
typedef size_t result_type;
result_type operator() (const argument_type& value) const
{
result_type result = 17;
result = result * 31 + std::hash<decltype(value.currency)>()(value.currency);
return result;
}
};
namespace proto {
struct Account
{
int32_t id;
std::string name;
::proto::State state;
::proto::Balance wallet;
std::optional<::proto::Balance> asset;
std::vector<::proto::Order> orders;
size_t fbe_type() const noexcept { return 3; }
Account();
Account(int32_t arg_id, const std::string& arg_name, const ::proto::State& arg_state, const ::proto::Balance& arg_wallet, const std::optional<::proto::Balance>& arg_asset, const std::vector<::proto::Order>& arg_orders);
Account(const Account& other) = default;
Account(Account&& other) = default;
~Account() = default;
Account& operator=(const Account& other) = default;
Account& operator=(Account&& other) = default;
bool operator==(const Account& other) const noexcept;
bool operator!=(const Account& other) const noexcept { return !operator==(other); }
bool operator<(const Account& other) const noexcept;
bool operator<=(const Account& other) const noexcept { return operator<(other) || operator==(other); }
bool operator>(const Account& other) const noexcept { return !operator<=(other); }
bool operator>=(const Account& other) const noexcept { return !operator<(other); }
std::string string() const { std::stringstream ss; ss << *this; return ss.str(); }
friend std::ostream& operator<<(std::ostream& stream, const Account& value);
void swap(Account& other) noexcept;
friend void swap(Account& value1, Account& value2) noexcept { value1.swap(value2); }
};
} // namespace proto
#if defined(FMT_VERSION) && (FMT_VERSION >= 90000)
template <> struct fmt::formatter<proto::Account> : ostream_formatter {};
#endif
template<>
struct std::hash<proto::Account>
{
typedef proto::Account argument_type;
typedef size_t result_type;
result_type operator() (const argument_type& value) const
{
result_type result = 17;
result = result * 31 + std::hash<decltype(value.id)>()(value.id);
return result;
}
};
namespace proto {
struct OrderMessage
{
::proto::Order body;
size_t fbe_type() const noexcept { return 1; }
OrderMessage();
explicit OrderMessage(const ::proto::Order& arg_body);
OrderMessage(const OrderMessage& other) = default;
OrderMessage(OrderMessage&& other) = default;
~OrderMessage() = default;
OrderMessage& operator=(const OrderMessage& other) = default;
OrderMessage& operator=(OrderMessage&& other) = default;
bool operator==(const OrderMessage& other) const noexcept;
bool operator!=(const OrderMessage& other) const noexcept { return !operator==(other); }
bool operator<(const OrderMessage& other) const noexcept;
bool operator<=(const OrderMessage& other) const noexcept { return operator<(other) || operator==(other); }
bool operator>(const OrderMessage& other) const noexcept { return !operator<=(other); }
bool operator>=(const OrderMessage& other) const noexcept { return !operator<(other); }
std::string string() const { std::stringstream ss; ss << *this; return ss.str(); }
friend std::ostream& operator<<(std::ostream& stream, const OrderMessage& value);
void swap(OrderMessage& other) noexcept;
friend void swap(OrderMessage& value1, OrderMessage& value2) noexcept { value1.swap(value2); }
};
} // namespace proto
#if defined(FMT_VERSION) && (FMT_VERSION >= 90000)
template <> struct fmt::formatter<proto::OrderMessage> : ostream_formatter {};
#endif
template<>
struct std::hash<proto::OrderMessage>
{
typedef proto::OrderMessage argument_type;
typedef size_t result_type;
result_type operator() (const argument_type& value) const
{
result_type result = 17;
return result;
}
};
namespace proto {
struct BalanceMessage
{
::proto::Balance body;
size_t fbe_type() const noexcept { return 2; }
BalanceMessage();
explicit BalanceMessage(const ::proto::Balance& arg_body);
BalanceMessage(const BalanceMessage& other) = default;
BalanceMessage(BalanceMessage&& other) = default;
~BalanceMessage() = default;
BalanceMessage& operator=(const BalanceMessage& other) = default;
BalanceMessage& operator=(BalanceMessage&& other) = default;
bool operator==(const BalanceMessage& other) const noexcept;
bool operator!=(const BalanceMessage& other) const noexcept { return !operator==(other); }
bool operator<(const BalanceMessage& other) const noexcept;
bool operator<=(const BalanceMessage& other) const noexcept { return operator<(other) || operator==(other); }
bool operator>(const BalanceMessage& other) const noexcept { return !operator<=(other); }
bool operator>=(const BalanceMessage& other) const noexcept { return !operator<(other); }
std::string string() const { std::stringstream ss; ss << *this; return ss.str(); }
friend std::ostream& operator<<(std::ostream& stream, const BalanceMessage& value);
void swap(BalanceMessage& other) noexcept;
friend void swap(BalanceMessage& value1, BalanceMessage& value2) noexcept { value1.swap(value2); }
};
} // namespace proto
#if defined(FMT_VERSION) && (FMT_VERSION >= 90000)
template <> struct fmt::formatter<proto::BalanceMessage> : ostream_formatter {};
#endif
template<>
struct std::hash<proto::BalanceMessage>
{
typedef proto::BalanceMessage argument_type;
typedef size_t result_type;
result_type operator() (const argument_type& value) const
{
result_type result = 17;
return result;
}
};
namespace proto {
struct AccountMessage
{
::proto::Account body;
size_t fbe_type() const noexcept { return 3; }
AccountMessage();
explicit AccountMessage(const ::proto::Account& arg_body);
AccountMessage(const AccountMessage& other) = default;
AccountMessage(AccountMessage&& other) = default;
~AccountMessage() = default;
AccountMessage& operator=(const AccountMessage& other) = default;
AccountMessage& operator=(AccountMessage&& other) = default;
bool operator==(const AccountMessage& other) const noexcept;
bool operator!=(const AccountMessage& other) const noexcept { return !operator==(other); }
bool operator<(const AccountMessage& other) const noexcept;
bool operator<=(const AccountMessage& other) const noexcept { return operator<(other) || operator==(other); }
bool operator>(const AccountMessage& other) const noexcept { return !operator<=(other); }
bool operator>=(const AccountMessage& other) const noexcept { return !operator<(other); }
std::string string() const { std::stringstream ss; ss << *this; return ss.str(); }
friend std::ostream& operator<<(std::ostream& stream, const AccountMessage& value);
void swap(AccountMessage& other) noexcept;
friend void swap(AccountMessage& value1, AccountMessage& value2) noexcept { value1.swap(value2); }
};
} // namespace proto
#if defined(FMT_VERSION) && (FMT_VERSION >= 90000)
template <> struct fmt::formatter<proto::AccountMessage> : ostream_formatter {};
#endif
template<>
struct std::hash<proto::AccountMessage>
{
typedef proto::AccountMessage argument_type;
typedef size_t result_type;
result_type operator() (const argument_type& value) const
{
result_type result = 17;
return result;
}
};
namespace proto {
} // namespace proto