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:81

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 86 of file Sink.cpp.

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

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 64 of file Sink.cpp.

64 {
65 return source != nullptr;
66 }

References source.

Referenced by web::http::client::Request::~Request(), 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::Request, 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::Request, 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::Request, 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::Request, 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 this->source = source;
60
62 }
virtual void onSourceConnect(Source *source)=0

References 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 68 of file Sink.cpp.

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

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

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

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 74 of file Sink.cpp.

74 {
75 onSourceData(chunk, chunkLen);
76 }
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 78 of file Sink.cpp.

78 {
80 }
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 82 of file Sink.cpp.

82 {
83 onSourceError(errnum);
84 }
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: