Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

W3DStreamWriter.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-2005 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 
00071 class BBINFILETK_API W3DStreamWriter : public BaseOpcodeHandlerObserver
00072 {
00073 
00074 public:
00075 
00083     W3DStreamWriter( DWFOutputStream&       rW3DStream,
00084                      BStreamFileToolkit&    rToolkit )
00085        throw();
00086 
00092     ~W3DStreamWriter()
00093         throw();
00094 
00100     void open()
00101         throw( DWFException );
00102 
00109     void close()
00110         throw( DWFException );
00111 
00115     void notify( BBaseOpcodeHandler* pHandler,
00116                  const void*         pTag = NULL )
00117         throw( DWFException );
00118 
00119 private:
00120 
00121     DWFOutputStream&    _rStream;
00122     BStreamFileToolkit& _rToolkit;
00123     bool                _bOpen;
00124 
00125 #ifdef  DWFW3D_STREAM_WRITER_USE_STACK_BUFFER
00126 
00127     char                _pBuffer[DWFW3D_STREAM_WRITER_BUFFER_BYTES];
00128 
00129 #else
00130 
00131     char*               _pBuffer;
00132 
00133 #endif
00134 
00135 private:
00136 
00137     //
00138     // Not implemented
00139     //
00140 
00141     W3DStreamWriter();
00142     W3DStreamWriter( const W3DStreamWriter& W3DStreamWriter );
00143     W3DStreamWriter& operator=( const W3DStreamWriter& W3DStreamWriter );
00144 };
00145 
00146 
00147 
00148 #endif

Generated on Tue May 17 12:06:00 2005 for Autodesk DWF 3D Toolkit by  doxygen 1.4.1