src/stream/ZStrimmer_Streamer.h

00001 /*  @(#) $Id: ZStrimmer_Streamer.h,v 1.2 2006/04/10 20:33:45 agreen Exp $ */
00002 
00003 /* ------------------------------------------------------------
00004 Copyright (c) 2006 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 __ZStrimmer_Streamer__
00026 #define __ZStrimmer_Streamer__ 1
00027 #include "zconfig.h"
00028 
00029 #include "ZStreamer.h"
00030 #include "ZStrimmer.h"
00031 
00032 // =================================================================================================
00033 #pragma mark -
00034 #pragma mark * ZStrimmerR_Streamer_T
00035 
00036 template <class StrimR_t>
00037 class ZStrimmerR_Streamer_T : public ZStrimmerR
00038         {
00039 protected:
00040         ZStrimmerR_Streamer_T() {}
00041 
00042 public:
00043         virtual ~ZStrimmerR_Streamer_T() {}
00044 
00045         template <class P>
00046         ZStrimmerR_Streamer_T(P& iParam, ZRef<ZStreamerR> iStreamerR)
00047         :       fStreamerR(iStreamerR),
00048                 fStrimR(iParam, iStreamerR->GetStreamR())
00049                 {}
00050 
00051         template <class P>
00052         ZStrimmerR_Streamer_T(const P& iParam, ZRef<ZStreamerR> iStreamerR)
00053         :       fStreamerR(iStreamerR),
00054                 fStrimR(iParam, iStreamerR->GetStreamR())
00055                 {}
00056 
00057         ZStrimmerR_Streamer_T(ZRef<ZStreamerR> iStreamerR)
00058         :       fStreamerR(iStreamerR),
00059                 fStrimR(iStreamerR->GetStreamR())
00060                 {}
00061 
00062 // From ZStrimmerR
00063         virtual const ZStrimR& GetStrimR() { return fStrimR; }
00064 
00065 // Our protocol
00066         StrimR_t& GetStrim() { return fStrimR; }
00067 
00068 protected:
00069         ZRef<ZStreamerR> fStreamerR;
00070         StrimR_t fStrimR;
00071         };
00072 
00073 // =================================================================================================
00074 #pragma mark -
00075 #pragma mark * ZStrimmerW_Streamer_T
00076 
00077 template <class StrimW_t>
00078 class ZStrimmerW_Streamer_T : public ZStrimmerW
00079         {
00080 protected:
00081         ZStrimmerW_Streamer_T() {}
00082 
00083 public:
00084         virtual ~ZStrimmerW_Streamer_T() {}
00085 
00086         template <class P>
00087         ZStrimmerW_Streamer_T(P& iParam, ZRef<ZStreamerW> iStreamerW)
00088         :       fStreamerW(iStreamerW),
00089                 fStrimW(iParam, iStreamerW->GetStreamW())
00090                 {}
00091 
00092         template <class P>
00093         ZStrimmerW_Streamer_T(const P& iParam, ZRef<ZStreamerW> iStreamerW)
00094         :       fStreamerW(iStreamerW),
00095                 fStrimW(iParam, iStreamerW->GetStreamW())
00096                 {}
00097 
00098         ZStrimmerW_Streamer_T(ZRef<ZStreamerW> iStreamerW)
00099         :       fStreamerW(iStreamerW),
00100                 fStrimW(iStreamerW->GetStreamW())
00101                 {}
00102 
00103 // From ZStrimmerW
00104         virtual const ZStrimW& GetStrimW() { return fStrimW; }
00105 
00106 // Our protocol
00107         StrimW_t& GetStrim() { return fStrimW; }
00108 
00109 protected:
00110         ZRef<ZStreamerW> fStreamerW;
00111         StrimW_t fStrimW;
00112         };
00113 
00114 #endif // __ZStrimmer_Streamer__

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