Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
RingBuffer.cpp
Go to the documentation of this file.
1
2
4
5namespace Divide {
6
7RingBufferSeparateWrite::RingBufferSeparateWrite(const U16 queueLength, const bool separateReadWrite, const bool writeAhead) noexcept
8 : _queueLength(std::max(queueLength, U16_ONE)),
9 _writeAhead(writeAhead),
10 _separateReadWrite(separateReadWrite)
11{
12}
13
14void RingBufferSeparateWrite::resize(const U16 queueLength) {
15 if (_queueLength != std::max(queueLength, U16_ONE)) {
16 _queueLength = std::max(queueLength, U16_ONE);
17 _queueIndex = to_I32(std::min(to_U32(_queueIndex.load()), _queueLength - 1u));
18 }
19}
20
21RingBuffer::RingBuffer(const U16 queueLength) noexcept :
22 _queueLength(std::max(queueLength, U16_ONE))
23{
24 _queueIndex = 0;
25}
26
27void RingBuffer::resize(const U16 queueLength) noexcept {
28 _queueLength = std::max(queueLength, U16_ONE);
29 _queueIndex = 0;
30}
31
32} //namespace Divide
virtual void resize(U16 queueLength) noexcept
Definition: RingBuffer.cpp:27
RingBuffer(U16 queueLength) noexcept
Definition: RingBuffer.cpp:21
virtual void resize(U16 queueLength)
Definition: RingBuffer.cpp:14
RingBufferSeparateWrite(U16 queueLength, bool separateReadWrite, bool writeAhead=true) noexcept
Definition: RingBuffer.cpp:7
U16 queueLength() const noexcept
Definition: RingBuffer.h:46
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
constexpr U32 to_U32(const T value)
uint16_t U16
constexpr U16 U16_ONE
constexpr I32 to_I32(const T value)