StreamOutputBufferDescriptor.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_STREAM_OUTPUT_BUFFER_DESCRIPTOR_H
00024 #define _DWFCORE_STREAM_OUTPUT_BUFFER_DESCRIPTOR_H
00025 
00026 
00031 
00032 
00033 #include "dwfcore/FileDescriptor.h"
00034 
00035 
00036 namespace DWFCore
00037 {
00038 
00039 //
00040 //  fwd declarations
00041 //
00042 class DWFInputStream;
00043 class DWFOutputStream;
00044 
00045 
00053 class DWFStreamOutputBufferDescriptor : virtual public DWFCoreMemory
00054                                       , public DWFFileDescriptor
00055 {
00056 
00057 public:
00058 
00059     typedef enum teReadWriteMode {
00060         eRead,
00061         eWrite
00062     } teReadWriteMode;
00063 
00064 public:
00065 
00072     _DWFCORE_API 
00073     DWFStreamOutputBufferDescriptor( size_t nInitialBytes = 16384 )
00074         throw();
00075 
00081     _DWFCORE_API
00082     virtual ~DWFStreamOutputBufferDescriptor()
00083         throw();
00084 
00088     _DWFCORE_API 
00089     void open()
00090         throw( DWFException );
00091 
00095     _DWFCORE_API 
00096     void close()
00097         throw( DWFException );
00098 
00104     _DWFCORE_API
00105     void reset()
00106         throw();
00107 
00111     _DWFCORE_API 
00112     size_t size()
00113         throw( DWFException );
00114 
00128     _DWFCORE_API 
00129     size_t read( void* pBuffer, size_t nBytesToRead )
00130         throw( DWFException );
00131 
00142     _DWFCORE_API 
00143     off_t seek( int eOrigin, off_t nOffset )
00144         throw( DWFException );
00145 
00157     _DWFCORE_API 
00158     size_t write( const void* pBuffer, size_t nBytesToWrite )
00159         throw( DWFException );
00160 
00167     _DWFCORE_API 
00168     virtual void flush()
00169         throw( DWFException );
00170 
00177     _DWFCORE_API
00178     const unsigned char* buffer()
00179         throw()
00180     {
00181         return _pBuffer;
00182     }
00183 
00184 private:
00185 
00186     //
00187     //  The beginning of the output buffer
00188     //
00189     unsigned char*      _pBuffer;
00190     //
00191     //  The current location of the output pointer
00192     //
00193     unsigned char*      _pOutPtr;
00194     //
00195     //  The endpoint of the data. Unless the out pointer has been
00196     //  moved back using seek, usually this and _pOutPtr are the same.
00197     //
00198     unsigned char*      _pEndPtr;
00199 
00200     size_t              _nBufferBytes;
00201     size_t              _nInitialBytes;
00202 
00203 private:
00204 
00205     //
00206     // Unimplemented methods
00207     //
00208     DWFStreamOutputBufferDescriptor( const DWFStreamOutputBufferDescriptor& );
00209     DWFStreamOutputBufferDescriptor& operator=( const DWFStreamOutputBufferDescriptor& );
00210 };
00211 
00212 }
00213 
00214 
00215 #endif
00216 
00217 

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