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

Chained buffer for IOCP. More...

#include <IOBuf.h>

Inheritance diagram for sese::iocp::IOBuf:
sese::io::InputStream sese::io::PeekableStream

Public Types

using Node = std::unique_ptr<IOBufNode>
 Type of node.
 
using ListType = std::list<Node>
 
- Public Types inherited from sese::io::InputStream
typedef std::shared_ptr< InputStreamPtr
 
- Public Types inherited from sese::io::PeekableStream
typedef std::shared_ptr< PeekableStreamPtr
 

Public Member Functions

void push (Node node)
 
void clear ()
 Release all nodes.
 
size_t getReadableSize () const noexcept
 Get the current readable size.
 
size_t getTotalSize () const noexcept
 Get the current total size of all node contents.
 
int64_t read (void *buffer, size_t length) override
 
int64_t peek (void *buffer, size_t length) override
 
int64_t trunc (size_t length) override
 
- Public Member Functions inherited from sese::io::InputStream
virtual ~InputStream () noexcept=default
 
- Public Member Functions inherited from sese::io::PeekableStream
virtual ~PeekableStream ()=default
 

Private Attributes

ListType list
 
ListType::iterator cur
 
size_t total {0}
 
size_t readed {0}
 

Detailed Description

Chained buffer for IOCP.

Member Typedef Documentation

◆ ListType

using sese::iocp::IOBuf::ListType = std::list<Node>

◆ Node

using sese::iocp::IOBuf::Node = std::unique_ptr<IOBufNode>

Type of node.

Member Function Documentation

◆ clear()

void sese::iocp::IOBuf::clear ( )

Release all nodes.

◆ getReadableSize()

size_t sese::iocp::IOBuf::getReadableSize ( ) const
nodiscardnoexcept

Get the current readable size.

◆ getTotalSize()

size_t sese::iocp::IOBuf::getTotalSize ( ) const
nodiscardnoexcept

Get the current total size of all node contents.

◆ peek()

int64_t sese::iocp::IOBuf::peek ( void * buffer,
size_t length )
overridevirtual

Peek at the content from one or more nodes

Parameters
bufferBuffer
lengthBuffer size
Returns
Actual size obtained

Implements sese::io::PeekableStream.

References sese::iocp::IOBufNode::buffer, sese::iocp::IOBufNode::getReadableSize(), sese::iocp::IOBufNode::read, and sese::iocp::IOBufNode::size.

Referenced by sese::_windows::iocp::v1::NativeContext::peek().

◆ push()

void sese::iocp::IOBuf::push ( Node node)

Add a new node. Once the node is added, it can no longer be modified externally

Parameters
nodeTarget node

◆ read()

int64_t sese::iocp::IOBuf::read ( void * buffer,
size_t length )
overridevirtual

Read content from one or more nodes

Parameters
bufferBuffer
lengthBuffer size
Returns
Actual size obtained

Implements sese::io::InputStream.

Referenced by sese::_windows::iocp::v1::NativeContext::read().

◆ trunc()

int64_t sese::iocp::IOBuf::trunc ( size_t length)
overridevirtual

Step through the content from one or more nodes

Parameters
lengthStep size
Returns
Actual step size

Implements sese::io::PeekableStream.

Referenced by sese::_windows::iocp::v1::NativeContext::trunc().

Member Data Documentation

◆ cur

ListType::iterator sese::iocp::IOBuf::cur
private

◆ list

ListType sese::iocp::IOBuf::list
private

◆ readed

size_t sese::iocp::IOBuf::readed {0}
private

◆ total

size_t sese::iocp::IOBuf::total {0}
private

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