OpenTTD Source 20241224-master-gf74b0cf984
MemoryDumper Struct Reference

Container for dumping the savegame (quickly) to memory. More...

Public Member Functions

void WriteByte (uint8_t b)
 Write a single byte into the dumper.
 
void Flush (std::shared_ptr< SaveFilter > writer)
 Flush this dumper into a writer.
 
size_t GetSize () const
 Get the size of the memory dump made so far.
 

Data Fields

std::vector< std::unique_ptr< uint8_t[]> > blocks {}
 Buffer with blocks of allocated memory.
 
uint8_t * buf = nullptr
 Buffer we're going to write to.
 
uint8_t * bufe = nullptr
 End of the buffer we write to.
 

Detailed Description

Container for dumping the savegame (quickly) to memory.

Definition at line 128 of file saveload.cpp.

Member Function Documentation

◆ Flush()

void MemoryDumper::Flush ( std::shared_ptr< SaveFilter writer)
inline

Flush this dumper into a writer.

Parameters
writerThe filter we want to use.

Definition at line 152 of file saveload.cpp.

References blocks, GetSize(), and MEMORY_CHUNK_SIZE.

◆ GetSize()

size_t MemoryDumper::GetSize ( ) const
inline

Get the size of the memory dump made so far.

Returns
The size.

Definition at line 171 of file saveload.cpp.

References blocks, and buf.

Referenced by Flush().

◆ WriteByte()

void MemoryDumper::WriteByte ( uint8_t  b)
inline

Write a single byte into the dumper.

Parameters
bThe byte to write.

Definition at line 137 of file saveload.cpp.

References blocks, and MEMORY_CHUNK_SIZE.

Field Documentation

◆ blocks

std::vector<std::unique_ptr<uint8_t[]> > MemoryDumper::blocks {}

Buffer with blocks of allocated memory.

Definition at line 129 of file saveload.cpp.

Referenced by Flush(), GetSize(), and WriteByte().

◆ buf

uint8_t* MemoryDumper::buf = nullptr

Buffer we're going to write to.

Definition at line 130 of file saveload.cpp.

Referenced by GetSize().

◆ bufe

uint8_t* MemoryDumper::bufe = nullptr

End of the buffer we write to.

Definition at line 131 of file saveload.cpp.


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