CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
EnumIO.hh File Reference
#include <iostream>
#include <string>
#include <sstream>
#include <stdexcept>
#include "casm/casm_io/jsonParser.hh"

Go to the source code of this file.

Classes

struct  CASM::traits< T >
 

Namespaces

 CASM
 Main CASM namespace.
 

Macros

#define ENUM_TRAITS(ENUM)
 
#define ENUM_IO(ENUM)
 

Functions

template<typename ENUM >
std::string CASM::help ()
 Print help message describing recognized strings for allowed enum values. More...
 
template<typename ENUM >
void CASM::invalid_enum_string (std::string val, std::ostream &serr)
 Throw invalid_argument error for unrecognized strings. More...
 
template<typename ENUM >
std::string CASM::to_string (ENUM val)
 Return string representation of enum class. More...
 
template<typename ENUM >
ENUM CASM::from_string (const std::string &val)
 Return enum class object from string representation. More...
 

Macro Definition Documentation

#define ENUM_IO (   ENUM)
Value:
inline std::ostream &operator<<(std::ostream &sout, const ENUM& val) { \
sout << to_string<ENUM>(val); \
return sout; \
} \
\
inline std::istream &operator>>(std::istream &sin, ENUM& val) { \
std::string s; \
sin >> s; \
val = from_string<ENUM>(s); \
return sin; \
} \
\
inline jsonParser &to_json(const ENUM &val, jsonParser &json) { \
return to_json(to_string<ENUM>(val), json); \
} \
\
inline void from_json(ENUM& val, const jsonParser& json) { \
val = from_string<ENUM>(json.get<std::string>()); \
} \
std::ostream & operator<<(std::ostream &sout, const SelectiveDynamics &sel)
Write SelectiveDynamics options.
Definition: VaspIO.hh:63
void from_json(ClexDescription &desc, const jsonParser &json)
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
std::istream & operator>>(std::istream &_in, std::vector< T > &vec)

Definition at line 115 of file EnumIO.hh.

#define ENUM_TRAITS (   ENUM)
Value:
template<> \
struct traits<ENUM> { \
\
static const std::string name; \
\
static const std::multimap<ENUM, std::vector<std::string> > strval; \
\
}; \

Definition at line 105 of file EnumIO.hh.