Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

DefinedObjectContainer.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, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 
00019 
00020 #ifndef _DWFTK_DEFINED_OBJECT_CONTAINER_H
00021 #define _DWFTK_DEFINED_OBJECT_CONTAINER_H
00022 
00027 
00028 
00029 #include "dwf/Toolkit.h"
00030 #include "dwf/package/DefinedObject.h"
00031 #include "dwf/package/utility/PropertyContainer.h"
00032 
00033 namespace DWFToolkit
00034 {
00035 
00043 class DWFDefinedObjectContainer
00044 {
00045 
00046 public:
00047 
00053     _DWFTK_API
00054     DWFDefinedObjectContainer()
00055         throw();
00056 
00062     _DWFTK_API
00063     virtual ~DWFDefinedObjectContainer()
00064         throw();
00065 
00080     _DWFTK_API
00081     void addObject( DWFDefinedObject* pObject, uint32_t nGroup = 0 )
00082         throw();
00083 
00091     _DWFTK_API
00092     DWFDefinedObject* findObject( const DWFString& zID )
00093         throw( DWFException );
00094 
00101     _DWFTK_API
00102     bool empty() const
00103         throw();
00104 
00112     _DWFTK_API
00113     DWFPropertyContainer& getObjectProperties()
00114         throw();
00115 
00116 #ifndef DWFTK_READ_ONLY
00117 
00125     DWFXMLSerializable& getSerializableObjectContainer() const
00126         throw()
00127     {
00128         return (DWFXMLSerializable&)_oSerializer;
00129     }
00130 
00131 #endif
00132 
00133 #ifndef DWFTK_READ_ONLY
00134 
00135 private:
00136 
00137     //
00138     // in order to avoid bizarre diamond patterns and
00139     // excessively overload base implementations,
00140     // all container classes must define and implementation this
00141     // internal [PRIVATE] class utility for serializing themselves into XML.
00142     //
00143     class _Serializer : public DWFXMLSerializable
00144     {
00145 
00146     public:
00147 
00148         _Serializer()
00149             throw()
00150             : DWFXMLSerializable()
00151             , _pContainer( NULL )
00152         {;}
00153 
00154         virtual ~_Serializer()
00155             throw()
00156         {;}
00157 
00158         void is( DWFDefinedObjectContainer* pContainer )
00159         {
00160             _pContainer = pContainer;
00161         }
00162 
00163         //
00164         //
00165         //
00166         virtual void serializeXML( DWFXMLSerializer& rSerializer, unsigned int nFlags )
00167             throw( DWFException );
00168 
00169     private:
00170 
00171         DWFDefinedObjectContainer* _pContainer;
00172     };
00173 
00174 private:
00175 
00176     _Serializer                 _oSerializer;
00177 
00178 #endif
00179 
00180 
00181 protected:
00182 
00186     DWFDefinedObject::tMap  _oKeyedObjects;
00190     DWFPropertyContainer    _oObjectProperties;
00191 
00195     typedef multimap<uint32_t, DWFDefinedObject*>   _tGroupedObjectMap;
00199     _tGroupedObjectMap      _oGroupedObjects;
00200 
00201 private:
00202 
00203     DWFDefinedObjectContainer( const DWFDefinedObjectContainer& );
00204     DWFDefinedObjectContainer& operator=( const DWFDefinedObjectContainer& );
00205 };
00206 
00207 
00215 class DWFDefinedObjectInstanceContainer
00216 {
00217 
00218 public:
00219 
00225     _DWFTK_API
00226     DWFDefinedObjectInstanceContainer()
00227         throw();
00228 
00234     _DWFTK_API
00235     virtual ~DWFDefinedObjectInstanceContainer()
00236         throw();
00237 
00252     _DWFTK_API
00253     void addInstance( DWFDefinedObjectInstance* pInstance, uint32_t nGroup = 0 )
00254         throw();
00255 
00262     _DWFTK_API
00263     bool empty() const
00264         throw();
00265 
00266 #ifndef DWFTK_READ_ONLY
00267 
00275     DWFXMLSerializable& getSerializableInstanceContainer() const
00276         throw()
00277     {
00278         return (DWFXMLSerializable&)_oSerializer;
00279     }
00280 
00281 #endif
00282 
00283 
00284 #ifndef DWFTK_READ_ONLY
00285 
00286 private:
00287 
00288     //
00289     // in order to avoid bizarre diamond patterns and
00290     // excessively overload base implementations,
00291     // all container classes must define and implementation this
00292     // internal [PRIVATE] class utility for serializing themselves into XML.
00293     //
00294     class _Serializer : public DWFXMLSerializable
00295     {
00296 
00297     public:
00298 
00299         _Serializer()
00300             throw()
00301             : DWFXMLSerializable()
00302             , _pContainer( NULL )
00303         {;}
00304 
00305         virtual ~_Serializer()
00306             throw()
00307         {;}
00308 
00309         void is( DWFDefinedObjectInstanceContainer* pContainer )
00310         {
00311             _pContainer = pContainer;
00312         }
00313 
00314         //
00315         //
00316         //
00317         virtual void serializeXML( DWFXMLSerializer& rSerializer, unsigned int nFlags )
00318             throw( DWFException );
00319 
00320     private:
00321 
00322         DWFDefinedObjectInstanceContainer* _pContainer;
00323     };
00324 
00325 private:
00326 
00327     _Serializer _oSerializer;
00328 
00329 #endif
00330 
00331 
00332 protected:
00333 
00337     typedef multimap<uint32_t, DWFDefinedObjectInstance*>   _tGroupedInstanceMap;
00341     _tGroupedInstanceMap    _oGroupedInstances;
00342 
00343 private:
00344 
00345     DWFDefinedObjectInstanceContainer( const DWFDefinedObjectInstanceContainer& );
00346     DWFDefinedObjectInstanceContainer& operator=( const DWFDefinedObjectInstanceContainer& );
00347 };
00348 
00349 }
00350 
00351 #endif

Generated on Tue May 17 12:38:50 2005 for Autodesk DWF Toolkit by  doxygen 1.4.1