QNANO
Random_Access_Reader.h
1 #ifndef QNANO_NEW_DISTRIBUTE_SEQUENTIAL_READER_DEFINED_H
2 #define QNANO_NEW_DISTRIBUTE_SEQUENTIAL_READER_DEFINED_H
3 
4 #include "tools/Reader.h"
5 
30 protected:
31  bool was_setup;
32 public:
34  std::ifstream ifs;
36  std::streampos startpos;
38  int lastline;
40  std::string lastline_string;
41 
42  std::string get_line(int local_line_nr);
43 
44  void setup(const std::string &filename, std::streampos spos){
45  startpos=spos;
46  was_setup=true;
47  lastline=-1;
48  Reader::check_open(ifs, filename);
49  }
50  Random_Access_Reader() : was_setup(false){
51  }
52  Random_Access_Reader(const std::string &filename, std::streampos spos){
53  setup(filename, spos);
54  }
55 };
56 
57 #endif
Definition: Random_Access_Reader.h:29
std::streampos startpos
position in stream corresponding to starting point for the present thread
Definition: Random_Access_Reader.h:36
int lastline
Number of last processed line; check if we have to seek position or not.
Definition: Random_Access_Reader.h:38
std::ifstream ifs
input stream: only closed on destruction:
Definition: Random_Access_Reader.h:34
std::string lastline_string
String value of last line; good for reading IA files.
Definition: Random_Access_Reader.h:40