Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

pldatasrc.h

Go to the documentation of this file.
00001 /*
00002 /--------------------------------------------------------------------
00003 |
00004 |      $Id: pldatasrc.h,v 1.1 2004/05/21 21:02:52 maxx Exp $
00005 |
00006 |      Copyright (c) 1996-2002 Ulrich von Zadow
00007 |
00008 \--------------------------------------------------------------------
00009 */
00010 
00011 #ifndef INCL_PLDATASRC
00012 #define INCL_PLDATASRC
00013 
00014 #include "plexcept.h"
00015 #include "plpaintlibdefs.h"
00016 
00017 class PLIProgressNotification;
00018 
00023 class PLDataSource : public PLObject
00024 {
00025 
00026 public:
00027 
00029   PLDataSource
00030     ( PLIProgressNotification * pNotification = NULL
00031     );
00032 
00034   virtual ~PLDataSource
00035     ();
00036 
00038   virtual void Open
00039     ( const char * pszName,
00040       int    FileSize
00041     );
00042 
00044   virtual void Close
00045     ();
00046 
00048   char * GetName
00049     ();
00050 
00052   virtual PLBYTE * GetBufferPtr
00053     ( int MinBytesInBuffer
00054     ) = 0;
00055 
00057   virtual PLBYTE * ReadNBytes
00058     ( int n
00059     );
00060 
00062   int GetFileSize
00063     ();
00064 
00067   virtual PLBYTE * ReadEverything
00068     () = 0;
00069 
00071   PLBYTE * Read1Byte
00072     ();
00073 
00075   PLBYTE * Read2Bytes
00076     ();
00077 
00079   PLBYTE * Read4Bytes
00080     ();
00081 
00082   // JH 15.4.99:
00084   void OProgressNotification
00085     ( double part
00086     );
00087 
00089   void AlignToWord
00090     ();
00091 
00093   void Skip
00094     ( int n
00095     );
00096 
00098   void CheckEOF
00099     ();
00100 
00101 protected:
00102 
00103 private:
00104   char * m_pszName;        // Name of the data source for diagnostic
00105                            // purposes.
00106   int    m_FileSize;
00107   int    m_BytesRead;
00108   bool   m_bSrcLSBFirst;   // Source byte order: true for intel order,
00109                            // false for Motorola et al. (MSB first).
00110   PLIProgressNotification * m_pNotification;
00111 };
00112 
00113 
00114 inline int PLDataSource::GetFileSize
00115     ()
00116 {
00117   return m_FileSize;
00118 }
00119 
00120 inline PLBYTE * PLDataSource::Read1Byte
00121     ()
00122 {
00123   return ReadNBytes (1);
00124 }
00125 
00126 
00127 inline PLBYTE * PLDataSource::Read2Bytes
00128     ()
00129 {
00130   return ReadNBytes (2);
00131 }
00132 
00133 
00134 inline PLBYTE * PLDataSource::Read4Bytes
00135     ()
00136 {
00137   return ReadNBytes (4);
00138 }
00139 
00140 inline void PLDataSource::AlignToWord
00141     ()
00142 {
00143   if (m_BytesRead & 1)
00144     Read1Byte();
00145 }
00146 
00147 
00148 inline void PLDataSource::Skip
00149     ( int n
00150     )
00151 {
00152   ReadNBytes (n);
00153 }
00154 
00155 inline void PLDataSource::CheckEOF
00156     ()
00157 {
00158 
00159   if (m_FileSize < m_BytesRead)
00160   {
00161     throw PLTextException (PL_ERREND_OF_FILE,
00162           "End of file reached while decoding.\n");
00163   }
00164 }
00165 
00166 #endif
00167 /*
00168 /--------------------------------------------------------------------
00169 |
00170 |      $Log: pldatasrc.h,v $
00171 |      Revision 1.1  2004/05/21 21:02:52  maxx
00172 |      Initial Version of vuVolume, moderatly changed to make it compile on my windows and linux machine.
00173 |
00174 |      Revision 1.1  2002/11/13 01:58:21  mspindle
00175 |      *** empty log message ***
00176 |
00177 |      Revision 1.3  2002/02/24 13:00:21  uzadow
00178 |      Documentation update; removed buggy PLFilterRotate.
00179 |
00180 |      Revision 1.2  2001/10/06 22:03:26  uzadow
00181 |      Added PL prefix to basic data types.
00182 |
00183 |      Revision 1.1  2001/09/16 19:03:22  uzadow
00184 |      Added global name prefix PL, changed most filenames.
00185 |
00186 |      Revision 1.5  2000/10/24 22:59:34  uzadow
00187 |      no message
00188 |
00189 |
00190 \--------------------------------------------------------------------
00191 */

Generated on Wed Dec 15 21:20:30 2004 for vuVolume by  doxygen 1.3.9.1