diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-24 23:02:29 -0500 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-24 23:02:29 -0500 |
| commit | b189449b28625cec7b6ce399f999072e50efae45 (patch) | |
| tree | e0c8355c438b23969bad384410d5e0861dbd302a /examples | |
| parent | bf2c4bc8c719159b4ddd1b40e032c449424abd5d (diff) | |
feat: expanding FIX module.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/fix/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | examples/fix/fix.cc | 22 |
2 files changed, 17 insertions, 8 deletions
diff --git a/examples/fix/CMakeLists.txt b/examples/fix/CMakeLists.txt index 4c0a432..1001563 100644 --- a/examples/fix/CMakeLists.txt +++ b/examples/fix/CMakeLists.txt @@ -6,10 +6,7 @@ project( VERSION 1.0 LANGUAGES CXX) -find_package(Boost REQUIRED COMPONENTS container) - add_executable(Fix fix.cc) -target_link_libraries(Fix PRIVATE Boost::container) set_property(TARGET Fix PROPERTY CXX_STANDARD 20) target_include_directories(Fix PUBLIC ../../include/ocl) diff --git a/examples/fix/fix.cc b/examples/fix/fix.cc index b2d2915..3dbfafb 100644 --- a/examples/fix/fix.cc +++ b/examples/fix/fix.cc @@ -6,7 +6,7 @@ #include <core/error_handler.hpp> #include <net/modem.hpp> -#include <fix/fix.hpp> +#include <fix/parser.hpp> #include <iostream> #include <unistd.h> #include <io/print.hpp> @@ -15,9 +15,20 @@ /* finally test it */ int main(int argc, char** argv) { - constexpr auto default_fix = "8=FIX.4.2\x01 9=65 \x01 35=A \x01 49=SERVER \x01 56=CLIENT \x01 34=177 \x01 52=20090107-18:15:16 \x01 98=0 \x01 108=30 \x01 10=062 \x01 "; + constexpr const char default_fix[] = { + '8', '=', 'F', 'I', 'X', '.', '4', '.', '2', 0x01, + '9', '=', '6', '3', 0x01, // BodyLength = 63 + '3', '5', '=', 'A', 0x01, + '4', '9', '=', 'S', 'E', 'R', 'V', 'E', 'R', 0x01, + '5', '6', '=', 'C', 'L', 'I', 'E', 'N', 'T', 0x01, + '3', '4', '=', '1', '7', '7', 0x01, + '5', '2', '=', '2', '0', '0', '9', '0', '1', '0', '7', '-', '1', '8', ':', '1', '5', ':', '1', '6', 0x01, + '9', '8', '=', '0', 0x01, + '1', '0', '8', '=', '3', '0', 0x01, + '1', '0', '=', '1', '4', '3', 0x01, 0x00 // CheckSum = 143 + }; - ocl::fix::basic_visitor<char> basic_visitor; + ocl::fix::basic_visitor<char> basic_visitor; ocl::fix::basic_range_data<char> fix = basic_visitor.visit(default_fix); std::cout << "magic=" << fix.magic_ << std::endl; @@ -29,8 +40,9 @@ int main(int argc, char** argv) for (auto fields : fix.body_) { - ocl::io::print("key=", fields.first); - ocl::io::print(", value=", fields.second); + ocl::io::print("key=", fields.first); + ocl::io::print(":value=", fields.second); + ocl::io::print("\n"); } return 0; |
