Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
AeonGames::BufferInputStream Class Reference

Zero-copy input stream that reads from a raw memory buffer. More...

#include <aeongames/ProtoBufHelpers.hpp>

Inheritance diagram for AeonGames::BufferInputStream:
Inheritance graph
Collaboration diagram for AeonGames::BufferInputStream:
Collaboration graph

Public Member Functions

 BufferInputStream (const void *aData, size_t aSize)
 Constructs a BufferInputStream over a memory region.
virtual ~BufferInputStream ()
 Destructor.
bool Next (const void **data, int *size) override
 Returns the next contiguous block of data from the buffer.
void BackUp (int count) override
 Backs up the read cursor by count bytes.
bool Skip (int count) override
 Skips forward count bytes in the buffer.
google::protobuf::int64 ByteCount () const override
 Returns the total number of bytes read from the buffer so far.

Detailed Description

Zero-copy input stream that reads from a raw memory buffer.

Implements the google::protobuf::io::ZeroCopyInputStream interface to allow Protocol Buffer parsing directly from memory without additional copies.

Definition at line 60 of file ProtoBufHelpers.hpp.

Constructor & Destructor Documentation

◆ BufferInputStream()

AeonGames::BufferInputStream::BufferInputStream ( const void * aData,
size_t aSize )
inline

Constructs a BufferInputStream over a memory region.

Parameters
aDataPointer to the start of the buffer.
aSizeSize of the buffer in bytes.

Definition at line 67 of file ProtoBufHelpers.hpp.

◆ ~BufferInputStream()

virtual AeonGames::BufferInputStream::~BufferInputStream ( )
inlinevirtual

Destructor.

Definition at line 72 of file ProtoBufHelpers.hpp.

Member Function Documentation

◆ BackUp()

void AeonGames::BufferInputStream::BackUp ( int count)
inlineoverride

Backs up the read cursor by count bytes.

Parameters
countNumber of bytes to back up. Clamped to the start of the buffer.

Definition at line 88 of file ProtoBufHelpers.hpp.

◆ ByteCount()

google::protobuf::int64 AeonGames::BufferInputStream::ByteCount ( ) const
inlineoverride

Returns the total number of bytes read from the buffer so far.

Returns
The number of bytes between the start and the current cursor position.

Definition at line 104 of file ProtoBufHelpers.hpp.

◆ Next()

bool AeonGames::BufferInputStream::Next ( const void ** data,
int * size )
inlineoverride

Returns the next contiguous block of data from the buffer.

Parameters
[out]dataSet to point to the next block of available data.
[out]sizeSet to the number of bytes available at data.
Returns
true if data was returned, false if the end of the buffer was reached with no data.

Definition at line 78 of file ProtoBufHelpers.hpp.

◆ Skip()

bool AeonGames::BufferInputStream::Skip ( int count)
inlineoverride

Skips forward count bytes in the buffer.

Parameters
countNumber of bytes to skip. Clamped to the end of the buffer.
Returns
true if more data remains after skipping, false if the end was reached.

Definition at line 96 of file ProtoBufHelpers.hpp.


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