BufferOutputStream.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 2003-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED,
00008 //  AS TO THE CORRECTNESS OF THIS CODE OR ANY DERIVATIVE
00009 //  WORKS WHICH INCORPORATE IT.
00010 //
00011 //  AUTODESK PROVIDES THE CODE ON AN "AS-IS" BASIS
00012 //  AND EXPLICITLY DISCLAIMS ANY LIABILITY, INCLUDING
00013 //  CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00014 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00015 //
00016 //  Use, duplication, or disclosure by the U.S. Government is subject to
00017 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00018 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00019 //  Data and Computer Software), as applicable.
00020 //
00021 
00022 
00023 #ifndef _DWFCORE_BUFFER_OUTPUT_STREAM_H
00024 #define _DWFCORE_BUFFER_OUTPUT_STREAM_H
00025 
00026 
00031 
00032 
00033 #include "dwfcore/OutputStream.h"
00034 
00035 
00036 namespace DWFCore
00037 {
00038 
00052 class DWFBufferOutputStream  : virtual public DWFCoreMemory
00053                              , public DWFOutputStream
00054 {
00055 
00056 public:
00057 
00070     _DWFCORE_API
00071     DWFBufferOutputStream( size_t   nInitialBufferBytes,
00072                            off_t    nMaxBufferBytes = -1 )
00073         throw();
00074 
00086     _DWFCORE_API
00087     DWFBufferOutputStream( void*    pBuffer,
00088                            size_t   nBufferBytes )
00089         throw();
00090 
00108     _DWFCORE_API
00109     DWFBufferOutputStream( DWFOutputStream* pOutputStream,
00110                            bool             bOwnStream,
00111                            size_t           nBufferBytes )
00112        throw();
00113 
00119     _DWFCORE_API
00120     virtual ~DWFBufferOutputStream()
00121         throw();
00122 
00129     _DWFCORE_API
00130     virtual void flush()
00131         throw( DWFException );
00132 
00144     _DWFCORE_API
00145     virtual size_t write( const void*   pBuffer,
00146                           size_t        nBytesToWrite )
00147         throw( DWFException );
00148 
00158     _DWFCORE_API
00159     virtual size_t bytes() const
00160         throw()
00161     {
00162         return _iBufferPos;
00163     }
00164 
00174     _DWFCORE_API
00175     virtual const void* buffer() const
00176         throw()
00177     {
00178         return _pBuffer;
00179     }
00180 
00189     _DWFCORE_API
00190     virtual size_t buffer( void** ppBuffer ) const
00191         throw( DWFException );
00192 
00193 protected:
00194 
00195     void*               _pBuffer;
00196 
00197     size_t              _iBufferPos;
00198     size_t              _nBufferBytes;
00199     size_t              _nBufferBytesRemaining;
00200 
00201 private:
00202 
00203     DWFOutputStream*    _pOutputStream;
00204 
00205 
00206     bool                _bOwnStream;
00207     off_t               _nMaxBufferBytes;
00208     size_t              _nInitialBufferBytes;
00209 
00210 private:
00211 
00212     //
00213     // Unimplemented methods
00214     //
00215 
00216     DWFBufferOutputStream( const DWFBufferOutputStream& );
00217     DWFBufferOutputStream& operator=( const DWFBufferOutputStream& );
00218 };
00219 
00220 }
00221 
00222 
00223 
00224 #endif

Generated on Tue Jan 6 22:39:28 2009 for Autodesk DWF Core Library by  doxygen 1.4.5