src/stream/ZStreamer.h

00001 /*  @(#) $Id: ZStreamer.h,v 1.19 2007/07/21 18:15:56 agreen Exp $ */
00002 
00003 /* ------------------------------------------------------------
00004 Copyright (c) 2000 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 __ZStreamer__
00026 #define __ZStreamer__ 1
00027 #include "zconfig.h"
00028 
00029 #include "ZRefCount.h"
00030 #include "ZStream.h"
00031 
00032 // =================================================================================================
00033 #pragma mark -
00034 #pragma mark * ZStreamerR
00035 
00040 class ZStreamerR : public virtual ZRefCountedWithFinalization
00041         {
00042 public:
00043         virtual const ZStreamR& GetStreamR() = 0;
00044         };
00045 
00046 // =================================================================================================
00047 #pragma mark -
00048 #pragma mark * ZStreamerU
00049 
00054 class ZStreamerU : public ZStreamerR
00055         {
00056 public:
00057 // From ZStreamerR
00058         virtual const ZStreamR& GetStreamR();
00059 
00060 // Our protocol
00061         virtual const ZStreamU& GetStreamU() = 0;
00062         };
00063 
00064 // =================================================================================================
00065 #pragma mark -
00066 #pragma mark * ZStreamerRPos
00067 
00072 class ZStreamerRPos : public ZStreamerU
00073         {
00074 public:
00075 // From ZStreamerR
00076         virtual const ZStreamR& GetStreamR();
00077 
00078 // From ZStreamerU
00079         virtual const ZStreamU& GetStreamU();
00080 
00081 // Our protocol
00082         virtual const ZStreamRPos& GetStreamRPos() = 0;
00083         };
00084 
00085 // =================================================================================================
00086 #pragma mark -
00087 #pragma mark * ZStreamerW
00088 
00093 class ZStreamerW : public virtual ZRefCountedWithFinalization
00094         {
00095 public:
00096         virtual const ZStreamW& GetStreamW() = 0;
00097         };
00098 
00099 // =================================================================================================
00100 #pragma mark -
00101 #pragma mark * ZStreamerWPos
00102 
00107 class ZStreamerWPos : public ZStreamerW
00108         {
00109 public:
00110 // From ZStreamerW
00111         virtual const ZStreamW& GetStreamW();
00112 
00113 // Our protocol
00114         virtual const ZStreamWPos& GetStreamWPos() = 0;
00115         };
00116 
00117 // =================================================================================================
00118 #pragma mark -
00119 #pragma mark * ZStreamerRWPos
00120 
00125 class ZStreamerRWPos : public ZStreamerRPos, public ZStreamerWPos
00126         {
00127 public:
00128 // From ZStreamerR
00129         virtual const ZStreamR& GetStreamR();
00130 
00131 // From ZStreamerU
00132         virtual const ZStreamU& GetStreamU();
00133 
00134 // From ZStreamerRPos
00135         virtual const ZStreamRPos& GetStreamRPos();
00136 
00137 // From ZStreamerW
00138         virtual const ZStreamW& GetStreamW();
00139 
00140 // From ZStreamerWPos
00141         virtual const ZStreamWPos& GetStreamWPos();
00142 
00143 // Our protocol
00144         virtual const ZStreamRWPos& GetStreamRWPos() = 0;
00145         };
00146 
00147 // =================================================================================================
00148 #pragma mark -
00149 #pragma mark * ZStreamerRW
00150 
00156 class ZStreamerRW : public ZStreamerR, public ZStreamerW
00157         {
00158         };
00159 
00160 // =================================================================================================
00161 #pragma mark -
00162 #pragma mark * ZStreamerR_T
00163 
00164 template <class Stream_t>
00165 class ZStreamerR_T : public ZStreamerR
00166         {
00167 public:
00168         ZStreamerR_T() {}
00169 
00170         virtual ~ZStreamerR_T() {}
00171 
00172         template <class P>
00173         ZStreamerR_T(P& iParam) : fStream(iParam) {}
00174 
00175         template <class P>
00176         ZStreamerR_T(const P& iParam) : fStream(iParam) {}
00177 
00178 // From ZStreamerR
00179         virtual const ZStreamR& GetStreamR() { return fStream; }
00180 
00181 // Our protocol
00182         Stream_t& GetStream() { return fStream; }
00183 
00184 protected:
00185         Stream_t fStream;
00186         };
00187 
00188 // =================================================================================================
00189 #pragma mark -
00190 #pragma mark * ZStreamerR_FT
00191 
00192 template <class Stream_t>
00193 class ZStreamerR_FT : public ZStreamerR
00194         {
00195 protected:
00196         ZStreamerR_FT() {}
00197 
00198 public:
00199         virtual ~ZStreamerR_FT() {}
00200 
00201         template <class P>
00202         ZStreamerR_FT(P& iParam, ZRef<ZStreamerR> iStreamer)
00203         :       fStreamerReal(iStreamer),
00204                 fStream(iParam, iStreamer->GetStreamR())
00205                 {}
00206 
00207         template <class P>
00208         ZStreamerR_FT(const P& iParam, ZRef<ZStreamerR> iStreamer)
00209         :       fStreamerReal(iStreamer),
00210                 fStream(iParam, iStreamer->GetStreamR())
00211                 {}
00212 
00213         ZStreamerR_FT(ZRef<ZStreamerR> iStreamer)
00214         :       fStreamerReal(iStreamer),
00215                 fStream(iStreamer->GetStreamR())
00216                 {}
00217 
00218 // From ZStreamerR
00219         virtual const ZStreamR& GetStreamR() { return fStream; }
00220 
00221 // Our protocol
00222         ZRef<ZStreamerR> GetStreamerR() { return fStreamerReal; }
00223 
00224         Stream_t& GetStream() { return fStream; }
00225 
00226 protected:
00227         ZRef<ZStreamerR> fStreamerReal;
00228         Stream_t fStream;
00229         };
00230 
00231 // =================================================================================================
00232 #pragma mark -
00233 #pragma mark * ZStreamerU_T
00234 
00235 template <class Stream_t>
00236 class ZStreamerU_T : public ZStreamerU
00237         {
00238 public:
00239         ZStreamerU_T() {}
00240 
00241         virtual ~ZStreamerU_T() {}
00242 
00243         template <class P>
00244         ZStreamerU_T(P& iParam) : fStream(iParam) {}
00245 
00246         template <class P>
00247         ZStreamerU_T(const P& iParam) : fStream(iParam) {}
00248 
00249 // From ZStreamerR
00250         virtual const ZStreamR& GetStreamR() { return fStream; }
00251 
00252 // From ZStreamerU
00253         virtual const ZStreamU& GetStreamU() { return fStream; }
00254 
00255 // Our protocol
00256         Stream_t& GetStream() { return fStream; }
00257 
00258 protected:
00259         Stream_t fStream;
00260         };
00261 
00262 // =================================================================================================
00263 #pragma mark -
00264 #pragma mark * ZStreamerU_FT
00265 
00266 template <class Stream_t>
00267 class ZStreamerU_FT : public ZStreamerU
00268         {
00269 protected:
00270         ZStreamerU_FT() {}
00271 
00272 public:
00273         virtual ~ZStreamerU_FT() {}
00274 
00275         template <class P>
00276         ZStreamerU_FT(P& iParam, ZRef<ZStreamerU> iStreamer)
00277         :       fStreamerReal(iStreamer),
00278                 fStream(iParam, iStreamer->GetStreamU())
00279                 {}
00280 
00281         template <class P>
00282         ZStreamerU_FT(const P& iParam, ZRef<ZStreamerU> iStreamer)
00283         :       fStreamerReal(iStreamer),
00284                 fStream(iParam, iStreamer->GetStreamU())
00285                 {}
00286 
00287         ZStreamerU_FT(ZRef<ZStreamerU> iStreamer)
00288         :       fStreamerReal(iStreamer),
00289                 fStream(iStreamer->GetStreamU())
00290                 {}
00291 
00292 // From ZStreamerR via ZStreamerU
00293         virtual const ZStreamR& GetStreamR() { return fStream; }
00294 
00295 // From ZStreamerU
00296         virtual const ZStreamU& GetStreamU() { return fStream; }
00297 
00298 // Our protocol
00299         ZRef<ZStreamerU> GetStreamerU() { return fStreamerReal; }
00300 
00301         Stream_t& GetStream() { return fStream; }
00302 
00303 protected:
00304         ZRef<ZStreamerU> fStreamerReal;
00305         Stream_t fStream;
00306         };
00307 
00308 // =================================================================================================
00309 #pragma mark -
00310 #pragma mark * ZStreamerRPos_T
00311 
00312 template <class Stream_t>
00313 class ZStreamerRPos_T : public ZStreamerRPos
00314         {
00315 public:
00316         ZStreamerRPos_T() {}
00317 
00318         virtual ~ZStreamerRPos_T() {}
00319 
00320         template <class P>
00321         ZStreamerRPos_T(P& iParam) : fStream(iParam) {}
00322 
00323         template <class P>
00324         ZStreamerRPos_T(const P& iParam) : fStream(iParam) {}
00325 
00326 // From ZStreamerR
00327         virtual const ZStreamR& GetStreamR() { return fStream; }
00328 
00329 // From ZStreamerU
00330         virtual const ZStreamU& GetStreamU() { return fStream; }
00331 
00332 // From ZStreamerRPos
00333         virtual const ZStreamRPos& GetStreamRPos() { return fStream; }
00334 
00335 // Our protocol
00336         Stream_t& GetStream() { return fStream; }
00337 
00338 protected:
00339         Stream_t fStream;
00340         };
00341 
00342 // =================================================================================================
00343 #pragma mark -
00344 #pragma mark * ZStreamerRPos_FT
00345 
00346 template <class Stream_t>
00347 class ZStreamerRPos_FT : public ZStreamerU
00348         {
00349 protected:
00350         ZStreamerRPos_FT() {}
00351 
00352 public:
00353         virtual ~ZStreamerRPos_FT() {}
00354 
00355         template <class P>
00356         ZStreamerRPos_FT(P& iParam, ZRef<ZStreamerRPos> iStreamer)
00357         :       fStreamerReal(iStreamer),
00358                 fStream(iParam, iStreamer->GetStreamRPos())
00359                 {}
00360 
00361         template <class P>
00362         ZStreamerRPos_FT(const P& iParam, ZRef<ZStreamerRPos> iStreamer)
00363         :       fStreamerReal(iStreamer),
00364                 fStream(iParam, iStreamer->GetStreamRPos())
00365                 {}
00366 
00367         ZStreamerRPos_FT(ZRef<ZStreamerRPos> iStreamer)
00368         :       fStreamerReal(iStreamer),
00369                 fStream(iStreamer->GetStreamRPos())
00370                 {}
00371 
00372 // From ZStreamerR
00373         virtual const ZStreamR& GetStreamR() { return fStream; }
00374 
00375 // From ZStreamerU
00376         virtual const ZStreamU& GetStreamU() { return fStream; }
00377 
00378 // From ZStreamerRPos
00379         virtual const ZStreamRPos& GetStreamRPos() { return fStream; }
00380 
00381 // Our protocol
00382         ZRef<ZStreamerRPos> GetStreamerRPos() { return fStreamerReal; }
00383 
00384         Stream_t& GetStream() { return fStream; }
00385 
00386 protected:
00387         ZRef<ZStreamerRPos> fStreamerReal;
00388         Stream_t fStream;
00389         };
00390 
00391 // =================================================================================================
00392 #pragma mark -
00393 #pragma mark * ZStreamerW_T
00394 
00395 template <class Stream_t>
00396 class ZStreamerW_T : public ZStreamerW
00397         {
00398 public:
00399         ZStreamerW_T() {}
00400 
00401         virtual ~ZStreamerW_T() {}
00402 
00403         template <class P>
00404         ZStreamerW_T(P& iParam) : fStream(iParam) {}
00405 
00406         template <class P>
00407         ZStreamerW_T(const P& iParam) : fStream(iParam) {}
00408 
00409 // From ZStreamerW
00410         virtual const ZStreamW& GetStreamW() { return fStream; }
00411 
00412 // Our protocol
00413         Stream_t& GetStream() { return fStream; }
00414 
00415 protected:
00416         Stream_t fStream;
00417         };
00418 
00419 // =================================================================================================
00420 #pragma mark -
00421 #pragma mark * ZStreamerW_FT
00422 
00423 template <class Stream_t>
00424 class ZStreamerW_FT : public ZStreamerW
00425         {
00426 protected:
00427         ZStreamerW_FT() {}
00428 
00429 public:
00430         virtual ~ZStreamerW_FT() {}
00431 
00432         template <class P>
00433         ZStreamerW_FT(P& iParam, ZRef<ZStreamerW> iStreamer)
00434         :       fStreamerReal(iStreamer),
00435                 fStream(iParam, iStreamer->GetStreamW())
00436                 {}
00437 
00438         template <class P>
00439         ZStreamerW_FT(const P& iParam, ZRef<ZStreamerW> iStreamer)
00440         :       fStreamerReal(iStreamer),
00441                 fStream(iParam, iStreamer->GetStreamW())
00442                 {}
00443 
00444         ZStreamerW_FT(ZRef<ZStreamerW> iStreamer)
00445         :       fStreamerReal(iStreamer),
00446                 fStream(iStreamer->GetStreamW())
00447                 {}
00448 
00449 // From ZStreamerW
00450         virtual const ZStreamW& GetStreamW() { return fStream; }
00451 
00452 // Our protocol
00453         ZRef<ZStreamerW> GetStreamerW() { return fStreamerReal; }
00454 
00455         Stream_t& GetStream() { return fStream; }
00456 
00457 protected:
00458         ZRef<ZStreamerW> fStreamerReal;
00459         Stream_t fStream;
00460         };
00461 
00462 // =================================================================================================
00463 #pragma mark -
00464 #pragma mark * ZStreamerWPos_T
00465 
00466 template <class Stream_t>
00467 class ZStreamerWPos_T : public ZStreamerWPos
00468         {
00469 public:
00470         ZStreamerWPos_T() {}
00471 
00472         virtual ~ZStreamerWPos_T() {}
00473 
00474         template <class P>
00475         ZStreamerWPos_T(P& iParam) : fStream(iParam) {}
00476 
00477         template <class P>
00478         ZStreamerWPos_T(const P& iParam) : fStream(iParam) {}
00479 
00480 // From ZStreamerW via ZStreamerWPos
00481         virtual const ZStreamW& GetStreamW() { return fStream; }
00482 
00483 // From ZStreamerWPos
00484         virtual const ZStreamWPos& GetStreamWPos() { return fStream; }
00485 
00486 // Our protocol
00487         Stream_t& GetStream() { return fStream; }
00488 
00489 protected:
00490         Stream_t fStream;
00491         };
00492 
00493 // =================================================================================================
00494 #pragma mark -
00495 #pragma mark * ZStreamerWPos_FT
00496 
00497 template <class Stream_t>
00498 class ZStreamerWPos_FT : public ZStreamerWPos
00499         {
00500 protected:
00501         ZStreamerWPos_FT() {}
00502 
00503 public:
00504         virtual ~ZStreamerWPos_FT() {}
00505 
00506         template <class P>
00507         ZStreamerWPos_FT(P& iParam, ZRef<ZStreamerWPos> iStreamer)
00508         :       fStreamerReal(iStreamer),
00509                 fStream(iParam, iStreamer->GetStreamWPos())
00510                 {}
00511 
00512         template <class P>
00513         ZStreamerWPos_FT(const P& iParam, ZRef<ZStreamerWPos> iStreamer)
00514         :       fStreamerReal(iStreamer),
00515                 fStream(iParam, iStreamer->GetStreamWPos())
00516                 {}
00517 
00518         ZStreamerWPos_FT(ZRef<ZStreamerWPos> iStreamer)
00519         :       fStreamerReal(iStreamer),
00520                 fStream(iStreamer->GetStreamWPos())
00521                 {}
00522 
00523 // From ZStreamerW via ZStreamerWPos
00524         virtual const ZStreamW& GetStreamW() { return fStream; }
00525 
00526 // From ZStreamerWPos
00527         virtual const ZStreamWPos& GetStreamWPos() { return fStream; }
00528 
00529 // Our protocol
00530         ZRef<ZStreamerWPos> GetStreamerWPos() { return fStreamerReal; }
00531 
00532         Stream_t& GetStream() { return fStream; }
00533 
00534 protected:
00535         ZRef<ZStreamerWPos> fStreamerReal;
00536         Stream_t fStream;
00537         };
00538 
00539 // =================================================================================================
00540 #pragma mark -
00541 #pragma mark * ZStreamerRWPos_T
00542 
00543 template <class Stream_t>
00544 class ZStreamerRWPos_T : public ZStreamerRWPos
00545         {
00546 public:
00547         ZStreamerRWPos_T() {}
00548 
00549         virtual ~ZStreamerRWPos_T() {}
00550 
00551         template <class P>
00552         ZStreamerRWPos_T(P& iParam) : fStream(iParam) {}
00553 
00554         template <class P>
00555         ZStreamerRWPos_T(const P& iParam) : fStream(iParam) {}
00556 
00557 // From ZStreamerR via ZStreamerRWPos
00558         virtual const ZStreamR& GetStreamR() { return fStream; }
00559 
00560 // From ZStreamerU via ZStreamerRWPos
00561         virtual const ZStreamU& GetStreamU() { return fStream; }
00562 
00563 // From ZStreamerRPos via ZStreamerRWPos
00564         virtual const ZStreamRPos& GetStreamRPos() { return fStream; }
00565 
00566 // From ZStreamerW via ZStreamerRWPos
00567         virtual const ZStreamW& GetStreamW() { return fStream; }
00568 
00569 // From ZStreamerWPos via ZStreamerRWPos
00570         virtual const ZStreamWPos& GetStreamWPos() { return fStream; }
00571 
00572 // From ZStreamerRWPos
00573         virtual const ZStreamRWPos& GetStreamRWPos() { return fStream; }
00574 
00575 // Our protocol
00576         Stream_t& GetStream() { return fStream; }
00577 
00578 protected:
00579         Stream_t fStream;
00580         };
00581 
00582 // =================================================================================================
00583 #pragma mark -
00584 #pragma mark * ZStreamerRWPos_FT
00585 
00586 template <class Stream_t>
00587 class ZStreamerRWPos_FT : public ZStreamerRWPos
00588         {
00589 protected:
00590         ZStreamerRWPos_FT() {}
00591 
00592 public:
00593         virtual ~ZStreamerRWPos_FT() {}
00594 
00595         template <class P>
00596         ZStreamerRWPos_FT(P& iParam, ZRef<ZStreamerRWPos> iStreamer)
00597         :       fStreamerReal(iStreamer),
00598                 fStream(iParam, iStreamer->GetStreamRWPos())
00599                 {}
00600 
00601         template <class P>
00602         ZStreamerRWPos_FT(const P& iParam, ZRef<ZStreamerRWPos> iStreamer)
00603         :       fStreamerReal(iStreamer),
00604                 fStream(iParam, iStreamer->GetStreamRWPos())
00605                 {}
00606 
00607         ZStreamerRWPos_FT(ZRef<ZStreamerRWPos> iStreamer)
00608         :       fStreamerReal(iStreamer),
00609                 fStream(iStreamer->GetStreamRWPos())
00610                 {}
00611 
00612 // From ZStreamerR via ZStreamerRWPos
00613         virtual const ZStreamR& GetStreamR() { return fStream; }
00614 
00615 // From ZStreamerU via ZStreamerRWPos
00616         virtual const ZStreamU& GetStreamU() { return fStream; }
00617 
00618 // From ZStreamerRPos via ZStreamerRWPos
00619         virtual const ZStreamRPos& GetStreamRPos() { return fStream; }
00620 
00621 // From ZStreamerW via ZStreamerRWPos
00622         virtual const ZStreamW& GetStreamW() { return fStream; }
00623 
00624 // From ZStreamerWPos via ZStreamerRWPos
00625         virtual const ZStreamWPos& GetStreamWPos() { return fStream; }
00626 
00627 // From ZStreamerRWPos
00628         virtual const ZStreamRWPos& GetStreamRWPos() { return fStream; }
00629 
00630 // Our protocol
00631         ZRef<ZStreamerRWPos> GetStreamerRWPos() { return fStreamerReal; }
00632 
00633         Stream_t& GetStream() { return fStream; }
00634 
00635 protected:
00636         ZRef<ZStreamerRWPos> fStreamerReal;
00637         Stream_t fStream;
00638         };
00639 
00640 // =================================================================================================
00641 #pragma mark -
00642 #pragma mark * ZStreamR_Streamer
00643 
00644 class ZStreamR_Streamer : public ZStreamR
00645         {
00646 public:
00647         ZStreamR_Streamer(ZRef<ZStreamerR> iStreamer);
00648         ~ZStreamR_Streamer();
00649 
00650 // From ZStreamR
00651         virtual void Imp_Read(void* iDest, size_t iCount, size_t* oCountRead);
00652 
00653         virtual void Imp_CopyToDispatch(const ZStreamW& iStreamW, uint64 iCount,
00654                 uint64* oCountRead, uint64* oCountWritten);
00655 
00656         virtual void Imp_CopyTo(const ZStreamW& iStreamW, uint64 iCount,
00657                 uint64* oCountRead, uint64* oCountWritten);
00658 
00659         virtual void Imp_Skip(uint64 iCount, uint64* oCountSkipped);
00660 
00661 private:
00662         ZRef<ZStreamerR> fStreamer;
00663         };
00664 
00665 // =================================================================================================
00666 #pragma mark -
00667 #pragma mark * ZStreamU_Streamer
00668 
00669 class ZStreamU_Streamer : public ZStreamU
00670         {
00671 public:
00672         ZStreamU_Streamer(ZRef<ZStreamerU> iStreamer);
00673         ~ZStreamU_Streamer();
00674 
00675 // From ZStreamR via ZStreamU
00676         virtual void Imp_Read(void* iDest, size_t iCount, size_t* oCountRead);
00677 
00678         virtual void Imp_CopyToDispatch(const ZStreamW& iStreamW, uint64 iCount,
00679                 uint64* oCountRead, uint64* oCountWritten);
00680 
00681         virtual void Imp_CopyTo(const ZStreamW& iStreamW, uint64 iCount,
00682                 uint64* oCountRead, uint64* oCountWritten);
00683 
00684         virtual void Imp_Skip(uint64 iCount, uint64* oCountSkipped);
00685 
00686 // From ZStreamU
00687         virtual void Imp_Unread();
00688 
00689 private:
00690         ZRef<ZStreamerU> fStreamer;
00691         };
00692 
00693 // =================================================================================================
00694 #pragma mark -
00695 #pragma mark * ZStreamRPos_Streamer
00696 
00697 class ZStreamRPos_Streamer : public ZStreamRPos
00698         {
00699 public:
00700         ZStreamRPos_Streamer(ZRef<ZStreamerRPos> iStreamer);
00701         ~ZStreamRPos_Streamer();
00702 
00703 // From ZStreamR via ZStreamRPos
00704         virtual void Imp_Read(void* iDest, size_t iCount, size_t* oCountRead);
00705 
00706         virtual void Imp_CopyToDispatch(const ZStreamW& iStreamW, uint64 iCount,
00707                 uint64* oCountRead, uint64* oCountWritten);
00708 
00709         virtual void Imp_CopyTo(const ZStreamW& iStreamW, uint64 iCount,
00710                 uint64* oCountRead, uint64* oCountWritten);
00711 
00712         virtual void Imp_Skip(uint64 iCount, uint64* oCountSkipped);
00713 
00714 // From ZStreamRPos
00715         virtual uint64 Imp_GetPosition();
00716         virtual void Imp_SetPosition(uint64 iPosition);
00717 
00718         virtual uint64 Imp_GetSize();
00719 
00720 private:
00721         ZRef<ZStreamerRPos> fStreamer;
00722         };
00723 
00724 // =================================================================================================
00725 #pragma mark -
00726 #pragma mark * ZStreamW_Streamer
00727 
00728 class ZStreamW_Streamer : public ZStreamW
00729         {
00730 public:
00731         ZStreamW_Streamer(ZRef<ZStreamerW> iStreamer);
00732         ~ZStreamW_Streamer();
00733 
00734 // From ZStreamW
00735         virtual void Imp_Write(const void* iSource, size_t iCount, size_t* oCountWritten);
00736 
00737         virtual void Imp_CopyFromDispatch(const ZStreamR& iStreamR, uint64 iCount,
00738                 uint64* oCountRead, uint64* oCountWritten);
00739 
00740         virtual void Imp_CopyFrom(const ZStreamR& iStreamR, uint64 iCount,
00741                 uint64* oCountRead, uint64* oCountWritten);
00742 
00743         virtual void Imp_Flush();
00744 
00745 private:
00746         ZRef<ZStreamerW> fStreamer;
00747         };
00748 
00749 // =================================================================================================
00750 #pragma mark -
00751 #pragma mark * ZStreamWPos_Streamer
00752 
00753 class ZStreamWPos_Streamer : public ZStreamWPos
00754         {
00755 public:
00756         ZStreamWPos_Streamer(ZRef<ZStreamerWPos> iStreamer);
00757         ~ZStreamWPos_Streamer();
00758 
00759 // From ZStreamW via ZStreamWPos
00760         virtual void Imp_Write(const void* iSource, size_t iCount, size_t* oCountWritten);
00761 
00762         virtual void Imp_CopyFromDispatch(const ZStreamR& iStreamR, uint64 iCount,
00763                 uint64* oCountRead, uint64* oCountWritten);
00764 
00765         virtual void Imp_CopyFrom(const ZStreamR& iStreamR, uint64 iCount,
00766                 uint64* oCountRead, uint64* oCountWritten);
00767 
00768         virtual void Imp_Flush();
00769 
00770 // From ZStreamWPos
00771         virtual uint64 Imp_GetPosition();
00772         virtual void Imp_SetPosition(uint64 iPosition);
00773 
00774         virtual uint64 Imp_GetSize();
00775         virtual void Imp_SetSize(uint64 iSize);
00776 
00777 private:
00778         ZRef<ZStreamerWPos> fStreamer;
00779         };
00780 
00781 // =================================================================================================
00782 #pragma mark -
00783 #pragma mark * ZStreamRWPos_Streamer
00784 
00785 class ZStreamRWPos_Streamer : public ZStreamRWPos
00786         {
00787 public:
00788         ZStreamRWPos_Streamer(ZRef<ZStreamerRWPos> iStreamer);
00789         ~ZStreamRWPos_Streamer();
00790 
00791 // From ZStreamR via ZStreamRWPos
00792         virtual void Imp_Read(void* iDest, size_t iCount, size_t* oCountRead);
00793 
00794         virtual void Imp_CopyToDispatch(const ZStreamW& iStreamW, uint64 iCount,
00795                 uint64* oCountRead, uint64* oCountWritten);
00796 
00797         virtual void Imp_CopyTo(const ZStreamW& iStreamW, uint64 iCount,
00798                 uint64* oCountRead, uint64* oCountWritten);
00799 
00800         virtual void Imp_Skip(uint64 iCount, uint64* oCountSkipped);
00801 
00802 // From ZStreamW via ZStreamRWPos
00803         virtual void Imp_Write(const void* iSource, size_t iCount, size_t* oCountWritten);
00804 
00805         virtual void Imp_CopyFromDispatch(const ZStreamR& iStreamR, uint64 iCount,
00806                 uint64* oCountRead, uint64* oCountWritten);
00807 
00808         virtual void Imp_CopyFrom(const ZStreamR& iStreamR, uint64 iCount,
00809                 uint64* oCountRead, uint64* oCountWritten);
00810 
00811 // From ZStreamRPos/ZStreamWPos via ZStreamRWPos
00812         virtual uint64 Imp_GetPosition();
00813         virtual void Imp_SetPosition(uint64 iPosition);
00814 
00815         virtual uint64 Imp_GetSize();
00816 
00817 // From ZStreamWPos via ZStreamRWPos
00818         virtual void Imp_SetSize(uint64 iSize);
00819 
00820 // Our protocol
00821         ZRef<ZStreamerRWPos> GetStreamer()
00822                 { return fStreamer; }
00823 
00824         void SetStreamer(ZRef<ZStreamerRWPos> iStreamer)
00825                 { fStreamer = iStreamer; }
00826 private:
00827         ZRef<ZStreamerRWPos> fStreamer;
00828         };
00829 
00830 // =================================================================================================
00831 #pragma mark -
00832 #pragma mark * ZStreamerRW_Wrapper
00833 
00835 
00836 class ZStreamerRW_Wrapper : public ZStreamerRW
00837         {
00838 public:
00839         ZStreamerRW_Wrapper(ZRef<ZStreamerR> iStreamerR, ZRef<ZStreamerW> iStreamerW);
00840         virtual ~ZStreamerRW_Wrapper();
00841 
00842 // From ZStreamerR via ZStreamerRW
00843         virtual const ZStreamR& GetStreamR();
00844 
00845 // From ZStreamerW via ZStreamerRW
00846         virtual const ZStreamW& GetStreamW();
00847 
00848 // Our protocol
00849         ZRef<ZStreamerR> GetStreamerR();
00850         ZRef<ZStreamerW> GetStreamerW();
00851 
00852 protected:
00853         ZRef<ZStreamerR> fStreamerR;
00854         const ZStreamR& fStreamR;
00855         ZRef<ZStreamerW> fStreamerW;
00856         const ZStreamW& fStreamW;
00857         };
00858 
00859 // =================================================================================================
00860 #pragma mark -
00861 #pragma mark * ZStreamerR_Stream
00862 
00868 class ZStreamerR_Stream : public ZStreamerR
00869         {
00870 public:
00871         ZStreamerR_Stream(const ZStreamR& iStreamR)
00872         :       fStreamR(iStreamR)
00873                 {}
00874 
00875 // From ZStreamerR
00876         virtual const ZStreamR& GetStreamR() { return fStreamR; }
00877 
00878 protected:
00879         const ZStreamR& fStreamR;
00880         };
00881 
00882 // =================================================================================================
00883 #pragma mark -
00884 #pragma mark * ZStreamerW_Stream
00885 
00891 class ZStreamerW_Stream : public ZStreamerW
00892         {
00893 public:
00894         ZStreamerW_Stream(const ZStreamW& iStreamW)
00895         :       fStreamW(iStreamW)
00896                 {}
00897 
00898 // From ZStreamerR
00899         virtual const ZStreamW& GetStreamW() { return fStreamW; }
00900 
00901 protected:
00902         const ZStreamW& fStreamW;
00903         };
00904 
00905 // =================================================================================================
00906 #pragma mark -
00907 #pragma mark * ZStreamerRWFactory
00908 
00909 class ZStreamerRWFactory : public ZRefCountedWithFinalization
00910         {
00911 protected:
00912         ZStreamerRWFactory();
00913         virtual ~ZStreamerRWFactory();
00914 
00915 public:
00916         virtual ZRef<ZStreamerRW> MakeStreamerRW() = 0;
00917         };
00918 
00919 #endif // __ZStreamer__

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