Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Examples.cpp

Go to the documentation of this file.
00001 
00034 #include "stdafx.h"
00035 #include "Examples.h"
00036 
00042 void CFilterNop::InFilter() {
00043     AxPipe::CSeg *pInSeg;
00044     size_t cbIn;
00045     Open();
00046     // End of this stream is signalled by NULL
00047     while (pInSeg = Read(), (pInSeg && (cbIn = pInSeg->Len()))) {
00048         // We're not guaranteed to get an output segment of the required
00049         // size, so we must loop here.
00050         while (cbIn) {
00051             AxPipe::CSeg *pOutSeg = GetSeg(cbIn);
00052 
00053             if (!pOutSeg) {
00054                 return;         // Error of some kind
00055             }
00056             // This might be a good place to do something...
00057             memcpy(pOutSeg->PtrWr(), pInSeg->PtrRd(), pOutSeg->Len());
00058 
00059             cbIn -= pOutSeg->Len();
00060             Pump(pOutSeg);
00061         }
00062         // We're done with the inbuffer, let it go.
00063         pInSeg->Release();
00064     }
00065     Close();
00066     // This might be a good place to flush, if there's anything to flush. There's
00067     // no explicit Flush() method for pull-style filters. When returning, you should
00068     // be ready for a new call to InFilter().
00069 }
00070 
00077 AxPipe::CSeg *
00078 CJoinInterleave::In() {
00079     static int nThisIx = 0;
00080     int nStartIx = nThisIx;
00081     do {
00082         if (!StreamEmpty(nThisIx)) {
00083             AxPipe::CSeg *pSeg = StreamSeg(nThisIx);
00084             if (pSeg && pSeg->Len()) {
00085                 // This is where you would do something with the data before passing it on
00086                 // by returning a segment. At this point you know which stream the data
00087                 // came from.
00088                 return pSeg;
00089             }
00090         }
00091         // Next stream
00092         nThisIx = StreamIx(nThisIx + 1);
00093     } while (nThisIx != nStartIx);
00094 
00095     // Only signal end of stream when all streams are empty.
00096     return new AxPipe::CSeg;
00097 }

Generated on Mon Feb 2 13:19:19 2004 for AxPipe by doxygen 1.3.5