Class OutputFile

Class Documentation

class mgb::serialization::OutputFile

abstract output file interface

Public Functions

~OutputFile() = default
void write(const void *src, size_t size) = 0

write buffer to file

void seek(size_t offset) = 0

seek to absolute position in bytes

size_t tell() = 0

return current write offset

Public Static Functions

std::unique_ptr<OutputFile> make_fs(const char *path, char mode = 'w')

create an OutputFile correspoding to a file on local file system

std::unique_ptr<OutputFile> make_vector_proxy(std::vector<uint8_t> *buf)

create an OutputFile to write to a std::vector

Note that the vector must be alive throughout lifespan of this OutputFile. Current content in buf would not be cleared.