From 21ff8967301d268999181d0ffac7aabfbfeb325f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 12 Mar 2022 03:36:25 +0100 Subject: [PATCH] kraken: move 'Order' definition to 'book' I think it makes more sense to centralise these important types in the `book` library. --- src/CMakeLists.txt | 2 ++ src/book/CMakeLists.txt | 10 ++++++++++ src/{parse => book}/order.cc | 0 src/{parse => book}/order.hh | 4 ++-- src/parse/CMakeLists.txt | 3 +-- src/parse/parse.hh | 2 +- tests/unit/parse.cc | 1 + 7 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 src/book/CMakeLists.txt rename src/{parse => book}/order.cc (100%) rename src/{parse => book}/order.hh (96%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 378cd00..302eaab 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,7 @@ add_executable(kraken kraken.cc) target_link_libraries(kraken PRIVATE common_options) +add_subdirectory(book) add_subdirectory(csv) add_subdirectory(parse) add_subdirectory(utils) @@ -8,6 +9,7 @@ add_subdirectory(utils) configure_file(config.h.in config.h) target_link_libraries(kraken PRIVATE + book csv parse ) diff --git a/src/book/CMakeLists.txt b/src/book/CMakeLists.txt new file mode 100644 index 0000000..5d2a511 --- /dev/null +++ b/src/book/CMakeLists.txt @@ -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) diff --git a/src/parse/order.cc b/src/book/order.cc similarity index 100% rename from src/parse/order.cc rename to src/book/order.cc diff --git a/src/parse/order.hh b/src/book/order.hh similarity index 96% rename from src/parse/order.hh rename to src/book/order.hh index b932eb8..339d050 100644 --- a/src/parse/order.hh +++ b/src/book/order.hh @@ -5,7 +5,7 @@ #include "utils/strong-type.hh" -namespace kraken::parse { +namespace kraken { /// Which side the order is on. enum class Side { @@ -68,4 +68,4 @@ struct FlushOrder { using Order = std::variant; -} // namespace kraken::parse +} // namespace kraken diff --git a/src/parse/CMakeLists.txt b/src/parse/CMakeLists.txt index 9918cde..137a43b 100644 --- a/src/parse/CMakeLists.txt +++ b/src/parse/CMakeLists.txt @@ -1,11 +1,10 @@ add_library(parse STATIC - order.cc - order.hh parse.cc parse.hh ) target_link_libraries(parse PRIVATE + book csv utils ) diff --git a/src/parse/parse.hh b/src/parse/parse.hh index ebdb6d1..fe91702 100644 --- a/src/parse/parse.hh +++ b/src/parse/parse.hh @@ -4,7 +4,7 @@ #include #include -#include "order.hh" +#include "book/order.hh" namespace kraken::parse { diff --git a/tests/unit/parse.cc b/tests/unit/parse.cc index 8736e97..c778a43 100644 --- a/tests/unit/parse.cc +++ b/tests/unit/parse.cc @@ -6,6 +6,7 @@ #include "parse/parse.hh" // Allow namespace pollution in tests for convenience +using namespace kraken; using namespace kraken::parse; namespace {