Transport.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, 2008 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 TransportToApplicationInterface
00030 #define TransportToApplicationInterface
00031 
00032 #ifdef __GNUG__
00033 #pragma interface
00034 #endif
00035 
00036 namespace       Ogg
00037 {
00038   class Transport;
00039 }
00040 
00041 #include        <Ogg/Ogg.H>
00042 #include        <Ogg/Logical.H>
00043 #include        <Ogg/Exception.H>
00044 
00045 namespace       Ogg
00046 {
00047 
00049 
00050   
00056   class Page
00057   {
00058   public:
00059     void
00060     data(void *
00061          ,size_t
00062          );
00063 
00064     void *
00065     data();             
00066     
00067     size_t
00068     size() const;       
00069 
00070     bool
00071     ending() const;     
00072 
00073     Position
00074     granulePosition() const;    
00075 
00076     bool
00077     isHeader()const ;   
00078 
00079     long
00080     pageNo() const;     
00081 
00082     long
00083     serialNo() const;   
00084 
00085   };
00086 
00094   class Transport
00095   {
00096   private:
00097     void *              impl_;
00098 
00100     Transport(const Transport &);
00101 
00102     Transport &
00103     operator=(const Transport &);
00104 
00105   protected:
00107     Transport(
00108               int dummy
00109               )
00110       : impl_(0)
00111     {}
00112 
00113   public:
00114     void *
00115     impl()
00116     {
00117       return(impl_);
00118     }
00119 
00120     static
00121     const unsigned char CurrentVersion = 0x00;
00122 
00123     /*----- Exceptions thrown by a Transport thread ---------------------------------*/
00124 
00126     class NoDeletion : public Exception
00127     {
00128     public:
00129       NoDeletion() throw()
00130       : Exception("Sorry, you can't delete Transport instances")
00131       {
00132         *this << std::endl;
00133       }
00134 
00135       NoDeletion(
00136                  const NoDeletion & ex
00137                  ) throw()
00138         : Exception(ex)
00139       {}
00140 
00141       ~NoDeletion() throw()
00142       {}
00143     }
00144     ;
00145 
00150     class PrematureEndOfOggStream : public Exception
00151     {
00152     public:
00153       PrematureEndOfOggStream() throw()
00154       : Exception("Premature end of transport stream.")
00155       {
00156         *this << std::endl;
00157       }
00158 
00159       PrematureEndOfOggStream(
00160                               const PrematureEndOfOggStream & ex
00161                               ) throw()
00162         : Exception(ex)
00163       {}
00164       
00165       ~PrematureEndOfOggStream() throw()
00166       {}
00167     }
00168     ;
00169 
00170     /*- end Exceptions thrown by a Transport thread ---------------------------------*/
00171 
00173     Transport(
00174               bool      encapsulating
00175               );
00176 
00178     virtual
00179     ~Transport();
00180 
00187     long
00188     serialNo(long);
00189 
00191     Logical *
00192     logical(
00193             long        serialNo
00194             );
00195 
00208     void
00209     loop();
00210 
00216     void
00217     terminate();
00218 
00228     virtual
00229     void
00230     sendCallback(
00231                  Page &
00232                  );
00233 
00246     virtual
00247     size_t
00248     recvCallback(
00249                  Page &
00250                  );
00251 
00263     virtual
00264     bool
00265     laterThan (
00266                const Page &             p1
00267                ,const Page &            p2
00268                );
00269 
00270   }
00271   ;
00272 
00274 };
00275 #endif

Generated on Tue Aug 12 19:18:37 2008 for libogg++ by  doxygen 1.5.4