summaryrefslogtreecommitdiff
path: root/modules/core/c++/write_json.hpp
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-07-05 15:59:23 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-07-05 15:59:23 +0200
commitc0549d71b2109f10c1238db8b22362e7826ba61b (patch)
tree16cd5264fcc3afe912e1b1b67738c8940d6d1177 /modules/core/c++/write_json.hpp
parent9a3147bc79caf3c0fb1a9cdee29d156b5ff092c7 (diff)
downloadlibs-lbm-c0549d71b2109f10c1238db8b22362e7826ba61b.tar.gz
Just rename from lib to modules
Diffstat (limited to 'modules/core/c++/write_json.hpp')
-rw-r--r--modules/core/c++/write_json.hpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/core/c++/write_json.hpp b/modules/core/c++/write_json.hpp
new file mode 100644
index 0000000..19bbfa6
--- /dev/null
+++ b/modules/core/c++/write_json.hpp
@@ -0,0 +1,27 @@
+#pragma once
+
+#include <forstio/error.hpp>
+
+#include <forstio/codec/data.hpp>
+#include <forstio/codec/data_math.hpp>
+
+#include <forstio/codec/json/json.hpp>
+
+
+namespace kel {
+namespace lbm {
+
+template<typename Schema>
+saw::error_or<void> write_json(const std::filesystem::path& file_name, const saw::data<Schema>& field){
+ saw::data<Schema, saw::encode::Json> j_data;
+ {
+ saw::codec<Schema, saw::encode::Json> j_codec;
+ auto eov = j_codec.encode(field, j_data);
+ if(eov.is_error()){
+ return eov;
+ }
+ }
+ return saw::make_void();
+}
+}
+}