summaryrefslogtreecommitdiffhomepage
path: root/example
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-12-17 14:52:56 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-12-17 14:52:56 +0100
commitde8b6e73fd59763b14d7a2b9fd40f583305133dc (patch)
tree4f5252c1fc429b3c5af81fcf7a283613dc395c9b /example
parent8bdab6893ca4e144f365b0ff9c7bed7be56aa4d5 (diff)
chore: updated file structure.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'example')
-rw-r--r--example/fix_tag_example/CMakeLists.txt15
-rw-r--r--example/fix_tag_example/example.cc30
2 files changed, 45 insertions, 0 deletions
diff --git a/example/fix_tag_example/CMakeLists.txt b/example/fix_tag_example/CMakeLists.txt
new file mode 100644
index 0000000..b9a80db
--- /dev/null
+++ b/example/fix_tag_example/CMakeLists.txt
@@ -0,0 +1,15 @@
+
+cmake_minimum_required(VERSION 3.15...3.31)
+
+project(
+ FixExample
+ VERSION 1.0
+ LANGUAGES CXX)
+
+find_package(Boost REQUIRED COMPONENTS container)
+
+add_executable(FixExample example.cc)
+
+set_property(TARGET FixExample PROPERTY CXX_STANDARD 20)
+target_include_directories(FixExample PUBLIC ../../include/ocl)
+target_link_libraries(FixExample PRIVATE Boost::container)
diff --git a/example/fix_tag_example/example.cc b/example/fix_tag_example/example.cc
new file mode 100644
index 0000000..f7f3e76
--- /dev/null
+++ b/example/fix_tag_example/example.cc
@@ -0,0 +1,30 @@
+#include <ocl/fix/parser.hpp>
+
+constexpr 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
+};
+
+int main(int argc, char** argv)
+{
+ ocl::fix::visitor basic_visitor;
+ ocl::fix::range_buffer fix = basic_visitor.visit(default_fix);
+
+ ocl::io::enable_stdio_sync(false);
+
+ ocl::io::print(":key=35\n");
+ ocl::io::print(":value=", fix["35"], "\n");
+
+ ocl::io::print(":key=49\n");
+ ocl::io::print(":value=", fix["49"], "\n");
+
+ return 0;
+}