kraken: move 'Order' definition to 'book'

I think it makes more sense to centralise these important types in the
`book` library.
This commit is contained in:
Bruno BELANYI 2022-03-12 03:36:25 +01:00
parent 7c9b61b654
commit 21ff896730
7 changed files with 17 additions and 5 deletions

View file

@ -1,6 +1,7 @@
add_executable(kraken kraken.cc) add_executable(kraken kraken.cc)
target_link_libraries(kraken PRIVATE common_options) target_link_libraries(kraken PRIVATE common_options)
add_subdirectory(book)
add_subdirectory(csv) add_subdirectory(csv)
add_subdirectory(parse) add_subdirectory(parse)
add_subdirectory(utils) add_subdirectory(utils)
@ -8,6 +9,7 @@ add_subdirectory(utils)
configure_file(config.h.in config.h) configure_file(config.h.in config.h)
target_link_libraries(kraken PRIVATE target_link_libraries(kraken PRIVATE
book
csv csv
parse parse
) )

10
src/book/CMakeLists.txt Normal file
View file

@ -0,0 +1,10 @@
add_library(book STATIC
order.cc
order.hh
)
target_link_libraries(book PRIVATE
utils
)
target_link_libraries(book PRIVATE common_options)

View file

@ -5,7 +5,7 @@
#include "utils/strong-type.hh" #include "utils/strong-type.hh"
namespace kraken::parse { namespace kraken {
/// Which side the order is on. /// Which side the order is on.
enum class Side { enum class Side {
@ -68,4 +68,4 @@ struct FlushOrder {
using Order = std::variant<TradeOrder, CancelOrder, FlushOrder>; using Order = std::variant<TradeOrder, CancelOrder, FlushOrder>;
} // namespace kraken::parse } // namespace kraken

View file

@ -1,11 +1,10 @@
add_library(parse STATIC add_library(parse STATIC
order.cc
order.hh
parse.cc parse.cc
parse.hh parse.hh
) )
target_link_libraries(parse PRIVATE target_link_libraries(parse PRIVATE
book
csv csv
utils utils
) )

View file

@ -4,7 +4,7 @@
#include <stdexcept> #include <stdexcept>
#include <vector> #include <vector>
#include "order.hh" #include "book/order.hh"
namespace kraken::parse { namespace kraken::parse {

View file

@ -6,6 +6,7 @@
#include "parse/parse.hh" #include "parse/parse.hh"
// Allow namespace pollution in tests for convenience // Allow namespace pollution in tests for convenience
using namespace kraken;
using namespace kraken::parse; using namespace kraken::parse;
namespace { namespace {