mapgd  0.4
A program for the Maximum-likelihood analysis of population genomic data.
 All Data Structures Functions Variables Friends Groups Pages
tmp_buffer.h
1 #include <iostream>
2 #include <sstream>
3 #include <string>
4 #include <cstring>
5 
6 #ifndef TMP_BUFFER_H
7 #define TMP_BUFFER_H
8 
9 #ifndef EOF
10 #define EOF -1
11 #endif
12 
13 #ifndef READ
14 #define READ std::ios::in
15 #endif
16 
17 class Tmp_streambuf : public std::streambuf {
18  private:
19  bool _opened;
20  int _mode;
21  char c;
22  std::istream *_src;
23  std::istream **_dest;
24  std::stringstream _buffer;
25  public:
26  bool buffered, reread;
27  Tmp_streambuf();
28  Tmp_streambuf * open(std::istream **dest, std::istream *src);
29  virtual int underflow();
30  bool is_open(void);
31  Tmp_streambuf * close(void);
32  ~Tmp_streambuf();
33  void clear_read();
34 };
35 
36 /***/
37 class Tmp_buffer : public std::istream {
38 
39  private:
40 
41  Tmp_streambuf _spool;
42 
43  protected:
44  public:
45 
46  Tmp_buffer (void) : std::istream(NULL){};
47  ~Tmp_buffer (void){};
48 
49  Tmp_buffer (std::istream **dest, std::istream *src);
50  void open(std::istream **dest, std::istream *src);
51  void buffer_on (void) {_spool.buffered=true;};
52  void buffer_off (void) {_spool.buffered=false;};
53  void reread_on (void) {_spool.reread=true;};
54  void reread_off (void) {_spool.reread=false;};
55  void clear_read();
56 };
57 #endif
Definition: tmp_buffer.h:17
Definition: tmp_buffer.h:37