NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::OBufferStream Class Reference

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

#include <buffer-stream.hpp>

Inheritance diagram for ndn::OBufferStream:
Collaboration diagram for ndn::OBufferStream:

Public Member Functions

 OBufferStream ()
 Default constructor. More...
 
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);
shared_ptr<Buffer> buf = obuf.get();

Definition at line 79 of file buffer-stream.hpp.

Constructor & Destructor Documentation

§ OBufferStream()

ndn::OBufferStream::OBufferStream ( )
inline

Default constructor.

Definition at line 85 of file buffer-stream.hpp.

Member Function Documentation

§ buf()

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

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