|
Dusk Audio Framework
|
#include <RingBuffer.hpp>
Public Member Functions | |
| bool | isDataAvailableForReading () const noexcept |
| bool | isEmpty () const noexcept |
| uint32_t | getSize () const noexcept |
| uint32_t | getReadableDataSize () const noexcept |
| uint32_t | getWritableDataSize () const noexcept |
| void | clearData () noexcept |
| void | flush () noexcept |
| bool | readBool () noexcept |
| uint8_t | readByte () noexcept |
| int16_t | readShort () noexcept |
| uint16_t | readUShort () noexcept |
| int32_t | readInt () noexcept |
| uint32_t | readUInt () noexcept |
| int64_t | readLong () noexcept |
| uint64_t | readULong () noexcept |
| float | readFloat () noexcept |
| double | readDouble () noexcept |
| bool | readCustomData (void *const data, const uint32_t size) noexcept |
| template<typename T> | |
| bool | readCustomType (T &type) noexcept |
| uint32_t | peekUInt () const noexcept |
| template<typename T> | |
| bool | peekCustomType (T &type) const noexcept |
| bool | writeBool (const bool value) noexcept |
| bool | writeByte (const uint8_t value) noexcept |
| bool | writeShort (const int16_t value) noexcept |
| bool | writeUShort (const uint16_t value) noexcept |
| bool | writeInt (const int32_t value) noexcept |
| bool | writeUInt (const uint32_t value) noexcept |
| bool | writeLong (const int64_t value) noexcept |
| bool | writeULong (const uint64_t value) noexcept |
| bool | writeFloat (const float value) noexcept |
| bool | writeDouble (const double value) noexcept |
| bool | writeCustomData (const void *const data, const uint32_t size) noexcept |
| template<typename T> | |
| bool | writeCustomType (const T &type) noexcept |
| bool | commitWrite (const char *const debugMsg=nullptr) noexcept |
| void | setRingBuffer (BufferStruct *const ringBuf, const bool clearRingBufferData) noexcept |
| bool | isDataAvailableForReading () const noexcept |
DAF built-in RingBuffer class. RingBufferControl takes one buffer struct to take control over, and operates over it.
This is meant for single-writer, single-reader type of control. Writing and reading is wait and lock-free.
Typically usage involves:
|
inlinenoexcept |
Read an arbitrary amount of data, specified by size. data pointer must be non-null, and size > 0.
Returns true if reading succeeds. In case of failure, data pointer is automatically cleared by size bytes.
|
inlinenoexcept |
Read a custom data type specified by the template typename used, with size being automatically deduced by the compiler (through the use of sizeof).
Returns true if reading succeeds. In case of failure, type value is automatically cleared by its deduced size.
|
inlinenoexcept |
Peek for a custom data type specified by the template typename used, with size being automatically deduced by the compiler (through the use of sizeof).
Returns true if peeking succeeds. In case of failure, type value is automatically cleared by its deduced size.
|
inlinenoexcept |
Write an arbitrary amount of data, specified by size. data pointer must be non-null, and size > 0.
|
inlinenoexcept |
Write a custom data type specified by the template typename used, with size being automatically deduced by the compiler (through the use of sizeof).
|
inlinenoexcept |
Commit all previous write operations to the ringbuffer. If a write operation has previously failed, this will reset/invalidate the previous write attempts.