Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_iostream_helpers.hpp
1// @HEADER
2// *****************************************************************************
3// Teuchos: Common Tools Package
4//
5// Copyright 2004 NTESS and the Teuchos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef TEUCHOS_IOSTREAM_HELPERS_HPP
11#define TEUCHOS_IOSTREAM_HELPERS_HPP
12
13
19#include "Teuchos_Assert.hpp"
20
21
22namespace Teuchos {
23
24
25template<class EnumType>
26std::istream& enumIstreamExtractor(std::istream& std_is, EnumType& enum_value)
27{
28 int intval;
29 std_is >> intval;
30 enum_value = static_cast<EnumType>(intval);
31 return std_is;
32}
33
34
35} // namespace Teuchos
36
37
38#define TEUCHOS_ENUM_INPUT_STREAM_OPERATOR(ENUMTYPE) \
39inline \
40std::istream& operator>>(std::istream& std_is, ENUMTYPE& enum_value) \
41{ return Teuchos::enumIstreamExtractor(std_is, enum_value); }
42
43
44#endif // TEUCHOS_IOSTREAM_HELPERS_HPP
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...