#pragma once #include "book.hpp" #include "json.hpp" #include #include namespace protocol { enum OrderEnum { ADD, DELETE, BROKER_REQUEST, BROKER_CONFIRM }; // Catchup utilities std::unordered_map recoverBook(); void catchUp(std::unordered_map& bs); // Outgoing messages json::Message* addOrder(json::AddMessage& order); json::Message* deleteOrder(json::DeleteMessage& order); // Incoming messages void handleMessage(std::unordered_map& bs, json::Message* message); void announce(std::unordered_map& bs, json::AnnounceMessage* message); void settle(std::unordered_map& bs, json::SettleMessage* message); void addedOrder(std::unordered_map& bs, json::AddedMessage* message); void deletedOrder(std::unordered_map& bs, json::DeletedMessage* message); void tradeOrder(std::unordered_map& bs, json::TradeMessage* message); void broker(std::unordered_map& bs, json::Broker* message); json::Message* send(std::string& message); } // namespace protocol