summaryrefslogtreecommitdiff
path: root/lib/c++/write_json.hpp
blob: 19bbfa66bf9235d23cab538897883b2dbe8737e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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();
}
}
}