All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ndn::OBufferStream Struct Reference

Class implementing interface similar to ostringstream, but to construct ndn::Buffer. More...

#include <buffer.hpp>

Inheritance diagram for ndn::OBufferStream:
[legend]
Collaboration diagram for ndn::OBufferStream:
[legend]

Public Member Functions

 OBufferStream ()
 Default constructor. More...
 
ptr_lib::shared_ptr< Bufferbuf ()
 Flush written data to the stream and return shared pointer to the underlying buffer. More...
 

Detailed Description

Class implementing interface similar to ostringstream, but to construct ndn::Buffer.

The benefit of using stream interface is that it provides automatic buffering of written data and eliminates (or reduces) overhead of resizing the underlying buffer when writing small pieces of data.

Usage example:

* obuf.put(0);
* obuf.write(another_buffer, another_buffer_size);
* ptr_lib::shared_ptr<Buffer> buf = obuf.get();
*

Definition at line 176 of file buffer.hpp.

Constructor & Destructor Documentation

ndn::OBufferStream::OBufferStream ( )
inline

Default constructor.

Definition at line 181 of file buffer.hpp.

Member Function Documentation

ptr_lib::shared_ptr<Buffer> ndn::OBufferStream::buf ( )
inline

Flush written data to the stream and return shared pointer to the underlying buffer.

Definition at line 192 of file buffer.hpp.