Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_IosAllSaver.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Panzer: A partial differential equation assembly
4 // engine for strongly coupled complex multiphysics systems
5 //
6 // Copyright 2011 NTESS and the Panzer contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
11 // *******************************************************************
12 // This file contains a copy of one function from the io state saver
13 // code from boost. Modified to use the panzer namespace and remove
14 // locale support. Boost copyright is below.
15 // *******************************************************************
16 
17 // Copyright 2002, 2005 Daryle Walker. Use, modification, and distribution
18 // are subject to the Boost Software License, Version 1.0. (See accompanying
19 // file LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
20 
21 // See <http://www.boost.org/libs/io/> for the library's home page.
22 
23 // *******************************************************************
24 // *******************************************************************
25 
26 #ifndef PANZER_IOS_ALL_SAVER_HPP
27 #define PANZER_IOS_ALL_SAVER_HPP
28 
29 #include "PanzerDiscFE_config.hpp"
30 #include <iomanip>
31 #include <iosfwd> // for std::char_traits (declaration)
32 
33 namespace panzer {
34 
35  template < typename Ch, class Tr = ::std::char_traits<Ch> >
37 
40 
41  template < typename Ch, class Tr >
43  {
44  public:
45  typedef ::std::basic_ios<Ch, Tr> state_type;
46 
48  : s_save_( s ), a1_save_( s.flags() ), a2_save_( s.precision() )
49  , a3_save_( s.width() ), a4_save_( s.rdstate() )
50  , a5_save_( s.exceptions() ), a6_save_( s.tie() )
51  , a7_save_( s.rdbuf() ), a8_save_( s.fill() )
52  {}
53 
55  { this->restore(); }
56 
57  void restore()
58  {
59  s_save_.fill( a8_save_ );
60  s_save_.rdbuf( a7_save_ );
61  s_save_.tie( a6_save_ );
62  s_save_.exceptions( a5_save_ );
63  s_save_.clear( a4_save_ );
64  s_save_.width( a3_save_ );
65  s_save_.precision( a2_save_ );
66  s_save_.flags( a1_save_ );
67  }
68 
69  private:
71  typename state_type::fmtflags const a1_save_;
72  ::std::streamsize const a2_save_;
73  ::std::streamsize const a3_save_;
74  typename state_type::iostate const a4_save_;
75  typename state_type::iostate const a5_save_;
76  ::std::basic_ostream<Ch, Tr> * const a6_save_;
77  ::std::basic_streambuf<Ch, Tr> * const a7_save_;
78  typename state_type::char_type const a8_save_;
79 
81  };
82 
83 }
84 
85 #endif
basic_ios_all_saver< wchar_t > wios_all_saver
basic_ios_all_saver & operator=(const basic_ios_all_saver &)
state_type::char_type const a8_save_
basic_ios_all_saver< char > ios_all_saver
::std::basic_ios< Ch, Tr > state_type
::std::streamsize const a2_save_
state_type::fmtflags const a1_save_
state_type::iostate const a4_save_
::std::streamsize const a3_save_
state_type::iostate const a5_save_
::std::basic_ostream< Ch, Tr > *const a6_save_
::std::basic_streambuf< Ch, Tr > *const a7_save_