30 #ifndef FOREIGN_FIFO_BUFFER_HXX 31 #define FOREIGN_FIFO_BUFFER_HXX 93 return data ==
nullptr;
115 assert(_data !=
nullptr);
116 assert(_capacity > 0);
124 assert(new_capacity >=
tail -
head);
164 const size_type required_capacity = in_use + n;
213 std::copy_n(range.data, n, p);
226 size_t n = std::min(r.size, w.size);
228 std::move(r.data, r.data + n, w.data);
void Swap(ForeignFifoBuffer< T > &other)
ForeignFifoBuffer(ForeignFifoBuffer &&src)
void MoveBuffer(T *new_data, size_type new_capacity)
size_type Read(pointer_type p, size_type n)
constexpr ForeignFifoBuffer(std::nullptr_t n)
constexpr Range Read() const
Return a buffer range which may be read.
Range::pointer_type pointer_type
A reference to a memory area that is writable.
constexpr bool IsNull() const
bool WantWrite(size_type n)
void Consume(size_type n)
Marks a chunk as consumed.
constexpr size_type GetCapacity() const
ForeignFifoBuffer & operator=(ForeignFifoBuffer &&src)
Range::const_pointer_type const_pointer_type
Range Write()
Prepares writing.
A first-in-first-out buffer: you can append data at the end, and read data from the beginning...
void SetBuffer(T *_data, size_type _capacity)
constexpr bool IsDefined() const
constexpr ForeignFifoBuffer(T *_data, size_type _capacity)
constexpr size_type GetAvailable() const
void Append(size_type n)
Expands the tail of the buffer, after data has been written to the buffer returned by write()...
constexpr bool IsFull() const
constexpr bool IsEmpty() const
size_type MoveFrom(ForeignFifoBuffer< T > &src)
Move as much data as possible from the specified buffer.
const T * const_pointer_type
WritableBuffer< T > Range