C/C++ API Reference
Loading...
Searching...
No Matches
pw::trace::TraceBuffer Class Reference

Overview

Adapter type that allows using an InlineVarLenEntryQueue with code that expects a PrefixedEntryRingBufferMulti. This type only partially implements the latter's interface. In particular, it implements those methods used by callers of pw::trace::GetBuffer.

Public Member Functions

InlineVarLenEntryQueuequeue ()
 
constexpr Status PeekFront (ByteSpan data, size_t *bytes_read_out) const
 
constexpr Status PopFront ()
 
constexpr size_t EntryCount () const
 Get the number of variable-length entries currently in the ring buffer.
 
constexpr Status CheckForCorruption ()
 
constexpr void Clear ()
 Removes all data from the ring buffer.
 
constexpr size_t TotalUsedBytes () const
 Get the size in bytes of all the current entries in the ring buffer.
 

Friends

class ::pw::trace::internal::TraceBufferImpl
 

Member Function Documentation

◆ CheckForCorruption()

constexpr Status pw::trace::TraceBuffer::CheckForCorruption ( )
inlineconstexpr

Determines if the ring buffer has corrupted entries.

This method is kept strictly for compatibility reasons. As long as access to this object is properly synchronized, it should not be possible to corrupt the queue through its public API.

◆ PeekFront()

constexpr Status pw::trace::TraceBuffer::PeekFront ( ByteSpan  data,
size_t *  bytes_read_out 
) const
constexpr

Read the oldest stored data chunk of data from the ring buffer to the provided destination span. The number of bytes read is written to bytes_read

Returns
@Status
  • OK: Data successfully read from the ring buffer.
  • OUT_OF_RANGE: No entries in ring buffer to pop.
  • RESOURCE_EXHAUSTED - Destination data span was smaller number of bytes than the data size of the data chunk being read. Available destination bytes were filled, remaining bytes of the data chunk were ignored.

◆ PopFront()

constexpr Status pw::trace::TraceBuffer::PopFront ( )
constexpr

Pop and discard the oldest stored data chunk of data from the ring buffer.

Returns
@Status
  • OK: Data successfully read from the ring buffer.
  • OUT_OF_RANGE: No entries in ring buffer to pop.

The documentation for this class was generated from the following file: