My Project
binaryIO.h
Go to the documentation of this file.
1 /* binaryIO.h
2  */
3 #ifndef OSL_BINARYIO_H
4 #define OSL_BINARYIO_H
5 #include <vector>
6 #include <memory>
7 #include <iosfwd>
8 
9 namespace osl
10 {
11  namespace misc
12  {
13  struct BinaryWriter
14  {
15  static void write(std::ostream&, const std::vector<int>& data);
16  static void write(std::ostream&, const std::vector<double>& data);
17  };
18  template <class T>
20  {
21  public:
22  explicit BinaryReader(std::istream& is);
23  ~BinaryReader();
24 
25  bool read(std::vector<T>& data);
26  static size_t blockSize();
27  private:
28  struct State;
29  std::unique_ptr<State> state;
30  };
31 
32  template <class T>
34  {
35  public:
36  explicit BinaryElementReader(std::istream& is);
38 
39  T read();
40  bool hasNext() const;
41  bool failed() const;
42  private:
43  struct State;
44  std::unique_ptr<State> state;
45  };
46  }
47 }
48 
49 #endif /* OSL_BINARYIO_H */
50 // ;;; Local Variables:
51 // ;;; mode:c++
52 // ;;; c-basic-offset:2
53 // ;;; End:
BinaryElementReader(std::istream &is)
Definition: binaryIO.cc:141
std::unique_ptr< State > state
Definition: binaryIO.h:43
std::unique_ptr< State > state
Definition: binaryIO.h:28
static size_t blockSize()
Definition: binaryIO.cc:96
BinaryReader(std::istream &is)
Definition: binaryIO.cc:55
bool read(std::vector< T > &data)
Definition: binaryIO.cc:90
static void write(std::ostream &, const std::vector< int > &data)
Definition: binaryIO.cc:43