sot-core  4.11.8
Hierarchical task solver plug-in for dynamic-graph.
contiifstream.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * François Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 #ifndef __SOT_CONTIIFSTREAM_HH__
11 #define __SOT_CONTIIFSTREAM_HH__
12 
13 /* --------------------------------------------------------------------- */
14 /* --- INCLUDE --------------------------------------------------------- */
15 /* --------------------------------------------------------------------- */
16 
17 #include <fstream>
18 #include <sstream>
19 #ifndef WIN32
20 #include <unistd.h>
21 #endif
22 #include <list>
23 
24 #include "sot/core/api.hh"
25 #ifndef WIN32
26 #include <pthread.h>
27 #endif
28 
29 namespace dynamicgraph {
30 namespace sot {
31 
32 /* --------------------------------------------------------------------- */
33 /* --- CLASS ----------------------------------------------------------- */
34 /* --------------------------------------------------------------------- */
36  protected:
37  std::string filename;
38  std::streamoff cursor;
39  static const unsigned int BUFFER_SIZE = 256;
40  char buffer[BUFFER_SIZE];
41  std::list<std::string> reader;
42  bool first;
43 
44  public: /* --- Constructor --- */
45  Contiifstream(const std::string &n = "");
47  void open(const std::string &n) {
48  filename = n;
49  cursor = 0;
50  }
51 
52  public: /* --- READ FILE --- */
53  bool loop(void);
54 
55  public: /* --- READ LIST --- */
56  inline bool ready(void) { return 0 < reader.size(); }
57  std::string next(void);
58 };
59 
60 } /* namespace sot */
61 } /* namespace dynamicgraph */
62 
63 #endif /* #ifndef __SOT_CONTIIFSTREAM_HH__ */
#define SOT_CORE_EXPORT
Definition: api.hh:20
Definition: contiifstream.hh:35
void open(const std::string &n)
Definition: contiifstream.hh:47
Contiifstream(const std::string &n="")
std::list< std::string > reader
Definition: contiifstream.hh:41
std::streamoff cursor
Definition: contiifstream.hh:38
std::string filename
Definition: contiifstream.hh:37
bool first
Definition: contiifstream.hh:42
bool ready(void)
Definition: contiifstream.hh:56
Definition: abstract-sot-external-interface.hh:17