Sese Framework  x.y.z
A cross-platform framework
载入中...
搜索中...
未找到
sese::io::AbstractByteBuffer类 参考

字节缓冲区类 更多...

#include <AbstractByteBuffer.h>

类 sese::io::AbstractByteBuffer 继承关系图:
sese::io::Stream sese::io::PeekableStream sese::io::InputStream sese::io::OutputStream sese::io::ByteBuffer sese::io::ByteBuilder

struct  Node
 缓冲节点 更多...
 

Public 成员函数

 AbstractByteBuffer (size_t base_size=STREAM_BYTE_STREAM_SIZE_FACTOR, size_t factor=STREAM_BYTE_STREAM_SIZE_FACTOR)
 
 AbstractByteBuffer (const AbstractByteBuffer &abstract_byte_buffer) noexcept
 拷贝
 
 AbstractByteBuffer (AbstractByteBuffer &&abstract_byte_buffer) noexcept
 移动语义
 
 ~AbstractByteBuffer () override
 析构
 
virtual void resetPos ()
 重置读取位置
 
virtual bool eof ()
 是否有可读数据
 
virtual size_t getLength () const
 
virtual size_t getCapacity () const
 
virtual size_t getReadableSize () const
 
virtual size_t freeCapacity ()
 
virtual void swap (AbstractByteBuffer &other) noexcept
 
int64_t read (void *buffer, size_t len) override
 
int64_t write (const void *buffer, size_t len) override
 
int64_t peek (void *buffer, size_t len) override
 
int64_t trunc (size_t need_read) override
 
- Public 成员函数 继承自 sese::io::InputStream
virtual ~InputStream () noexcept=default
 
- Public 成员函数 继承自 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 成员函数 继承自 sese::io::PeekableStream
virtual ~PeekableStream ()=default
 

Private 属性

size_t factor = 0
 
Noderoot = nullptr
 
NodecurrentWriteNode = nullptr
 
size_t currentWritePos = 0
 
NodecurrentReadNode = nullptr
 
size_t currentReadPos = 0
 
size_t length = 0
 
size_t cap = 0
 

额外继承的成员函数

- Public 类型 继承自 sese::io::Stream
typedef std::shared_ptr< StreamPtr
 
- Public 类型 继承自 sese::io::InputStream
typedef std::shared_ptr< InputStreamPtr
 
- Public 类型 继承自 sese::io::OutputStream
typedef std::shared_ptr< OutputStreamPtr
 
- Public 类型 继承自 sese::io::PeekableStream
typedef std::shared_ptr< PeekableStreamPtr
 

详细描述

字节缓冲区类

构造及析构函数说明

◆ AbstractByteBuffer() [1/3]

sese::io::AbstractByteBuffer::AbstractByteBuffer ( size_t base_size = STREAM_BYTE_STREAM_SIZE_FACTOR,
size_t factor = STREAM_BYTE_STREAM_SIZE_FACTOR )
explicit
参数
base_size初始节点内存大小
factor追加内存节点大小

引用了 cap, currentReadNode, currentWriteNode, factor , 以及 root.

◆ AbstractByteBuffer() [2/3]

sese::io::AbstractByteBuffer::AbstractByteBuffer ( const AbstractByteBuffer & abstract_byte_buffer)
noexcept

◆ AbstractByteBuffer() [3/3]

sese::io::AbstractByteBuffer::AbstractByteBuffer ( AbstractByteBuffer && abstract_byte_buffer)
noexcept

◆ ~AbstractByteBuffer()

sese::io::AbstractByteBuffer::~AbstractByteBuffer ( )
override

析构

引用了 sese::io::AbstractByteBuffer::Node::next , 以及 root.

成员函数说明

◆ eof()

bool sese::io::AbstractByteBuffer::eof ( )
virtual

◆ freeCapacity()

size_t sese::io::AbstractByteBuffer::freeCapacity ( )
virtual

释放 CurrentReadNode 前的所有节点

返回
实际释放空间,单位 “字节”

sese::io::ByteBuffer 重载.

引用了 sese::io::AbstractByteBuffer::Node::cap, currentReadNode, currentReadPos, currentWriteNode, currentWritePos, sese::io::AbstractByteBuffer::Node::length, sese::io::AbstractByteBuffer::Node::next , 以及 root.

被这些函数引用 sese::io::ByteBuffer::freeCapacity().

◆ getCapacity()

size_t sese::io::AbstractByteBuffer::getCapacity ( ) const
nodiscardvirtual
返回
所有节点容量总数

sese::io::ByteBuffer 重载.

引用了 cap.

被这些函数引用 sese::io::ByteBuffer::getCapacity().

◆ getLength()

size_t sese::io::AbstractByteBuffer::getLength ( ) const
nodiscardvirtual

◆ getReadableSize()

size_t sese::io::AbstractByteBuffer::getReadableSize ( ) const
nodiscardvirtual

◆ peek()

◆ read()

◆ resetPos()

void sese::io::AbstractByteBuffer::resetPos ( )
virtual

◆ swap()

void sese::io::AbstractByteBuffer::swap ( AbstractByteBuffer & other)
virtualnoexcept

◆ trunc()

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

◆ write()

类成员变量说明

◆ cap

size_t sese::io::AbstractByteBuffer::cap = 0
private

◆ currentReadNode

Node* sese::io::AbstractByteBuffer::currentReadNode = nullptr
private

◆ currentReadPos

size_t sese::io::AbstractByteBuffer::currentReadPos = 0
private

◆ currentWriteNode

Node* sese::io::AbstractByteBuffer::currentWriteNode = nullptr
private

◆ currentWritePos

size_t sese::io::AbstractByteBuffer::currentWritePos = 0
private

◆ factor

size_t sese::io::AbstractByteBuffer::factor = 0
private

被这些函数引用 AbstractByteBuffer(), AbstractByteBuffer() , 以及 write().

◆ length

size_t sese::io::AbstractByteBuffer::length = 0
private

length 不计算最后一个 Node 的,真实长度应为 realLength = length + currentWriteNode->length

被这些函数引用 AbstractByteBuffer(), getLength(), swap() , 以及 write().

◆ root

Node* sese::io::AbstractByteBuffer::root = nullptr
private

该类的文档由以下文件生成: