Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::io::FixedBuffer Class Referencefinal

Thread-safe fixed-size buffer. More...

#include <FixedBuffer.h>

Inheritance diagram for sese::io::FixedBuffer:
sese::io::AbstractFixedBuffer sese::io::Stream sese::io::PeekableStream sese::io::InputStream sese::io::OutputStream

Public Member Functions

 FixedBuffer (size_t size) noexcept
 
int64_t read (void *buffer, size_t length) override
 
int64_t write (const void *buffer, size_t length) override
 
int64_t peek (void *buffer, size_t length) override
 
int64_t trunc (size_t length) override
 
void reset () noexcept override
 
size_t getReadableSize () noexcept
 
size_t getWriteableSize () noexcept
 
- Public Member Functions inherited from sese::io::AbstractFixedBuffer
 AbstractFixedBuffer (size_t size) noexcept
 
 ~AbstractFixedBuffer () noexcept override
 
 AbstractFixedBuffer (const AbstractFixedBuffer &buffer) noexcept
 
 AbstractFixedBuffer (AbstractFixedBuffer &&buffer) noexcept
 
const char * data () const
 
size_t getSize () const noexcept
 
size_t getReadSize () const noexcept
 
size_t getWriteSize () const noexcept
 
size_t getReadableSize () const noexcept
 
size_t getWriteableSize () const noexcept
 
- Public Member Functions inherited from sese::io::InputStream
virtual ~InputStream () noexcept=default
 
- Public Member Functions inherited from sese::io::OutputStream
virtual ~OutputStream () noexcept=default
 
int64_t write (const std::string_view &buffer)
 
int64_t write (const text::StringView &buffer)
 
template<typename T >
int64_t write (std::vector< T > &buffer)
 
template<typename T , size_t N>
int64_t write (std::array< T, N > &buffer)
 
- Public Member Functions inherited from sese::io::PeekableStream
virtual ~PeekableStream ()=default
 

Private Attributes

std::mutex mutex
 

Additional Inherited Members

- Public Types inherited from sese::io::Stream
typedef std::shared_ptr< StreamPtr
 
- Public Types inherited from sese::io::InputStream
typedef std::shared_ptr< InputStreamPtr
 
- Public Types inherited from sese::io::OutputStream
typedef std::shared_ptr< OutputStreamPtr
 
- Public Types inherited from sese::io::PeekableStream
typedef std::shared_ptr< PeekableStreamPtr
 
- Protected Attributes inherited from sese::io::AbstractFixedBuffer
size_t size {}
 
size_t readSize {}
 
size_t writeSize {}
 
char * buffer {}
 

Detailed Description

Thread-safe fixed-size buffer.

Constructor & Destructor Documentation

◆ FixedBuffer()

sese::io::FixedBuffer::FixedBuffer ( size_t size)
explicitnoexcept

Member Function Documentation

◆ getReadableSize()

size_t sese::io::FixedBuffer::getReadableSize ( )
noexcept

◆ getWriteableSize()

size_t sese::io::FixedBuffer::getWriteableSize ( )
nodiscardnoexcept

◆ peek()

int64_t sese::io::FixedBuffer::peek ( void * buffer,
size_t length )
overridevirtual

Read content without stepping

Parameters
bufferBuffer
lengthBuffer size
Returns
Actual size read

Reimplemented from sese::io::AbstractFixedBuffer.

References sese::io::AbstractFixedBuffer::peek().

◆ read()

int64_t sese::io::FixedBuffer::read ( void * buffer,
size_t length )
overridevirtual

◆ reset()

void sese::io::FixedBuffer::reset ( )
overridevirtualnoexcept

◆ trunc()

int64_t sese::io::FixedBuffer::trunc ( size_t length)
overridevirtual

Step only, without reading content

Parameters
lengthStep size
Returns
Actual step size

Reimplemented from sese::io::AbstractFixedBuffer.

References sese::io::AbstractFixedBuffer::trunc().

◆ write()

int64_t sese::io::FixedBuffer::write ( const void * buffer,
size_t length )
overridevirtual

Member Data Documentation

◆ mutex

std::mutex sese::io::FixedBuffer::mutex
private

Referenced by read().


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