Crashpad
 
Loading...
Searching...
No Matches
crashpad::LengthDelimitedRingBufferWriter< RingBufferDataType > Class Template Referencefinal

Writes variable-length data buffers to a RingBufferData, delimited by Base128 varint-encoded length delimiters. More...

#include "client/length_delimited_ring_buffer.h"

Public Member Functions

constexpr LengthDelimitedRingBufferWriter (RingBufferDataType &ring_buffer)
 Constructs a writer which holds a reference to ring_buffer.
 
 LengthDelimitedRingBufferWriter (const LengthDelimitedRingBufferWriter &)=delete
 
LengthDelimitedRingBufferWriteroperator= (const LengthDelimitedRingBufferWriter &)=delete
 
bool Push (const void *const buffer, typename RingBufferDataType::SizeType buffer_length)
 Writes data to the ring buffer.
 
void ResetForTesting ()
 Resets the state of the ring buffer and writer (e.g., for testing).
 

Detailed Description

template<typename RingBufferDataType>
class crashpad::LengthDelimitedRingBufferWriter< RingBufferDataType >

Writes variable-length data buffers to a RingBufferData, delimited by Base128 varint-encoded length delimiters.

Holds a reference to a RingBufferData with the capacity to hold RingBufferDataType::size() bytes of variable-length buffers each preceded by its length (encoded as a Base128 length varint).

Provides writing capabilities via Push().

Constructor & Destructor Documentation

◆ LengthDelimitedRingBufferWriter()

template<typename RingBufferDataType>
crashpad::LengthDelimitedRingBufferWriter< RingBufferDataType >::LengthDelimitedRingBufferWriter ( RingBufferDataType & ring_buffer)
inlineexplicitconstexpr

Constructs a writer which holds a reference to ring_buffer.

Parameters
[in]ring_bufferThe ring buffer into which data will be written. This object must outlive the lifetime of ring_buffer.

Member Function Documentation

◆ Push()

template<typename RingBufferDataType>
bool crashpad::LengthDelimitedRingBufferWriter< RingBufferDataType >::Push ( const void *const buffer,
typename RingBufferDataType::SizeType buffer_length )
inline

Writes data to the ring buffer.

If there is not enough room remaining in the ring buffer to store the new data, old data will be removed from the ring buffer in FIFO order until there is room for the new data.

Parameters
[in]bufferThe data to be written.
[in]buffer_lengthThe lengh of buffer, in bytes.
Returns
On success, returns true, updates ring_buffer.data_range to reflect the remaining data available to read, and updates ring_buffer_write_offset_ to reflec the current write positionl. Otherwise, returns false.

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