8 #ifndef FACEBOOK_NETWORK_BUFFER_QUEUE_H
9 #define FACEBOOK_NETWORK_BUFFER_QUEUE_H
40 typedef std::deque<Buffer>
Queue;
49 inline void push(
const void* data,
const size_t size);
72 inline size_t size()
const;
96 ocean_assert(data !=
nullptr);
101 memcpy(buffer.data(), data,
size);
103 queue_.emplace_back(std::move(buffer));
108 ocean_assert(!data.empty());
116 queue_.emplace_back(std::move(data));
This class implements a recursive lock object.
Definition: Lock.h:31
This class implements a thread-safe buffer queue.
Definition: BufferQueue.h:29
Buffer pop()
Pops a buffer from the queue.
Definition: BufferQueue.h:119
std::vector< uint8_t > Buffer
Definition of a vector holding bytes.
Definition: BufferQueue.h:35
bool isEmpty() const
Returns whether this queue holds no buffers.
Definition: BufferQueue.h:146
std::deque< Buffer > Queue
Definition of a double-ended queue holding buffers.
Definition: BufferQueue.h:40
void push(const void *data, const size_t size)
Pushes a new buffer to the queue.
Definition: BufferQueue.h:89
Lock lock_
The buffer lock.
Definition: BufferQueue.h:86
Queue queue_
The internal buffer queue.
Definition: BufferQueue.h:83
size_t size() const
Returns the number of buffers in this queue.
Definition: BufferQueue.h:140
void clear()
Clears the buffer queue.
Definition: BufferQueue.h:134
This class implements a scoped lock object for recursive lock objects.
Definition: Lock.h:135
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15