All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 <boost/scoped_ptr.hpp>
6 #include <vector>
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  boost::scoped_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  boost::scoped_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: