libqi-api  2.1.4.13
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
bufferreader.hpp
Go to the documentation of this file.
1 #pragma once
2 /*
3 ** Copyright (C) 2012 Aldebaran Robotics
4 ** See COPYING for the license
5 */
6 
7 #ifndef _QI_BUFFERREADER_HPP_
8 #define _QI_BUFFERREADER_HPP_
9 
10 #include <qi/buffer.hpp>
11 
12 namespace qi {
13 
16  {
17  public:
19  explicit BufferReader(const Buffer& buf);
21  ~BufferReader();
23  size_t read(void *data, size_t length);
24 
26  void *read(size_t offset);
28  bool seek(size_t offset);
30  void *peek(size_t offset) const;
31 
33  bool hasSubBuffer() const;
35  const Buffer& subBuffer();
37  size_t position() const;
38 
39  private:
40  Buffer _buffer;
41  size_t _cursor;
42  size_t _subCursor; // position in sub-buffers
43  };
44 }
45 
46 #endif // _QI_BUFFERREADER_HPP_
Class to read const buffer.
Class to store buffer.
Definition: buffer.hpp:26
#define QI_API
Definition: api.hpp:24