src/stream/ZStream_Tee.h

00001 /*  @(#) $Id: ZStream_Tee.h,v 1.3 2006/04/10 20:44:21 agreen Exp $ */
00002 
00003 /* ------------------------------------------------------------
00004 Copyright (c) 2004 Andrew Green and Learning in Motion, Inc.
00005 http://www.zoolib.org
00006 
00007 Permission is hereby granted, free of charge, to any person obtaining a copy
00008 of this software and associated documentation files (the "Software"), to deal
00009 in the Software without restriction, including without limitation the rights
00010 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00011 copies of the Software, and to permit persons to whom the Software is
00012 furnished to do so, subject to the following conditions:
00013 
00014 The above copyright notice and this permission notice shall be included in
00015 all copies or substantial portions of the Software.
00016 
00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00020 COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023 ------------------------------------------------------------ */
00024 
00025 #ifndef __ZStream_Tee__
00026 #define __ZStream_Tee__ 1
00027 
00028 #include "zconfig.h"
00029 
00030 #include "ZStreamer.h"
00031 
00032 // =================================================================================================
00033 #pragma mark -
00034 #pragma mark * ZStreamR_Tee
00035 
00037 
00038 class ZStreamR_Tee : public ZStreamR
00039         {
00040 public:
00041         ZStreamR_Tee(const ZStreamR& iStreamR, const ZStreamW& iStreamW);
00042         ~ZStreamR_Tee();
00043 
00044         virtual void Imp_Read(void* iDest, size_t iCount, size_t* oCountRead);
00045         virtual size_t Imp_CountReadable();
00046 
00047 protected:
00048         const ZStreamR& fStreamR;
00049         const ZStreamW& fStreamW;
00050         };
00051 
00052 // =================================================================================================
00053 #pragma mark -
00054 #pragma mark * ZStreamerR_Tee
00055 
00057 
00058 class ZStreamerR_Tee : public ZStreamerR
00059         {
00060 public:
00061         ZStreamerR_Tee(ZRef<ZStreamerR> iStreamerR, ZRef<ZStreamerW> iStreamerW);
00062         virtual ~ZStreamerR_Tee();
00063 
00064 // From ZStreamerR
00065         virtual const ZStreamR& GetStreamR();
00066 
00067 protected:
00068         ZRef<ZStreamerR> fStreamerR;
00069         ZRef<ZStreamerW> fStreamerW;
00070         ZStreamR_Tee fStream;
00071         };
00072 
00073 // =================================================================================================
00074 #pragma mark -
00075 #pragma mark * ZStreamW_Tee
00076 
00078 
00079 class ZStreamW_Tee : public ZStreamW
00080         {
00081 public:
00082         ZStreamW_Tee(const ZStreamW& iStreamSink1, const ZStreamW& iStreamSink2);
00083         ~ZStreamW_Tee();
00084 
00085 // From ZStreamW
00086         virtual void Imp_Write(const void* iSource, size_t iCount, size_t* oCountWritten);
00087         virtual void Imp_Flush();
00088 
00089 protected:
00090         const ZStreamW& fStreamSink1;
00091         const ZStreamW& fStreamSink2;
00092         };
00093 
00094 // =================================================================================================
00095 #pragma mark -
00096 #pragma mark * ZStreamerW_Tee
00097 
00099 
00100 class ZStreamerW_Tee : public ZStreamerW
00101         {
00102 public:
00103         ZStreamerW_Tee(ZRef<ZStreamerW> iStreamerSink1, ZRef<ZStreamerW> iStreamerSink2);
00104         virtual ~ZStreamerW_Tee();
00105 
00106 // From ZStreamerW
00107         virtual const ZStreamW& GetStreamW();
00108 
00109 protected:
00110         ZRef<ZStreamerW> fStreamerSink1;
00111         ZRef<ZStreamerW> fStreamerSink2;
00112         ZStreamW_Tee fStream;
00113         };
00114 
00115 #endif // __ZStream_Tee__

Generated on Thu Jul 26 11:21:54 2007 for ZooLib by  doxygen 1.4.7