CASM
1.1.0
A Clusters Approach to Statistical Mechanics
stream_io.hh
Go to the documentation of this file.
1
#ifndef CASM_support_enum_stream_io
2
#define CASM_support_enum_stream_io
3
4
#include "
casm/casm_io/enum/io_traits.hh
"
5
6
namespace
CASM
{
7
8
#define ENUM_IO_DECL(ENUM) \
9
std::ostream &operator<<(std::ostream &sout, const ENUM &val); \
10
\
11
std::istream &operator>>(std::istream &sin, ENUM &val);
12
13
#define ENUM_IO_DEF(ENUM) \
14
std::ostream &operator<<(std::ostream &sout, const ENUM &val) { \
15
sout << to_string<ENUM>(val); \
16
return sout; \
17
} \
18
\
19
std::istream &operator>>(std::istream &sin, ENUM &val) { \
20
std::string s; \
21
sin >> s; \
22
val = from_string<ENUM>(s); \
23
return sin; \
24
}
25
26
#define ENUM_IO_INLINE(ENUM) \
27
inline std::ostream &operator<<(std::ostream &sout, const ENUM &val) { \
28
sout << to_string<ENUM>(val); \
29
return sout; \
30
} \
31
\
32
inline std::istream &operator>>(std::istream &sin, ENUM &val) { \
33
std::string s; \
34
sin >> s; \
35
val = from_string<ENUM>(s); \
36
return sin; \
37
}
38
39
}
// namespace CASM
40
41
#endif
io_traits.hh
CASM
Main CASM namespace.
Definition:
APICommand.hh:8
include
casm
casm_io
enum
stream_io.hh
Generated on Tue Mar 23 2021 14:16:34 for CASM by
1.9.1