Joel Grunbaum
2022-01-08 16b655e7c8cfb2e32e6bb839373f30ad63506f9a
commit | author | age
16b655 1 #pragma once
JG 2
3 #include "book.hpp"
4 #include "json.hpp"
5
6 #include <string>
7 #include <unordered_map>
8
9 namespace protocol
10 {
11 enum OrderEnum { ADD, DELETE, BROKER_REQUEST, BROKER_CONFIRM };
12
13     // Catchup utilities
14 std::unordered_map<std::string, book::Book> recoverBook();
15
16     // Outgoing messages
17     void addOrder(json::AddMessage& order);
18     void deleteOrder(json::DeleteMessage& order);
19
20 // Incoming messages
21 void handleMessage(std::unordered_map<std::string, book::Book>& bs,
22                    json::Message* message);
23 void announce(std::unordered_map<std::string, book::Book>& bs,
24               json::AnnounceMessage* message);
25 void settle(std::unordered_map<std::string, book::Book>& bs,
26             json::SettleMessage* message);
27 void addedOrder(std::unordered_map<std::string, book::Book>& bs,
28               json::AddedMessage* message);
29 void deletedOrder(std::unordered_map<std::string, book::Book>& bs,
30                  json::DeletedMessage* message);
31 void tradeOrder(std::unordered_map<std::string, book::Book>& bs,
32                 json::TradeMessage* message);
33 void broker(std::unordered_map<std::string, book::Book>& bs,
34             json::Broker* message);
35
36     void send(std::string& message);
37 } // namespace protocol