Pothos  0.3.3-g32d3017c
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
BufferAccumulator.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 #include <Pothos/Config.hpp>
15 #include <memory>
16 #include <cassert>
17 
18 namespace Pothos {
19 
32 {
33 public:
34 
36  BufferAccumulator(void);
37 
42  bool empty(void) const;
43 
48  void push(const BufferChunk &buffer);
49 
56  const BufferChunk &front(void) const;
57 
62  void pop(const size_t numBytes);
63 
65  size_t getTotalBytesAvailable(void) const;
66 
75  void require(const size_t numBytes);
76 
81  size_t getUniqueManagedBufferCount(void) const;
82 
83 private:
85  size_t _bytesAvailable;
86  struct Impl;
87  std::shared_ptr<Impl> _impl;
88 };
89 
90 } //namespace Pothos
91 
92 inline bool Pothos::BufferAccumulator::empty(void) const
93 {
94  return _bytesAvailable == 0;
95 }
96 
98 {
99  assert(not _queue.empty());
100  return _queue.front();
101 }
102 
104 {
105  return _bytesAvailable;
106 }
Definition: BufferAccumulator.hpp:31
const BufferChunk & front(void) const
Definition: BufferAccumulator.hpp:97
#define POTHOS_API
Definition: Config.hpp:41
Definition: RingDeque.hpp:28
bool empty(void) const
Definition: BufferAccumulator.hpp:92
Definition: BufferChunk.hpp:26
size_t getTotalBytesAvailable(void) const
Get the total number of bytes held in this accumulator.
Definition: BufferAccumulator.hpp:103