00001 00034 #include "stdafx.h" 00035 00036 namespace AxPipe { 00043 void 00044 CSplit::DestructSink() { 00045 // Here we do a safety first, so we can be called even if it's not 00046 // properly constructed. 00047 if (m_pLeft) { 00048 m_pLeft->WorkExitWait(); 00049 delete m_pLeft; 00050 } 00051 if (m_pRight) { 00052 m_pRight->WorkExitWait(); 00053 delete m_pRight; 00054 } 00055 m_pLeft = m_pRight = NULL; 00056 } 00059 void 00060 CSplit::PumpSplit(CSeg *pSeg) { 00061 pSeg->AddRef(); 00062 m_pLeft->OutPump(pSeg); 00063 m_pRight->OutPump(pSeg); 00064 } 00065 00067 CSplit::CSplit() { 00068 m_pLeft = NULL; 00069 m_pRight = NULL; 00070 }; 00071 00075 void 00076 CSplit::AppendSink(CSink *pSink, bool fAutoDeleteSink) { 00077 SetError(ERROR_CODE_GENERIC, _T("Use Init() for CSplit")); 00078 } 00079 00082 void 00083 CSplit::Sync() { 00084 WaitForIdle(); 00085 m_pLeft->Sync(); // Wait for the rest of the pipe too. 00086 m_pRight->Sync(); // Wait for the rest of the pipe too. 00087 } 00088 00096 CSplit * 00097 CSplit::Init(CPipe *pLeft, CPipe *pRight) { 00098 (m_pLeft = pLeft)->CError::Init(this); 00099 (m_pRight = pRight)->CError::Init(this); 00100 return this; 00101 } 00104 void 00105 CSplit::Out(CSeg *pSeg) { 00106 PumpSplit(pSeg); 00107 } 00108 00111 void 00112 CSplit::OutSpecial(CSeg *pSeg) { 00113 PumpSplit(pSeg); 00114 } 00115 00120 bool 00121 CSplit::OutFlush() { 00122 PumpSplit((new CSeg)->SetType(eSegTypeFlush)); 00123 return false; 00124 } 00125 00130 bool 00131 CSplit::OutClose() { 00132 PumpSplit((new CSeg)->SetType(eSegTypeClose)); 00133 return false; 00134 } 00135 00140 bool 00141 CSplit::OutOpen() { 00142 PumpSplit((new CSeg)->SetType(eSegTypeOpen)); 00143 return false; 00144 } 00145 };