This is the documentation for Enlighten.

class Geo RingBuffer

class Geo::RingBuffer

Ring Buffer class.

Stores values of any type in a fixed length buffer. Thread safe for single writer single reader only.

Classes

Name Description
Geo::RingBuffer::ReadContext

Write context type, which allows efficient and safe reading.

Geo::RingBuffer::WriteContext

Write context type, which allows efficient and safe writing.

Functions

Name Description
GetMaxBlockedDurationTicks()

Return the maximum duration that the writing thread was blocked due to the buffer being full.

GetNumBlockedWrites()

Return the number of recorded blocked writes.

HasData()

Do we have any data to read?

RecordBlockedDuration(s64)

Record that the writing thread was blocked due to the buffer being full.

ResetBlockedWritesCounter()

Reset the counters which keep track of # of times buffer writes are blocked.

RingBuffer(u32, const u32)

Construct a new ring buffer with the given size and maximum allocation alignment.

Write(T &&)

Helper function to write an object to the buffer.


Geo::s64 Geo::RingBuffer::GetMaxBlockedDurationTicks


public: Geo::s64 GetMaxBlockedDurationTicks() const


Return the maximum duration that the writing thread was blocked due to the buffer being full.


Geo::s32 Geo::RingBuffer::GetNumBlockedWrites


public: Geo::s32 GetNumBlockedWrites() const


Return the number of recorded blocked writes.


bool Geo::RingBuffer::HasData


public: bool HasData() const


Do we have any data to read?


void Geo::RingBuffer::RecordBlockedDuration


public: void RecordBlockedDuration
(
    s64 durationTicks
)


Record that the writing thread was blocked due to the buffer being full.


void Geo::RingBuffer::ResetBlockedWritesCounter


public: void ResetBlockedWritesCounter()


Reset the counters which keep track of # of times buffer writes are blocked.


Geo::RingBuffer::RingBuffer


public: RingBuffer
(
    u32 size,
    const u32 maxAlignment
)


Construct a new ring buffer with the given size and maximum allocation alignment.

Size must


be a power of two.


void Geo::RingBuffer::Write


public: void Write
(
    T && data
)


Helper function to write an object to the buffer.

Not necessarily the most efficient way, as it uses the default alignment of the buffer.