ReFRACtor
filtering_fstream.h
Go to the documentation of this file.
1 #ifndef FILTERING_FSTREAM_H
2 #define FILTERING_FSTREAM_H
3 #include <fstream>
4 #include <boost/iostreams/filtering_stream.hpp>
5 
6 namespace FullPhysics {
7 /****************************************************************/
14 class FilteringOstream : public std::ostream {
15 public:
16  virtual ~FilteringOstream() {}
17 protected:
18 
19 //-----------------------------------------------------------------------
23 //-----------------------------------------------------------------------
24 
25  FilteringOstream(const std::string& Fname)
26  : std::ostream(&sb), f(Fname.c_str()) {}
27 
28 //-----------------------------------------------------------------------
30 //-----------------------------------------------------------------------
31 
32  std::ofstream f;
33 
34 //-----------------------------------------------------------------------
36 //-----------------------------------------------------------------------
37 
38  boost::iostreams::filtering_ostreambuf sb;
39 };
40 
41 /****************************************************************/
48 class FilteringIstream : public std::istream {
49 public:
50  virtual ~FilteringIstream() {}
51 protected:
52 
53 //-----------------------------------------------------------------------
57 //-----------------------------------------------------------------------
58 
59  FilteringIstream(const std::string& Fname)
60  : std::istream(&sb), f(Fname.c_str()) {}
61 
62 //-----------------------------------------------------------------------
64 //-----------------------------------------------------------------------
65 
66  std::ifstream f;
67 
68 //-----------------------------------------------------------------------
70 //-----------------------------------------------------------------------
71 
72  boost::iostreams::filtering_istreambuf sb;
73 };
74 }
75 #endif
boost::iostreams::filtering_istreambuf sb
Filtering streambuf.
std::ifstream f
Underlying ifstream.
STL namespace.
FilteringOstream(const std::string &Fname)
Constructor.
boost::iostreams::filtering_ostreambuf sb
Filtering streambuf.
This allows filtering stream to created on top of an underlying ifstream.
FilteringIstream(const std::string &Fname)
Constructor.
This allows filtering stream to created on top of an underlying ofstream.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
std::ofstream f
Underlying ofstream.

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:11