20 std::string
const &_msg);
43 throw std::runtime_error(
44 "Error in DataStream input: JSON may not be input to DataStream");
115 std::string
const &_msg) {
126 namespace DataStream_impl {
127 template <
typename OutType>
129 template <
typename InType>
131 return static_cast<OutType
>(a);
137 template <
typename InType>
139 return static_cast<std::string
>(a);
159 template <
typename InType>
161 return static_cast<double>(a);
171 template <
typename InType>
173 return static_cast<long>(a);
187 template <
typename InType>
189 return static_cast<bool>(a);
206 template <
typename InType>
208 return static_cast<char>(a);
225 template <
typename T,
226 typename Promoter = DataStream_impl::DataStreamPromoter<T> >
232 m_value = Promoter::promote(val);
237 m_value = Promoter::promote(val);
242 m_value = Promoter::promote(val);
247 m_value = Promoter::promote(val);
252 m_value = Promoter::promote(val);
262 template <
typename T,
269 m_vector.push_back(Promoter::promote(val));
274 m_vector.push_back(Promoter::promote(val));
279 m_vector.push_back(Promoter::promote(val));
284 m_vector.push_back(Promoter::promote(val));
289 m_vector.push_back(Promoter::promote(val));
300 return (_stream << (
long)i);
304 return (_stream << (
double)f);
308 return (_stream << (
long)i);
312 return (_stream << (
long)i);
317 for (
auto it = vec.cbegin(); it != vec.cend(); ++it) {
325 #include "casm/external/Eigen/Dense"
327 template <
typename Derived>
329 const MatrixBase<Derived> &value) {
330 for (
int i = 0; i < value.rows(); i++) {
331 for (
int j = 0; j < value.cols(); j++) {
332 _stream << value(i, j);
DataStream & operator<<(bool) override
DataStream & operator<<(double) override
CountDataStream(bool newline_reset=true)
DataStream & operator<<(long) override
DataStream & operator<<(const std::string &) override
DataStream & newline() override
DataStream & operator<<(char) override
DataStream & operator<<(DataStream &(*F)(DataStream &))
virtual DataStream & operator<<(double)
virtual DataStream & operator<<(const std::string &)
DataStream(DataStreamTraits _traits=none)
DataStream & operator<<(DataStreamTraits set_bits)
static DataStream & endl(DataStream &_strm)
virtual DataStream & operator<<(bool)
virtual DataStream & operator<<(long)
virtual DataStream & newline()
static std::function< DataStream &(DataStream &_strm)> failure(std::string const &_msg)
virtual DataStream & operator<<(char)
DataStream & operator<<(const std::function< DataStream &(DataStream &)> &F)
virtual DataStream & operator<<(jsonParser const &)
void _set_err_msg(std::string const &_msg)
std::string const & err_msg() const
DataStream & operator<<(bool val) override
DataStream & operator<<(const std::string &val) override
DataStream & operator<<(long val) override
ValueDataStream(DataStreamTraits _traits=none)
DataStream & operator<<(char val) override
DataStream & operator<<(double val) override
DataStream & operator<<(const std::string &val) override
VectorDataStream(DataStreamTraits _traits=none)
DataStream & operator<<(char val) override
DataStream & operator<<(double val) override
DataStream & operator<<(long val) override
DataStream & operator<<(bool val) override
std::vector< T > m_vector
const std::vector< T > & vector() const
std::ostream & operator<<(std::ostream &_stream, const FormattedPrintable &_formatted)
CASM::DataStream & operator<<(CASM::DataStream &_stream, const MatrixBase< Derived > &value)