Pothos  0.4.3-gabce2ce6
The Pothos dataflow programming software suite
BufferAccumulator.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 #include <Pothos/Config.hpp>
16 #include <cassert>
17 
18 namespace Pothos {
19 
32 {
33 public:
34 
36  BufferAccumulator(void);
37 
39  void clear(void);
40 
45  bool empty(void) const;
46 
51  void push(const BufferChunk &buffer);
52 
59  const BufferChunk &front(void) const;
60 
65  void pop(const size_t numBytes);
66 
68  size_t getTotalBytesAvailable(void) const;
69 
78  void require(const size_t numBytes);
79 
84  size_t getUniqueManagedBufferCount(void) const;
85 
86 private:
88  size_t _bytesAvailable;
89  bool _inPoolBuffer;
90  BufferPool _pool;
91 };
92 
93 } //namespace Pothos
94 
95 inline bool Pothos::BufferAccumulator::empty(void) const
96 {
97  return _bytesAvailable == 0;
98 }
99 
101 {
102  assert(not _queue.empty());
103  return _queue.front();
104 }
105 
107 {
108  return _bytesAvailable;
109 }
Definition: BufferAccumulator.hpp:31
const BufferChunk & front(void) const
Definition: BufferAccumulator.hpp:100
#define POTHOS_API
Definition: Config.hpp:41
Definition: CallInterface.hpp:15
Definition: RingDeque.hpp:29
Definition: BufferPool.hpp:24
bool empty(void) const
Definition: BufferAccumulator.hpp:95
Definition: BufferChunk.hpp:30
size_t getTotalBytesAvailable(void) const
Get the total number of bytes held in this accumulator.
Definition: BufferAccumulator.hpp:106