ndn::security::transform::StreamSink Class Reference

A sink which directs output to an std::ostream. More...

#include <ndn-cxx/security/transform/stream-sink.hpp>

+ Inheritance diagram for ndn::security::transform::StreamSink:
+ Collaboration diagram for ndn::security::transform::StreamSink:

Public Member Functions

 StreamSink (std::ostream &os)
 Create a stream sink which outputs to os. More...
 
void end ()
 Close the input interface of a module. More...
 
size_t getIndex () const
 Get the module index. More...
 
bool isEnd () const
 Check if the input interface of a module is closed. More...
 
void setIndex (size_t index)
 Set the module index. More...
 
size_t write (span< const uint8_t > buf)
 Accept input data and perform transformation. More...
 

Detailed Description

A sink which directs output to an std::ostream.

Definition at line 32 of file stream-sink.hpp.

Constructor & Destructor Documentation

◆ StreamSink()

ndn::security::transform::StreamSink::StreamSink ( std::ostream &  os)
explicit

Create a stream sink which outputs to os.

Definition at line 28 of file stream-sink.cpp.

Member Function Documentation

◆ end()

void ndn::security::transform::Downstream::end ( )
inherited

Close the input interface of a module.

This method will notify this module that there is no more input and that the module should finalize transformation.

Although end() can be invoked multiple times, only the first invocation takes effect.

Definition at line 44 of file transform-base.cpp.

◆ getIndex()

size_t ndn::security::transform::Downstream::getIndex ( ) const
inlineinherited

Get the module index.

Definition at line 125 of file transform-base.hpp.

◆ isEnd()

bool ndn::security::transform::Downstream::isEnd ( ) const
inlineinherited

Check if the input interface of a module is closed.

Definition at line 107 of file transform-base.hpp.

◆ setIndex()

void ndn::security::transform::Downstream::setIndex ( size_t  index)
inlineinherited

Set the module index.

Definition at line 116 of file transform-base.hpp.

◆ write()

size_t ndn::security::transform::Downstream::write ( span< const uint8_t >  buf)
inherited

Accept input data and perform transformation.

An upstream module should call this method to write data into this module. The written data will be transformed and the result will be written into the next downstream module.

An upstream module can keep calling this method to until end() is called, which indicates the end of input. After that, calling this method will cause Error.

If a Downstream implementation expects structured input (e.g., hex decoding requires byte-pair), it should not return less than size if final portion of input is not a complete record.

Returns
Number of bytes that have been written into this module.
Exceptions
Errorif this module is closed or transformation error happens.

Definition at line 33 of file transform-base.cpp.