// Copyright Jean Pierre Cimalando 2018. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE or copy at // http://www.boost.org/LICENSE_1_0.txt) #include "ring_buffer.h" template inline size_t Ring_Buffer_Ex::capacity() const { return cap_ - 1; } //------------------------------------------------------------------------------ template template inline bool Basic_Ring_Buffer::get(T &x) { return get(&x, 1); } template template inline bool Basic_Ring_Buffer::get(T *x, size_t n) { // static_assert(std::is_trivially_copyable::value, "ring_buffer: T must be trivially copyable"); RB *self = static_cast(this); return self->getbytes_(x, n * sizeof(T)); } template template inline bool Basic_Ring_Buffer::peek(T &x) { return peek(&x, 1); } template template inline bool Basic_Ring_Buffer::peek(T *x, size_t n) { // static_assert(std::is_trivially_copyable::value, "ring_buffer: T must be trivially copyable"); RB *self = static_cast(this); return self->peekbytes_(x, n * sizeof(T)); } template template inline bool Basic_Ring_Buffer::put(const T &x) { return put(&x, 1); } template template inline bool Basic_Ring_Buffer::put(const T *x, size_t n) { // static_assert(std::is_trivially_copyable::value, "ring_buffer: T must be trivially copyable"); RB *self = static_cast(this); return self->putbytes_(x, n * sizeof(T)); }