src/stream/ZStrimmer.h

00001 /*  @(#) $Id: ZStrimmer.h,v 1.6 2006/04/10 20:44:22 agreen Exp $ */
00002 
00003 /* ------------------------------------------------------------
00004 Copyright (c) 2003 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__
00026 #define __ZStrimmer__ 1
00027 #include "zconfig.h"
00028 
00029 #include "zconfig.h"
00030 
00031 #include "ZRefCount.h"
00032 #include "ZStrim.h"
00033 
00034 // =================================================================================================
00035 #pragma mark -
00036 #pragma mark * ZStrimmerR
00037 
00042 class ZStrimmerR : public virtual ZRefCountedWithFinalization
00043         {
00044 public:
00045         virtual const ZStrimR& GetStrimR() = 0;
00046         };
00047 
00048 // =================================================================================================
00049 #pragma mark -
00050 #pragma mark * ZStrimmerU
00051 
00056 class ZStrimmerU : public ZStrimmerR
00057         {
00058 public:
00059 // From ZStrimmerR
00060         virtual const ZStrimR& GetStrimR();
00061 
00062 // Our protocol
00063         virtual const ZStrimU& GetStrimU() = 0;
00064         };
00065 
00066 // =================================================================================================
00067 #pragma mark -
00068 #pragma mark * ZStrimmerW
00069 
00074 class ZStrimmerW : public virtual ZRefCountedWithFinalization
00075         {
00076 public:
00077         virtual const ZStrimW& GetStrimW() = 0;
00078         };
00079 
00080 // =================================================================================================
00081 #pragma mark -
00082 #pragma mark * ZStrimmerR_T
00083 
00084 template <class Strim_t>
00085 class ZStrimmerR_T : public ZStrimmerR
00086         {
00087 public:
00088         ZStrimmerR_T() {}
00089 
00090         virtual ~ZStrimmerR_T() {}
00091 
00092         template <class P>
00093         ZStrimmerR_T(P& iParam) : fStrim(iParam) {}
00094 
00095         template <class P>
00096         ZStrimmerR_T(const P& iParam) : fStrim(iParam) {}
00097 
00098 // From ZStrimmerR
00099         virtual const ZStrimR& GetStrimR() { return fStrim; }
00100 
00101 // Our protocol
00102         Strim_t& GetStrim() { return fStrim; }
00103 
00104 protected:
00105         Strim_t fStrim;
00106         };
00107 
00108 // =================================================================================================
00109 #pragma mark -
00110 #pragma mark * ZStrimmerR_FT
00111 
00112 template <class Strim_t>
00113 class ZStrimmerR_FT : public ZStrimmerR
00114         {
00115 protected:
00116         ZStrimmerR_FT() {}
00117 
00118 public:
00119         virtual ~ZStrimmerR_FT() {}
00120 
00121         template <class P>
00122         ZStrimmerR_FT(P& iParam, ZRef<ZStrimmerR> iStrimmer)
00123         :       fStrimmerReal(iStrimmer),
00124                 fStrim(iParam, iStrimmer->GetStrimR())
00125                 {}
00126 
00127         template <class P>
00128         ZStrimmerR_FT(const P& iParam, ZRef<ZStrimmerR> iStrimmer)
00129         :       fStrimmerReal(iStrimmer),
00130                 fStrim(iParam, iStrimmer->GetStrimR())
00131                 {}
00132 
00133         ZStrimmerR_FT(ZRef<ZStrimmerR> iStrimmer)
00134         :       fStrimmerReal(iStrimmer),
00135                 fStrim(iStrimmer->GetStrimR())
00136                 {}
00137 
00138 // From ZStrimmerR
00139         virtual const ZStrimR& GetStrimR() { return fStrim; }
00140 
00141 // Our protocol
00142         Strim_t& GetStrim() { return fStrim; }
00143 
00144 protected:
00145         ZRef<ZStrimmerR> fStrimmerReal;
00146         Strim_t fStrim;
00147         };
00148 
00149 // =================================================================================================
00150 #pragma mark -
00151 #pragma mark * ZStrimmerU_T
00152 
00153 template <class Strim_t>
00154 class ZStrimmerU_T : public ZStrimmerU
00155         {
00156 public:
00157         ZStrimmerU_T() {}
00158 
00159         virtual ~ZStrimmerU_T() {}
00160 
00161         template <class P>
00162         ZStrimmerU_T(P& iParam) : fStrim(iParam) {}
00163 
00164         template <class P>
00165         ZStrimmerU_T(const P& iParam) : fStrim(iParam) {}
00166 
00167 // From ZStrimmerU
00168         virtual const ZStrimU& GetStrimU() { return fStrim; }
00169 
00170 // Our protocol
00171         Strim_t& GetStrim() { return fStrim; }
00172 
00173 protected:
00174         Strim_t fStrim;
00175         };
00176 
00177 // =================================================================================================
00178 #pragma mark -
00179 #pragma mark * ZStrimmerU_FT
00180 
00181 template <class Strim_t>
00182 class ZStrimmerU_FT : public ZStrimmerU
00183         {
00184 protected:
00185         ZStrimmerU_FT() {}
00186 
00187 public:
00188         virtual ~ZStrimmerU_FT() {}
00189 
00190         template <class P>
00191         ZStrimmerU_FT(P& iParam, ZRef<ZStrimmerR> iStrimmer)
00192         :       fStrimmerReal(iStrimmer),
00193                 fStrim(iParam, iStrimmer->GetStrimR())
00194                 {}
00195 
00196         template <class P>
00197         ZStrimmerU_FT(const P& iParam, ZRef<ZStrimmerR> iStrimmer)
00198         :       fStrimmerReal(iStrimmer),
00199                 fStrim(iParam, iStrimmer->GetStrimR())
00200                 {}
00201 
00202         ZStrimmerU_FT(ZRef<ZStrimmerR> iStrimmer)
00203         :       fStrimmerReal(iStrimmer),
00204                 fStrim(iStrimmer->GetStrimR())
00205                 {}
00206 
00207 // From ZStrimmerR via ZStrimmerU
00208         virtual const ZStrimR& GetStrimR() { return fStrim; }
00209 
00210 // From ZStrimmerU
00211         virtual const ZStrimU& GetStrimU() { return fStrim; }
00212 
00213 // Our protocol
00214         Strim_t& GetStrim() { return fStrim; }
00215 
00216 protected:
00217         ZRef<ZStrimmerU> fStrimmerReal;
00218         Strim_t fStrim;
00219         };
00220 
00221 // =================================================================================================
00222 #pragma mark -
00223 #pragma mark * ZStrimmerW_T
00224 
00225 template <class Strim_t>
00226 class ZStrimmerW_T : public ZStrimmerW
00227         {
00228 public:
00229         ZStrimmerW_T() {}
00230 
00231         virtual ~ZStrimmerW_T() {}
00232 
00233         template <class P>
00234         ZStrimmerW_T(P& iParam) : fStrim(iParam) {}
00235 
00236         template <class P>
00237         ZStrimmerW_T(const P& iParam) : fStrim(iParam) {}
00238 
00239 // From ZStrimmerW
00240         virtual const ZStrimW& GetStrimW() { return fStrim; }
00241 
00242 // Our protocol
00243         Strim_t& GetStrim() { return fStrim; }
00244 
00245 protected:
00246         Strim_t fStrim;
00247         };
00248 
00249 // =================================================================================================
00250 #pragma mark -
00251 #pragma mark * ZStrimmerW_FT
00252 
00253 template <class Strim_t>
00254 class ZStrimmerW_FT : public ZStrimmerW
00255         {
00256 protected:
00257         ZStrimmerW_FT() {}
00258 
00259 public:
00260         virtual ~ZStrimmerW_FT() {}
00261 
00262         template <class P>
00263         ZStrimmerW_FT(P& iParam, ZRef<ZStrimmerW> iStrimmer)
00264         :       fStrimmerReal(iStrimmer),
00265                 fStrim(iParam, iStrimmer->GetStrimW())
00266                 {}
00267 
00268         template <class P>
00269         ZStrimmerW_FT(const P& iParam, ZRef<ZStrimmerW> iStrimmer)
00270         :       fStrimmerReal(iStrimmer),
00271                 fStrim(iParam, iStrimmer->GetStrimW())
00272                 {}
00273 
00274         ZStrimmerW_FT(ZRef<ZStrimmerW> iStrimmer)
00275         :       fStrimmerReal(iStrimmer),
00276                 fStrim(iStrimmer->GetStrimW())
00277                 {}
00278 
00279 // From ZStrimmerW
00280         virtual const ZStrimW& GetStrimW() { return fStrim; }
00281 
00282 // Our protocol
00283         Strim_t& GetStrim() { return fStrim; }
00284 
00285 protected:
00286         ZRef<ZStrimmerW> fStrimmerReal;
00287         Strim_t fStrim;
00288         };
00289 
00290 #endif // __ZStrimmer__

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