13 #ifndef Pythia8_Streams_H
14 #define Pythia8_Streams_H
36 class gzstreambuf :
public std::streambuf {
38 static const int bufferSize = 47+256;
42 char buffer[bufferSize]{};
48 gzstreambuf() : opened(0) {
49 setp( buffer, buffer + (bufferSize-1));
55 int is_open() {
return opened; }
56 gzstreambuf* open(
const char* name,
int open_mode);
58 ~gzstreambuf() { close(); }
60 virtual int overflow(
int c = EOF);
61 virtual int underflow();
67 class gzstreambase :
virtual public std::ios {
71 gzstreambase() { init(&buf); }
72 gzstreambase(
const char* name,
int open_mode);
74 void open(
const char* name,
int open_mode);
76 gzstreambuf* rdbuf() {
return &buf; }
87 class igzstream :
public gzstreambase,
public std::istream {
89 igzstream() : std::istream( &buf) {}
90 igzstream(
const char* name,
int mode = std::ios::in)
91 : gzstreambase( name, mode), std::istream( &buf) {}
92 gzstreambuf* rdbuf() {
return gzstreambase::rdbuf(); }
93 void open(
const char* name,
int mode = std::ios::in) {
94 gzstreambase::open( name, mode);
99 class ogzstream :
public gzstreambase,
public std::ostream {
101 ogzstream() : std::ostream( &buf) {}
102 ogzstream(
const char* name,
int mode = std::ios::out)
103 : gzstreambase( name, mode), std::ostream( &buf) {}
104 gzstreambuf* rdbuf() {
return gzstreambase::rdbuf(); }
105 void open(
const char* name,
int mode = std::ios::out) {
106 gzstreambase::open( name, mode);
113 typedef std::ifstream igzstream;
114 typedef std::ofstream ogzstream;
118 class DummyForStreams {
121 double xtox(
double x);
128 #endif // end Pythia8_Streams_H