/home/et/GnuTopia/liboggpp/libogg++0-1.1/packaging/libogg++0-1.1/Ogg/Logical.H

Go to the documentation of this file.
00001 /*===========================================================================*/
00002 /*
00003  * This file is part of libogg++ - a c++ library for the Ogg transport format
00004  *
00005  * Copyright (C) 2006, 2007  Elaine Tsiang YueLien
00006  *
00007  * libogg++ is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  * 
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the
00019  * Free Software Foundation, Inc.
00020  * 51 Franklin Street, Fifth Floor
00021  * Boston, MA  02110-1301, USA
00022  *
00023  *===========================================================================*/
00028 /*===========================================================================*/
00029 #ifndef LogicalToApplicationInterface
00030 #define LogicalToApplicationInterface
00031 
00032 #ifdef __GNUG__
00033 #pragma interface
00034 #endif
00035 
00036 
00037 namespace       Ogg
00038 {
00039   class Logical;
00040   class Packet;
00041 }
00042 
00043 #include        <Ogg/Ogg.H>
00044 #include        <Ogg/Transport.H>
00045 #include        <Ogg/Exception.H>
00046 
00047 namespace       Ogg
00048 {
00050 
00051 
00058   class Packet
00059   {
00060   public:
00061     void *
00062     data();             
00063     
00064     size_t
00065     size();             
00066 
00067     PacketNo            
00068     packetNo();
00069 
00070   };
00071 
00077   class Logical
00078   {
00079   private:
00080     void *              impl_;
00081 
00082   protected:
00084     Logical(
00085             bool        dummy
00086             )
00087       : impl_(0)
00088     {}
00089 
00090   public:
00091     void *
00092     impl()
00093     {
00094       return(impl_);
00095     }
00096 
00098     Logical(
00099             Transport & transport
00100             ,long       serialNo
00101             );
00102     
00104     Logical(
00105             Transport & transport
00106             );
00107 
00108 
00112     virtual
00113     ~Logical();
00114 
00121     virtual
00122     bool
00123     selectCallback(
00124                    Packet &     firstPacket
00125                    )
00126     {
00127       return(true);
00128     }
00129 
00131     long
00132     serialNo();
00133 
00135     Transport &
00136     transport();
00137 
00144     class Writer
00145     {
00146     public:
00154       ~Writer();
00155 
00157       size_t
00158       dataSize();
00159 
00161       void
00162       dataSize(size_t);
00163 
00165       void
00166       flush();
00167       
00172       void
00173       beginData();
00174 
00179       void
00180       granulePosition(
00181                       Position
00182                       );
00183 
00185       Position
00186       granulePosition();
00187 
00189       size_t
00190       pageSize();
00191 
00196       void
00197       pageSize(
00198                size_t
00199                );
00200 
00202       Writer &
00203       operator++();
00204 
00206       Packet *
00207       operator->() const throw();
00208     };
00209 
00216     class Reader
00217     {
00218     public:
00223       ~Reader();
00224 
00226       Reader &
00227       operator++();
00228 
00233       Reader &
00234       operator+=(PacketNo packets);
00235 
00240       Reader &
00241       operator=(Position position);
00242 
00243       bool
00244       ending() const;   
00245 
00246       Error
00247       transportError()  
00248         const;
00249 
00250       Position
00251       granulePosition()
00252         const;
00253 
00255       Packet *
00256       operator->() const throw();
00257     };
00258 
00263     Writer &
00264     writer();
00265 
00266 
00271     Reader &
00272     reader();
00273 
00275     class NotForWriting : public Exception
00276     {
00277     public:
00278       NotForWriting(
00279                     const long  serialNo
00280                     ) throw()
00281         ;
00282 
00283       NotForWriting(
00284                     const NotForWriting & ex
00285                     ) throw()
00286         : Exception(ex)
00287       {}
00288 
00289       ~NotForWriting() throw()
00290       {}
00291     }
00292     ;
00293 
00295     class ReaderAlreadyExists : public Exception
00296     {
00297     public:
00298       ReaderAlreadyExists(
00299                           const long    serialNo
00300                           ) throw()
00301         ;
00302       
00303       ReaderAlreadyExists(
00304                           const ReaderAlreadyExists & ex
00305                           ) throw()
00306         : Exception(ex)
00307       {}
00308       
00309       ~ReaderAlreadyExists() throw()
00310       {}
00311     }
00312     ;
00313 
00315     class NotForReading : public Exception
00316     {
00317     public:
00318       NotForReading(
00319                     const long  serialNo
00320                     ) throw()
00321         ;
00322 
00323       NotForReading(
00324                     const NotForReading & ex
00325                     ) throw()
00326         : Exception(ex)
00327       {}
00328 
00329       ~NotForReading() throw()
00330       {}
00331     }
00332     ;
00333 
00335     class MuxTooLate : public Exception
00336     {
00337     public:
00338       MuxTooLate(
00339                  const long     serialNo
00340                  ) throw()
00341         ;
00342 
00343       MuxTooLate(
00344                  const MuxTooLate & ex
00345                  ) throw()
00346         : Exception(ex)
00347       {}
00348 
00349       ~MuxTooLate() throw()
00350       {}
00351     }
00352     ;
00353 
00355     class SerialNoAlreadyUsed : public Exception
00356     {
00357     public:
00358       SerialNoAlreadyUsed(
00359                           const long    serialNo
00360                           ) throw()
00361         ;
00362       
00363       SerialNoAlreadyUsed(
00364                           const SerialNoAlreadyUsed & ex
00365                           ) throw()
00366         : Exception(ex)
00367       {}
00368       
00369       ~SerialNoAlreadyUsed() throw()
00370       {}
00371     }
00372     ;
00373 
00374     class StreamAlreadyClaimed : public Exception
00375     {
00376     public:
00377       StreamAlreadyClaimed(
00378                            const long   serialNo
00379                           ) throw()
00380         ;
00381       
00382       StreamAlreadyClaimed(
00383                            const StreamAlreadyClaimed & ex
00384                           ) throw()
00385         : Exception(ex)
00386       {}
00387       
00388       ~StreamAlreadyClaimed() throw()
00389       {}
00390     }
00391     ;
00392 
00393     class NoSuchStream : public Exception
00394     {
00395     public:
00396       NoSuchStream(
00397                    const long   serialNo
00398                    ) throw()
00399         ;
00400       
00401       NoSuchStream(
00402                    const NoSuchStream & ex
00403                    ) throw()
00404         : Exception(ex)
00405       {}
00406       
00407       ~NoSuchStream() throw()
00408       {}
00409     }
00410     ;
00411 
00412     class FailedToSelectStream : public Exception
00413     {
00414     public:
00415       FailedToSelectStream(
00416                            const long   serialNo
00417                            ) throw()
00418         ;
00419       
00420       FailedToSelectStream(
00421                            const FailedToSelectStream & ex
00422                            ) throw()
00423         : Exception(ex)
00424       {}
00425       
00426       ~FailedToSelectStream() throw()
00427       {}
00428     }
00429     ;
00430 
00432     class SeekInternalError : public Exception
00433     {
00434     public:
00435       SeekInternalError(
00436                         const long      serialNo
00437                         ) throw()
00438         ;
00439       
00440       SeekInternalError(
00441                         const SeekInternalError & ex
00442                         ) throw()
00443         : Exception(ex)
00444       {}
00445       
00446       ~SeekInternalError() throw()
00447       {}
00448     }
00449     ;
00450 
00451   };
00453 };
00454 #endif

Generated on Tue May 1 16:35:34 2007 for libogg++ by  doxygen 1.5.1