W3DStreamWriter.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-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 #ifndef _DWFW3DTK_STREAM_WRITER_H
00023 #define _DWFW3DTK_STREAM_WRITER_H
00024 
00029 
00030 #include "dwfcore/OutputStream.h"
00031 using namespace DWFCore;
00032 
00033 #include "dwf/Toolkit.h"
00034 #include "dwf/w3dtk/BStream.h"
00035 #include "dwf/w3dtk/W3DOpcodeHandler.h"
00036 #include "dwf/w3dtk/BStreamFileToolkit.h"
00037 
00038 
00039 //
00040 // default write 4k buffer
00041 //
00042 #ifndef DWFW3D_STREAM_WRITER_BUFFER_BYTES
00043 #define DWFW3D_STREAM_WRITER_BUFFER_BYTES                   4096
00044 #endif
00045 
00046 //
00047 // the maximum stack buffer allowed
00048 // this only applies if stacking buffer was not specified explicitly
00049 //
00050 #ifndef DWFW3D_STREAM_WRITER_USE_STACK_BUFFER_MAX_BYTES
00051 #define DWFW3D_STREAM_WRITER_USE_STACK_BUFFER_MAX_BYTES     16384
00052 #endif
00053 
00054 //
00055 // for small enough buffers, use the stack - it will be faster
00056 // ideally this value should be defined in the project
00057 // this only applies if stacking buffer was not specified explicitly
00058 //
00059 #ifndef DWFW3D_STREAM_WRITER_USE_STACK_BUFFER
00060 #if    (DWFW3D_STREAM_WRITER_BUFFER_BYTES <= DWFW3D_STREAM_WRITER_USE_STACK_BUFFER_MAX_BYTES)
00061 #define DWFW3D_STREAM_WRITER_USE_STACK_BUFFER
00062 #endif
00063 #endif
00064 
00065 //
00066 // the minimum version number
00067 // this is the earliest stream version that we ever supported
00068 //
00069 #ifndef DWFW3D_STREAM_WRITER_EARLIEST_VERSION
00070 #define DWFW3D_STREAM_WRITER_EARLIEST_VERSION     1000
00071 #endif
00072 
00079 class BBINFILETK_API W3DStreamWriter : public BaseOpcodeHandlerObserver
00080 {
00081 
00082 public:
00083 
00091     W3DStreamWriter( DWFOutputStream&       rW3DStream,
00092                      BStreamFileToolkit&    rToolkit )
00093        throw();
00094 
00100     ~W3DStreamWriter()
00101         throw();
00102 
00112     void open( unsigned int nRequestedVersion = 0 )
00113         throw( DWFException );
00114 
00125     unsigned int close()
00126         throw( DWFException );
00127 
00131     void notify( BBaseOpcodeHandler* pHandler,
00132                  const void*         pTag = NULL )
00133         throw( DWFException );
00134 
00135 private:
00136 
00137     DWFOutputStream&    _rStream;
00138     BStreamFileToolkit& _rToolkit;
00139     bool                _bOpen;
00140     unsigned int        _nRequiredVersion;
00141 
00142 #ifdef  DWFW3D_STREAM_WRITER_USE_STACK_BUFFER
00143 
00144     char                _pBuffer[DWFW3D_STREAM_WRITER_BUFFER_BYTES];
00145 
00146 #else
00147 
00148     char*               _pBuffer;
00149 
00150 #endif
00151 
00152 private:
00153 
00154     //
00155     // Not implemented
00156     //
00157 
00158     W3DStreamWriter();
00159     W3DStreamWriter( const W3DStreamWriter& W3DStreamWriter );
00160     W3DStreamWriter& operator=( const W3DStreamWriter& W3DStreamWriter );
00161 };
00162 
00163 
00164 
00165 #endif

Generated on Tue Jan 6 22:41:37 2009 for Autodesk DWF 3D Toolkit by  doxygen 1.4.5