ndn::security::transform::StepSource Class Reference

A source that can accept input step by step, and can close input explicitly. More...

#include <ndn-cxx/security/transform/step-source.hpp>

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

Public Member Functions

void end ()
 Close the input interface and directly notify the next module the end of input. More...
 
void operator>> (unique_ptr< Sink > sink)
 Connect to the last transformation module. More...
 
Sourceoperator>> (unique_ptr< Transform > transform)
 Connect to an intermediate transformation module. More...
 
size_t write (const uint8_t *buf, size_t size)
 
size_t write (span< const uint8_t > buf)
 Accept input data and directly write input into next transformation module. More...
 

Protected Member Functions

void appendChain (unique_ptr< Downstream > tail)
 Connect to the next transformation module. More...
 
size_t getIndex () const
 Get the source module index (should always be 0). More...
 
DownstreamgetNext ()
 
void pump ()
 Pump all data into next transformation module. More...
 

Protected Attributes

unique_ptr< Downstreamm_next
 

Detailed Description

A source that can accept input step by step, and can close input explicitly.

This source will not send data into the transformation chain when the chain is constructed. Input will be explicitly sent into the chain using write(...) and will be closed explicitly using end().

StepSource ss; ss >> transform1() >> transform2() >> sinkStream(...); ss.write(...); ... ss.write(...); ss.end();

Definition at line 45 of file step-source.hpp.

Member Function Documentation

◆ appendChain()

void ndn::security::transform::Upstream::appendChain ( unique_ptr< Downstream tail)
protectedinherited

Connect to the next transformation module.

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

◆ end()

void ndn::security::transform::StepSource::end ( )

Close the input interface and directly notify the next module the end of input.

Definition at line 35 of file step-source.cpp.

◆ getIndex()

size_t ndn::security::transform::Source::getIndex ( ) const
inlineprotectedinherited

Get the source module index (should always be 0).

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

◆ getNext()

Downstream* ndn::security::transform::Upstream::getNext ( )
inlineprotectedinherited

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

◆ operator>>() [1/2]

void ndn::security::transform::Source::operator>> ( unique_ptr< Sink sink)
inherited

Connect to the last transformation module.

This method will trigger the source to pump data into the transformation pipeline.

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

◆ operator>>() [2/2]

Source & ndn::security::transform::Source::operator>> ( unique_ptr< Transform transform)
inherited

Connect to an intermediate transformation module.

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

◆ pump()

void ndn::security::transform::Source::pump ( )
protectedinherited

Pump all data into next transformation module.

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

◆ write() [1/2]

size_t ndn::security::transform::StepSource::write ( const uint8_t *  buf,
size_t  size 
)
inline
Deprecated:

Definition at line 64 of file step-source.hpp.

◆ write() [2/2]

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

Accept input data and directly write input into next transformation module.

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

Returns
number of bytes that has been written into next module

Definition at line 29 of file step-source.cpp.

Member Data Documentation

◆ m_next

unique_ptr<Downstream> ndn::security::transform::Upstream::m_next
protectedinherited

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