object_stream.h

Go to the documentation of this file.
00001 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00002 //
00003 //  By using this code, you are agreeing to the terms and conditions of
00004 //  the License Agreement included in the documentation for this code.
00005 //
00006 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00007 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00008 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00009 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00010 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00011 //
00012 //  Use, duplication, or disclosure by the U.S. Government is subject to
00013 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00014 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00015 //  Data and Computer Software), as applicable.
00016 //
00017 
00021 
00022 
00023 
00024 #if !defined OBJECT_STREAM_HEADER
00025 #define OBJECT_STREAM_HEADER
00026 
00027 #include "whiptk/whipcore.h"
00028 #include "whiptk/object.h"
00029 
00030 
00031 class WHIPTK_API WT_Object_Stream : public WT_Object 
00032 {
00033         friend class WT_W2D_Class_Factory;
00034 public:
00036     WT_Object_Stream();
00037     
00039         WT_Object_Stream(WT_Object_Stream const& object_stream)
00040         {
00041                 *this = object_stream;
00042         }
00043 
00045     virtual ~WT_Object_Stream();
00046 
00047 public: 
00048     // operations
00049     // Enumeration capabilities
00050     void                reset() const;
00051     WT_Boolean          get_next() const;
00052     const WT_Object*    object() const;
00053 
00054     void                set_owner( WT_Boolean bOwn ) { m_streamOwner = bOwn; }
00055 
00056 protected:
00057     
00059     virtual WT_ID      object_id() const { return Unknown_ID; }
00060 
00062     WT_Type    object_type() const { return Unknown; }
00063 
00064         virtual WT_Result        serialize (
00065         WT_File & /*file*/ 
00066         ) const { return WT_Result::Toolkit_Usage_Error; }
00067 
00068         virtual WT_Result        process(WT_File & /*file*/) { return WT_Result::Toolkit_Usage_Error; }
00070     virtual WT_Result    materialize(WT_Opcode const & /* opcode */, WT_File & /* file */) {
00071         return WT_Result::Toolkit_Usage_Error;
00072     }
00073     // Adds another item to the end of the definition stream
00074     // Note this method takes ownership of the object
00075     virtual WT_Result           addObject(const WT_Object* object);
00076     // Read/Write from file.
00077     virtual WT_Result           serialize_stream(WT_File&) const;
00078     virtual WT_Result           materialize_stream(WT_Opcode const &, WT_File&);
00079 
00080     // Derivations can override to keep track of opcodes as they are added
00081     virtual WT_Result   on_materialize(WT_Object& , WT_File&); 
00082     
00083 private:
00084     // private methods
00085     void                add_to_array( const WT_Object* object);
00086 
00087     // private data members
00088     const WT_Object**   m_ppArray;
00089     unsigned int        m_allocated;
00090     unsigned int        m_elements;
00091     mutable int         m_current;
00092     WT_Boolean          m_streamOwner;
00093 
00094 };
00095 
00096 #endif // OBJECT_STREAM_HEADER
00097 // End of file.

Generated on Tue Jan 6 22:41:13 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5