#include <AxPipe.h>
Inheritance diagram for AxPipe::CSource:
Public Member Functions | |
virtual | ~CSource () |
Ensure Plug() is called. | |
CSource * | Append (CSink *pSink) |
Append a section by pointer with auto deletion. | |
CSource * | Append (CSink &sink) |
Append a section by reference. | |
CSource * | Open () |
Open the source and possibly propagate downstream. | |
CSource * | Close () |
Close the source and possible propagate downstream. | |
CSource * | Drain () |
Drain the pipe until In() says we're empty for now. | |
CSource * | Plug () |
Plug this pipe, prepare for exit, cannot reopen after this. It's ok to call Plug() multiple times. | |
void | Out (CSeg *pSeg) |
Send data to an attached CSink. | |
Protected Member Functions | |
virtual CSeg * | In ()=0 |
The basic source of segments. |
You must override In(), and most likely provide your own constructor as well. The OutOpen() override shoulde be able to handle multiple calls, with OutClose() inbetween of course. Once open, Drain() should be called. This will push data from In() downstream until it signals empty, whereupon a flush is sent. If the source supports it, Drain() may be called multiple times in a row.
To support usage of multiple sources within a specific pipe, you may implement the OutClose() and OutOpen() methods, typically to close a file, and then open a new one, respectively.
Shutdown of the pipe occurs by either calling Plug() explicitly, or by calling it implicitly from the destructor of the CSource.
Definition at line 376 of file AxPipe.h.
|
Ensure Plug() is called. When a CSource get's destructed, we ensure that Plug() is called, so we know that we really can destruct it safely without any other threads referencing it. Definition at line 39 of file CSource.cpp. |
|
Append a section by reference.
Reimplemented from AxPipe::CPipe. Definition at line 57 of file CSource.cpp. References AxPipe::CPipe::AppendSink(). |
|
Append a section by pointer with auto deletion.
Reimplemented from AxPipe::CPipe. Definition at line 47 of file CSource.cpp. |
|
Close the source and possible propagate downstream. This will first call OutClose(), then propagate the signal downstream if OutClose() indicates we should by returning true. Override OutClose() to implement a closing of the stream. Reimplemented from AxPipe::CPipe. Definition at line 84 of file CSource.cpp. References AxPipe::eSegTypeClose, and AxPipe::CSink::OutPump(). |
|
Drain the pipe until In() says we're empty for now.
Definition at line 95 of file CSource.cpp. References _T, ASSCHK, AxPipe::ERROR_CODE_NOTOPEN, AxPipe::CError::GetErrorCode(), In(), AxPipe::CSeg::Len(), AxPipe::nGlobalInit, AxPipe::CSeg::Release(), AxPipe::CError::SetError(), AxPipe::CNoThread::WorkEnd(), AxPipe::CNoThread::WorkSignal(), and AxPipe::CNoThread::WorkStart(). |
|
The basic source of segments. Must override in all CSource derived classes. Should return a memory segment CSeg with new data as long as there is data available.
Implemented in AxPipe::CSourceNull, AxPipe::CSourceMem, AxPipe::CSourceMemFile, and CJoinInterleave. Referenced by Drain(). |
|
Open the source and possibly propagate downstream. All other sections Open() will only open the stream downstream of the current object, but since this is a CSource, we first call our own OutOpen(), then propagate if OutOpen() indicates we should. Override OutOpen() to implement stream open.
Reimplemented from AxPipe::CPipe. Definition at line 70 of file CSource.cpp. References AxPipe::eSegTypeOpen, and AxPipe::CSink::OutPump(). |
|
Send data to an attached CSink.
Implements AxPipe::CPipe. Definition at line 134 of file CSource.cpp. References AxPipe::CSink::OutPump(), and AxPipe::CSeg::Release(). |
|
Plug this pipe, prepare for exit, cannot reopen after this. It's ok to call Plug() multiple times.
Definition at line 124 of file CSource.cpp. References AxPipe::eSegTypePlug, and AxPipe::CSink::OutPump(). |