1 #ifndef CASM_FormattedDataFile_impl
2 #define CASM_FormattedDataFile_impl
4 #include <boost/filesystem/fstream.hpp>
7 #include "casm/external/gzstream/gzstream.h"
11 template <
typename DataObject>
15 options.json_arrays, options.compress) {}
17 template <
typename DataObject>
22 : m_initialized(false),
23 m_json_output(json_output),
24 m_json_arrays(json_arrays) {
26 m_ostream = notstd::make_unique<fs::ofstream>(file_path);
28 m_ostream = notstd::make_unique<gz::ogzstream>(file_path.string().c_str());
32 template <
typename DataObject>
39 template <
typename DataObject>
45 }
else if (m_json_arrays) {
53 *m_ostream << formatter(
object);
54 }
else if (m_json_arrays) {
static jsonParser object()
Returns an empty json object.
static jsonParser array()
Returns an empty json array.
jsonParser & push_back(const T &value, Args &&... args)