16#include <nlohmann/json.hpp>
21 namespace ns_nlohmann_json
29 template <
class... t_Args>
32 document_ = ::nlohmann::ordered_json::object();
42 namespace ns_nlohmann_json
58 *
impl_->output_stream_ <<
impl_->document_.dump(4) << std::endl;
59 impl_->output_stream_->flush();
65 impl_->getRawNode() = ::nlohmann::ordered_json::object();
70 ::nlohmann::ordered_json &obj =
impl_->getRawNode();
71 obj[map_name] = ::nlohmann::ordered_json();
74 impl_->emplace(&obj.find(map_name).value());
86 impl_->getRawNode() = ::nlohmann::ordered_json::array();
87 ::nlohmann::ordered_json &arr =
impl_->getRawNode();
90 for (std::size_t i = 0; i < size; ++i)
92 arr.push_back(::nlohmann::ordered_json());
94 impl_->emplace(0, size);
102 "Internal error: array has more elements than expected.");
125 impl_->getRawNode() = element;
130 impl_->getRawNode() = element;
136 if (param.fallback_to_string_floats_)
138 impl_->getRawNode() = boost::lexical_cast<std::string>(element);
142 impl_->getRawNode() =
static_cast<double>(element);
149 if (param.fallback_to_string_floats_)
151 impl_->getRawNode() = boost::lexical_cast<std::string>(element);
155 impl_->getRawNode() = element;
161#define ARILES2_BASIC_TYPE(type) \
162 void Writer::writeElement(const type &element, const Parameters &) \
164 impl_->getRawNode() = static_cast<std::int64_t>(element); \
169#undef ARILES2_BASIC_TYPE
172#define ARILES2_BASIC_TYPE(type) \
173 void Writer::writeElement(const type &element, const Parameters &) \
175 impl_->getRawNode() = static_cast<std::uint64_t>(element); \
180#undef ARILES2_BASIC_TYPE
::nlohmann::ordered_json document_
instance of the JSON value
void startArray(const std::size_t size, const bool=false)
void startMapEntry(const std::string &map_name)
Starts a nested map in the configuration file.
Writer(const std::string &file_name)
void startMap(const Parameters &, const std::size_t)
Starts a nested map in the configuration file.
void flush()
Flush the configuration to the output.
void makeImplPtr(t_Args &&...args)
FileVisitorImplementation(const std::string &file_name)
void writeElement(const std::complex< t_Scalar > &entry, const Parameters ¶m)
#define CPPUT_ASSERT(condition,...)
#define ARILES2_BASIC_UNSIGNED_INTEGER_TYPES_LIST
#define ARILES2_BASIC_SIGNED_INTEGER_TYPES_LIST
#define CPPUT_MACRO_SUBSTITUTE(macro)
#define CPPUT_TRACE_FUNCTION