Roomba App  1.0
frameBuffer.hh
Go to the documentation of this file.
1 
17 #ifndef FRAMEBUFFER_HH
18 #define FRAMEBUFFER_HH
19 
20 #include <list>
21 #include <mutex>
22 #include <string>
23 #include <thread>
24 
29 {
30  std::list<std::string> _frameList;
31  mutable std::mutex _access;
32  static constexpr int _MAX_LIST_SIZE = 10;
33 
34  public:
40  FrameBuffer() = default;
41 
47  ~FrameBuffer() = default;
48 
53  void addFrame(const std::string& frame);
54 
62  bool getFrame(std::string& frame);
63 
70  bool isFrame() const;
71 };
72 
73 #endif /* FRAMEBUFFER_HH */
Class implementing circular buffer.
Definition: frameBuffer.hh:29
static constexpr int _MAX_LIST_SIZE
Max circular buffer size.
Definition: frameBuffer.hh:32
bool isFrame() const
Check if there is any frame in a circular buffer.
Definition: frameBuffer.cpp:42
std::list< std::string > _frameList
List containing individual frames.
Definition: frameBuffer.hh:30
std::mutex _access
Mutex that provides single access to the list.
Definition: frameBuffer.hh:31
void addFrame(const std::string &frame)
Add one frame at the end of list.
Definition: frameBuffer.cpp:19
~FrameBuffer()=default
Destroy the FrameBuffer object.
FrameBuffer()=default
Construct a new FrameBuffer object.
bool getFrame(std::string &frame)
Get one frame from the top of the list.
Definition: frameBuffer.cpp:30