Bond
 
Loading...
Searching...
No Matches
bond::OutputMemoryStream< A > Class Template Reference

Memory backed output stream. More...

Public Member Functions

 OutputMemoryStream (const A &allocator=A())
 Construct OutputMemoryStream using specified allocator instance. More...
 
 OutputMemoryStream (const boost::shared_ptr< char[]> &buffer, uint32_t size, uint32_t reserveBlobs=128, const A &allocator=A(), uint32_t minChanningSize=32, uint32_t maxChainLength=(uint32_t) -1)
 Construct OutputMemoryStream from the first buffer of the specified size and a preallocated vector to store additional buffers. More...
 
 OutputMemoryStream (uint32_t reserveSize, uint32_t reserveBlobs=128, const A &allocator=A(), uint32_t minChanningSize=32, uint32_t maxChainLength=(uint32_t) -1)
 Construct OutputMemoryStream with the first buffer of the specified size and a preallocated vector to store additional buffers. More...
 
template<typename T >
void GetBuffers (T &buffers) const
 Get content of the stream as a collection of memory blobs. More...
 
blob GetBuffer () const
 Get content of the stream as one contiguous memory blob. More...
 

Detailed Description

template<typename A = std::allocator<char>>
class bond::OutputMemoryStream< A >

Memory backed output stream.

Constructor & Destructor Documentation

◆ OutputMemoryStream() [1/3]

template<typename A = std::allocator<char>>
bond::OutputMemoryStream< A >::OutputMemoryStream ( const A &  allocator = A())
explicit

Construct OutputMemoryStream using specified allocator instance.

◆ OutputMemoryStream() [2/3]

template<typename A = std::allocator<char>>
bond::OutputMemoryStream< A >::OutputMemoryStream ( const boost::shared_ptr< char[]> &  buffer,
uint32_t  size,
uint32_t  reserveBlobs = 128,
const A &  allocator = A(),
uint32_t  minChanningSize = 32,
uint32_t  maxChainLength = (uint32_t)-1 
)
explicit

Construct OutputMemoryStream from the first buffer of the specified size and a preallocated vector to store additional buffers.

◆ OutputMemoryStream() [3/3]

template<typename A = std::allocator<char>>
bond::OutputMemoryStream< A >::OutputMemoryStream ( uint32_t  reserveSize,
uint32_t  reserveBlobs = 128,
const A &  allocator = A(),
uint32_t  minChanningSize = 32,
uint32_t  maxChainLength = (uint32_t)-1 
)
explicit

Construct OutputMemoryStream with the first buffer of the specified size and a preallocated vector to store additional buffers.

Member Function Documentation

◆ GetBuffer()

template<typename A = std::allocator<char>>
blob bond::OutputMemoryStream< A >::GetBuffer ( ) const

Get content of the stream as one contiguous memory blob.

The function may need to allocate memory and perform memcpy.

◆ GetBuffers()

template<typename A = std::allocator<char>>
template<typename T >
void bond::OutputMemoryStream< A >::GetBuffers ( T &  buffers) const

Get content of the stream as a collection of memory blobs.

Remarks
The provided collection must have reserve, assign and emplace_back functions