TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
Public Types | Public Member Functions | List of all members
common::OMembuf Class Reference

A stream buffer for writing to an accessible vector of bytes. More...

#include <serialization.h>

Inherits streambuf.

Public Types

using int_type = typename std::streambuf::int_type
 

Public Member Functions

 OMembuf ()
 
std::vector< char > & data ()
 
std::vector< char > takeData ()
 
virtual int_type overflow (int_type ch=traits_type::eof())
 
virtual std::streamsize xsputn (char const *s, std::streamsize num)
 

Detailed Description

A stream buffer for writing to an accessible vector of bytes.

This can be used to construct a std::ostream as follows:

OMembuf mbuf;
std::ostream os(&mbuf);
// Write data to ostream as usual
os.flush();
auto& data = mbuf.data(); // Obtain data without extra copy

Member Typedef Documentation

using common::OMembuf::int_type = typename std::streambuf::int_type

Constructor & Destructor Documentation

common::OMembuf::OMembuf ( )
inline

Member Function Documentation

std::vector< char > & common::OMembuf::data ( )
OMembuf::int_type common::OMembuf::overflow ( int_type  ch = traits_type::eof())
virtual
std::vector< char > common::OMembuf::takeData ( )
std::streamsize common::OMembuf::xsputn ( char const *  s,
std::streamsize  num 
)
virtual

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