CASM
1.1.0
A Clusters Approach to Statistical Mechanics
FormattedDataFile.hh
Go to the documentation of this file.
1
#ifndef CASM_FormattedDataFile
2
#define CASM_FormattedDataFile
3
4
#include <boost/filesystem.hpp>
5
#include <iostream>
6
7
#include "
casm/casm_io/dataformatter/DataFormatterDecl.hh
"
8
#include "
casm/casm_io/json/jsonParser.hh
"
9
#include "
casm/global/definitions.hh
"
10
11
namespace
CASM
{
12
13
struct
FormattedDataFileOptions
{
14
FormattedDataFileOptions
(fs::path _file_path =
""
,
bool
_json_output =
false
,
15
bool
_json_arrays =
false
,
bool
_compress =
false
);
16
17
fs::path
file_path
;
// location to write
18
bool
json_output
;
// if true output as json, else csv
19
bool
json_arrays
;
// if true, and json_output==true, output json as arrays
20
bool
compress
;
// if true, write compressed .gz file
21
};
22
23
template
<
typename
DataObject>
24
class
FormattedDataFile
{
25
public
:
26
FormattedDataFile
(
FormattedDataFileOptions
const
&options);
27
28
FormattedDataFile
(fs::path file_path,
bool
json_output,
bool
json_arrays,
29
bool
compress);
30
31
~FormattedDataFile
();
32
33
void
operator()
(
DataFormatter<DataObject>
const
&formatter,
34
DataObject
const
&
object
);
35
36
private
:
37
bool
m_initialized
;
38
jsonParser
m_json
;
39
bool
m_json_output
;
40
bool
m_json_arrays
;
41
std::unique_ptr<std::ostream>
m_ostream
;
42
};
43
44
}
// namespace CASM
45
46
#endif
DataFormatterDecl.hh
CASM::DataFormatter< DataObject >
CASM::FormattedDataFile
Definition:
FormattedDataFile.hh:24
CASM::FormattedDataFile::operator()
void operator()(DataFormatter< DataObject > const &formatter, DataObject const &object)
Definition:
FormattedDataFile_impl.hh:40
CASM::FormattedDataFile::~FormattedDataFile
~FormattedDataFile()
Definition:
FormattedDataFile_impl.hh:33
CASM::FormattedDataFile::m_initialized
bool m_initialized
Definition:
FormattedDataFile.hh:37
CASM::FormattedDataFile::m_json_arrays
bool m_json_arrays
Definition:
FormattedDataFile.hh:40
CASM::FormattedDataFile::FormattedDataFile
FormattedDataFile(FormattedDataFileOptions const &options)
Definition:
FormattedDataFile_impl.hh:12
CASM::FormattedDataFile::m_ostream
std::unique_ptr< std::ostream > m_ostream
Definition:
FormattedDataFile.hh:41
CASM::FormattedDataFile::m_json_output
bool m_json_output
Definition:
FormattedDataFile.hh:39
CASM::FormattedDataFile::m_json
jsonParser m_json
Definition:
FormattedDataFile.hh:38
CASM::jsonParser
Definition:
jsonParser.hh:85
definitions.hh
jsonParser.hh
CASM
Main CASM namespace.
Definition:
APICommand.hh:8
CASM::FormattedDataFileOptions
Definition:
FormattedDataFile.hh:13
CASM::FormattedDataFileOptions::file_path
fs::path file_path
Definition:
FormattedDataFile.hh:17
CASM::FormattedDataFileOptions::FormattedDataFileOptions
FormattedDataFileOptions(fs::path _file_path="", bool _json_output=false, bool _json_arrays=false, bool _compress=false)
Definition:
FormattedDataFile.cc:5
CASM::FormattedDataFileOptions::json_output
bool json_output
Definition:
FormattedDataFile.hh:18
CASM::FormattedDataFileOptions::compress
bool compress
Definition:
FormattedDataFile.hh:20
CASM::FormattedDataFileOptions::json_arrays
bool json_arrays
Definition:
FormattedDataFile.hh:19
include
casm
casm_io
dataformatter
FormattedDataFile.hh
Generated on Tue Mar 23 2021 14:16:36 for CASM by
1.9.1