SNode.C
Loading...
Searching...
No Matches
core::pipe::Sink Class Referenceabstract

#include <Sink.h>

Inheritance diagram for core::pipe::Sink:
Collaboration diagram for core::pipe::Sink:

Public Member Functions

 Sink (Sink &)=delete
 
Sinkoperator= (Sink &)=delete
 

Protected Member Functions

 Sink ()=default
 
 Sink (Sink &&) noexcept=default
 
Sinkoperator= (Sink &&) noexcept=default
 
virtual ~Sink ()
 
bool isStreaming ()
 
void stop ()
 

Private Member Functions

void pipe (Source *source)
 
void streamData (const char *chunk, std::size_t chunkLen)
 
void streamEof ()
 
void streamError (int errnum)
 
void disconnect (const Source *source)
 
virtual void onSourceConnect (Source *source)=0
 
virtual void onSourceData (const char *chunk, std::size_t chunkLen)=0
 
virtual void onSourceEof ()=0
 
virtual void onSourceError (int errnum)=0
 

Private Attributes

Sourcesource = nullptr
 

Friends

class Source
 

Detailed Description

Definition at line 57 of file Sink.h.

Constructor & Destructor Documentation

◆ Sink() [1/3]

core::pipe::Sink::Sink ( Sink )
delete

◆ Sink() [2/3]

core::pipe::Sink::Sink ( )
protecteddefault

◆ Sink() [3/3]

core::pipe::Sink::Sink ( Sink &&  )
protecteddefaultnoexcept

◆ ~Sink()

core::pipe::Sink::~Sink ( )
protectedvirtual

Definition at line 52 of file Sink.cpp.

52 {
53 if (source != nullptr) {
54 source->disconnect(this);
55 }
56 }
Source * source
Definition Sink.h:90
void disconnect(const Sink *sink)
Definition Source.cpp:75

References core::pipe::Source::disconnect(), and source.

Here is the call graph for this function:

Member Function Documentation

◆ disconnect()

void core::pipe::Sink::disconnect ( const Source source)
private

Definition at line 87 of file Sink.cpp.

87 {
88 if (source == this->source) {
89 this->source = nullptr;
90 }
91 }

References source.

Referenced by core::pipe::Source::disconnect(), and core::pipe::Source::~Source().

Here is the caller graph for this function:

◆ isStreaming()

bool core::pipe::Sink::isStreaming ( )
protected

Definition at line 65 of file Sink.cpp.

65 {
66 return source != nullptr;
67 }

References source.

Referenced by web::http::client::MasterRequest::~MasterRequest(), and web::http::server::Response::~Response().

Here is the caller graph for this function:

◆ onSourceConnect()

virtual void core::pipe::Sink::onSourceConnect ( Source source)
privatepure virtual

Implemented in web::http::client::MasterRequest, and web::http::server::Response.

Referenced by pipe().

Here is the caller graph for this function:

◆ onSourceData()

virtual void core::pipe::Sink::onSourceData ( const char *  chunk,
std::size_t  chunkLen 
)
privatepure virtual

Implemented in web::http::client::MasterRequest, and web::http::server::Response.

Referenced by streamData().

Here is the caller graph for this function:

◆ onSourceEof()

virtual void core::pipe::Sink::onSourceEof ( )
privatepure virtual

Implemented in web::http::client::MasterRequest, and web::http::server::Response.

Referenced by streamEof().

Here is the caller graph for this function:

◆ onSourceError()

virtual void core::pipe::Sink::onSourceError ( int  errnum)
privatepure virtual

Implemented in web::http::client::MasterRequest, and web::http::server::Response.

Referenced by streamError().

Here is the caller graph for this function:

◆ operator=() [1/2]

Sink & core::pipe::Sink::operator= ( Sink &&  )
protecteddefaultnoexcept

◆ operator=() [2/2]

Sink & core::pipe::Sink::operator= ( Sink )
delete

◆ pipe()

void core::pipe::Sink::pipe ( Source source)
private

Definition at line 58 of file Sink.cpp.

58 {
59 if (source->isOpen())
60 this->source = source;
61
63 }
virtual void onSourceConnect(Source *source)=0
virtual bool isOpen()=0

References core::pipe::Source::isOpen(), onSourceConnect(), and source.

Referenced by core::pipe::Source::pipe().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop()

void core::pipe::Sink::stop ( )
protected

Definition at line 69 of file Sink.cpp.

69 {
70 if (source != nullptr) {
71 source->disconnect(this);
72 }
73 }

References core::pipe::Source::disconnect(), and source.

Referenced by web::http::server::Response::disconnect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ streamData()

void core::pipe::Sink::streamData ( const char *  chunk,
std::size_t  chunkLen 
)
private

Definition at line 75 of file Sink.cpp.

75 {
76 onSourceData(chunk, chunkLen);
77 }
virtual void onSourceData(const char *chunk, std::size_t chunkLen)=0

References onSourceData().

Referenced by core::pipe::Source::send().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ streamEof()

void core::pipe::Sink::streamEof ( )
private

Definition at line 79 of file Sink.cpp.

79 {
81 }
virtual void onSourceEof()=0

References onSourceEof().

Referenced by core::pipe::Source::eof().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ streamError()

void core::pipe::Sink::streamError ( int  errnum)
private

Definition at line 83 of file Sink.cpp.

83 {
84 onSourceError(errnum);
85 }
virtual void onSourceError(int errnum)=0

References onSourceError().

Referenced by core::pipe::Source::error().

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ Source

friend class Source
friend

Definition at line 92 of file Sink.h.

Member Data Documentation

◆ source

Source* core::pipe::Sink::source = nullptr
private

Definition at line 90 of file Sink.h.

Referenced by disconnect(), isStreaming(), pipe(), stop(), and ~Sink().


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