Content.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 2005-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, 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 //  $Header: //DWF/Development/Components/Internal/DWF Toolkit/v7.6/develop/global/src/dwf/package/Content.h#2 $
00019 //  $DateTime: 2008/06/18 18:08:14 $
00020 //  $Author: gaoje $
00021 //  $Change: 101166 $
00022 //  $Revision: #2 $
00023 //
00024 
00025 #ifndef _DWFTK_CONTENT_H
00026 #define _DWFTK_CONTENT_H
00027 
00032 
00033 #include <set>
00034 #include "dwfcore/STL.h"
00035 #include "dwfcore/UUID.h"
00036 #include "dwfcore/Owner.h"
00037 #include "dwfcore/XMLParser.h"
00038 using namespace DWFCore;
00039 
00040 #include "dwf/Toolkit.h"
00041 #include "dwf/package/XML.h"
00042 #include "dwf/package/Class.h"
00043 #include "dwf/package/Group.h"
00044 #include "dwf/package/Object.h"
00045 #include "dwf/package/Entity.h"
00046 #include "dwf/package/Feature.h"
00047 #include "dwf/package/Instance.h"
00048 #include "dwf/package/PropertySet.h"
00049 #include "dwf/package/reader/ContentReader.h"
00050 #include "dwf/package/reader/ContentResourceReader.h"
00051 
00052 namespace DWFToolkit
00053 {
00054 
00065 class DWFContent : public DWFContentReader
00066                  , public DWFContentResourceReader
00067                  , public DWFOwnable
00068                  , public DWFXMLBuildable
00069 #ifndef DWFTK_READ_ONLY
00070                  , public DWFXMLSerializable
00071 #endif
00072                  _DWFTK_EXPORT_API_MEMORY_CONTROL_BASE_MEMBER
00073 {
00074 
00075     //
00076     // Certain content operations should only be performed by the content manager
00077     //
00078     friend class DWFContentManager;
00079 
00080 public:
00081 
00085     typedef DWFOrderedVector<DWFContent*>           tList;
00089     typedef DWFStringKeySkipList<DWFContent*>       tMap;
00093     typedef DWFIterator<DWFContent*>                tIterator;
00097     typedef DWFCachingIterator<DWFContent*>         tCachingIterator;
00098 
00102     typedef DWFXMLBuildable::tUnresolvedList        tUnresolvedList;
00103 
00107     typedef DWFIterator<DWFString>                  DWFStringIterator;
00108 
00109 public:
00110 
00114     static const char* const kzExtension_ContentXML;
00115 
00116 public:
00117 
00132     _DWFTK_API
00133     DWFContent( DWFPackageReader* pPackageReader, const DWFString& zID = /*NOXLATE*/L"" )
00134         throw( DWFException );
00135 
00147     _DWFTK_API
00148     DWFContent( DWFContentManager* pContentManager, const DWFString& zID = /*NOXLATE*/L"" )
00149         throw( DWFException );
00150 
00156     _DWFTK_API
00157     ~DWFContent()
00158         throw();
00159 
00166     _DWFTK_API
00167     const DWFString& id() const
00168         throw()
00169     {
00170         return _zID;
00171     }
00172 
00180     _DWFTK_API
00181     void setHRef( const DWFString& zHRef)
00182         throw()
00183     {
00184         _zHREF = zHRef;
00185     }
00186 
00193     _DWFTK_API
00194     DWFString href()
00195         throw();
00196 
00204     _DWFTK_API
00205     bool isLoaded() const
00206         throw()
00207     {
00208         return _bElementsLoaded;
00209     }
00210 
00220     _DWFTK_API
00221     bool isResourceLoaded( const DWFString& zResourceObjectID )
00222         throw();
00223 
00232     _DWFTK_API
00233     DWFClass::tIterator* findClassByBaseClass( DWFClass* pBaseClass )
00234         throw();
00235 
00244     _DWFTK_API
00245     DWFClass::tIterator* findClassByBaseClass( const DWFString& zID )
00246         throw();
00247 
00256     _DWFTK_API
00257     DWFEntity::tIterator* findEntitiesByClass( DWFClass* pClass )
00258         throw();
00259 
00268     _DWFTK_API
00269     DWFEntity::tIterator* findEntitiesByClass( const DWFString& zID )
00270         throw();
00271 
00280     _DWFTK_API
00281     DWFFeature::tIterator* findFeaturesByClass( DWFClass* pClass )
00282         throw();
00283 
00292     _DWFTK_API
00293     DWFFeature::tIterator* findFeaturesByClass( const DWFString& zID )
00294         throw();
00295 
00304     _DWFTK_API
00305     DWFObject::tIterator* findObjectsByEntity( DWFEntity* pEntity )
00306         throw();
00307 
00316     _DWFTK_API
00317     DWFObject::tIterator* findObjectsByEntity( const DWFString& zID )
00318         throw();
00319 
00328     _DWFTK_API
00329     DWFEntity::tIterator* findEntitiesByFeature( DWFFeature* pFeature )
00330         throw();
00331 
00340     _DWFTK_API
00341     DWFEntity::tIterator* findEntitiesByFeature( const DWFString& zID )
00342         throw();
00343 
00352     _DWFTK_API
00353     DWFObject::tIterator* findObjectsByFeature( DWFFeature* pFeature )
00354         throw();
00355 
00364     _DWFTK_API
00365     DWFObject::tIterator* findObjectsByFeature( const DWFString& zID )
00366         throw();
00367 
00376     _DWFTK_API
00377     DWFGroup::tIterator* findGroupsByElement( DWFContentElement* pElement )
00378         throw();
00379 
00388     _DWFTK_API
00389     DWFGroup::tIterator* findGroupsByElement( const DWFString& zID )
00390         throw();
00391 
00401     _DWFTK_API
00402     DWFInstance::tIterator* findInstancesByRenderable( DWFRenderable* pRendered, 
00403                                                        const DWFString& zResourceObjectID = /*NOXLATE*/L"" )
00404         throw();
00405 
00415     _DWFTK_API
00416     DWFInstance::tIterator* findInstancesByRenderable( const DWFString& zRenderedID,
00417                                                        const DWFString& zResourceObjectID = /*NOXLATE*/L"" )
00418         throw();
00419 
00428     _DWFTK_API
00429     DWFInstance::tIterator* findInstancesByResourceID( const DWFString& zResourceObjectID ) const
00430         throw( DWFException );
00431 
00442     _DWFTK_API
00443     DWFIterator<DWFString>* findResourceIDsByRenderable( DWFRenderable* pRenderable )
00444         throw();
00445 
00456     _DWFTK_API
00457     DWFIterator<DWFString>* findResourceIDsByRenderable( const DWFString& zID )
00458         throw();
00459 
00467     _DWFTK_API
00468     void setContentManager( DWFContentManager* pContentManager )
00469     {
00470         _pContentManager = pContentManager;
00471     }
00472 
00479     _DWFTK_API
00480     DWFContentManager* getContentManager()
00481         throw()
00482     {
00483         return _pContentManager;
00484     }
00485 
00494     _DWFTK_API
00495     DWFClass* getClass( const DWFString& zID )
00496         throw();
00497 
00506     _DWFTK_API
00507     DWFFeature* getFeature( const DWFString& zID )
00508         throw();
00509 
00518     _DWFTK_API
00519     DWFEntity* getEntity( const DWFString& zID )
00520         throw();
00521 
00530     _DWFTK_API
00531     DWFObject* getObject( const DWFString& zID )
00532         throw();
00533 
00542     _DWFTK_API
00543     DWFGroup* getGroup( const DWFString& zID )
00544         throw();
00545 
00556     _DWFTK_API
00557     DWFContentElement* getElement( const DWFString& zID )
00558         throw();
00559 
00568     _DWFTK_API
00569     DWFInstance* getInstance( const DWFString& zID )
00570         throw();
00571 
00580     _DWFTK_API
00581     DWFPropertySet* getSharedPropertySet( const DWFString& zID )
00582         throw();
00583 
00591     _DWFTK_API
00592     DWFClass::tMap::Iterator* getClasses()
00593         throw()
00594     {
00595         return _oClasses.iterator();
00596     }
00597 
00605     _DWFTK_API
00606     DWFFeature::tMap::Iterator* getFeatures()
00607         throw()
00608     {
00609         return _oFeatures.iterator();
00610     }
00611 
00612 
00620     _DWFTK_API
00621     DWFEntity::tMap::Iterator* getEntities()
00622         throw()
00623     {
00624         return _oEntities.iterator();
00625     }
00626 
00627 
00635     _DWFTK_API
00636     DWFObject::tMap::Iterator* getObjects()
00637         throw()
00638     {
00639         return _oObjects.iterator();
00640     }
00641 
00649     _DWFTK_API
00650     DWFGroup::tMap::Iterator* getGroups()
00651         throw()
00652     {
00653         return _oGroups.iterator();
00654     }
00655 
00663     _DWFTK_API
00664     DWFInstance::tMap::Iterator* getInstances()
00665         throw()
00666     {
00667         return _oInstances.iterator();
00668     }
00669 
00677     _DWFTK_API
00678     DWFPropertySet::tMap::Iterator* getSharedPropertySets()
00679         throw()
00680     {
00681         return _oSharedProperties.iterator();
00682     }
00683 
00693     _DWFTK_API
00694     DWFClass* addClass( const DWFClass::tList& oBaseClass,
00695                         const DWFString& zUUID = /*NOXLATE*/L"" )
00696         throw( DWFException );
00697 
00707     _DWFTK_API
00708     DWFClass* addClass( DWFClass* pBaseClass = NULL,
00709                         const DWFString& zUUID = /*NOXLATE*/L"" )
00710         throw( DWFException );
00711 
00723     _DWFTK_API
00724     DWFEntity* addEntity( const DWFClass::tList& oClass,
00725                           DWFEntity* pParentEntity = NULL,
00726                           const DWFString& zUUID = /*NOXLATE*/L"" )
00727         throw( DWFException );
00728 
00740     _DWFTK_API
00741     DWFEntity* addEntity( DWFClass* pClass,
00742                           DWFEntity* pParentEntity = NULL,
00743                           const DWFString& zUUID = /*NOXLATE*/L"" )
00744         throw( DWFException );
00745 
00756     _DWFTK_API
00757     DWFEntity* addEntity( DWFEntity* pParentEntity = NULL,
00758                           const DWFString& zUUID = /*NOXLATE*/L"" )
00759         throw( DWFException );
00760 
00773     _DWFTK_API
00774     DWFObject* addObject( DWFEntity* pRealizedEntity,
00775                           DWFObject* pParentObject = NULL,
00776                           const DWFString& zUUID = /*NOXLATE*/L"" )
00777         throw( DWFException );
00778 
00788     _DWFTK_API
00789     DWFFeature* addFeature( const DWFClass::tList& oClass,
00790                             const DWFString& zUUID = /*NOXLATE*/L"" )
00791         throw( DWFException );
00792 
00802     _DWFTK_API
00803     DWFFeature* addFeature( DWFClass* pClass = NULL,
00804                             const DWFString& zUUID = /*NOXLATE*/L"" )
00805         throw( DWFException );
00806 
00816     _DWFTK_API
00817     DWFGroup* addGroup( const DWFContentElement::tList& oElements,
00818                         const DWFString& zUUID = /*NOXLATE*/L"" )
00819         throw( DWFException );
00820 
00829     _DWFTK_API
00830     DWFGroup* addGroup( const DWFString& zUUID = /*NOXLATE*/L"" )
00831         throw( DWFException );
00832 
00843     _DWFTK_API
00844     DWFPropertySet* addSharedPropertySet( const DWFString& zLabel = /*NOXLATE*/L"",
00845                                           const DWFString& zUUID = /*NOXLATE*/L"" )
00846         throw();
00847 
00860     _DWFTK_API
00861     DWFInstance* addInstance( const DWFString& zResourceID, 
00862                               DWFRenderable* pRenderable,
00863                               int oNodeID,
00864                               unsigned int nGraphicsAttribute = DWFInstance::eVisible,
00865                               int nGeometricVariationIndex = -1 )
00866         throw( DWFException );
00867 
00875     _DWFTK_API
00876     void removeClass( DWFClass* pClass )
00877         throw();
00878 
00886     _DWFTK_API
00887     void removeClass( const DWFString& zID )
00888         throw();
00889 
00899     _DWFTK_API
00900     void removeEntity( DWFEntity* pEntity )
00901         throw();
00902 
00912     _DWFTK_API
00913     void removeEntity( const DWFString& zID )
00914         throw();
00915 
00924     _DWFTK_API
00925     void removeObject( DWFObject* pObject )
00926         throw();
00927 
00936     _DWFTK_API
00937     void removeObject( const DWFString& zID )
00938         throw();
00939 
00949     _DWFTK_API
00950     void removeFeature( DWFFeature* pFeature )
00951         throw();
00952 
00962     _DWFTK_API
00963     void removeFeature( const DWFString& zID )
00964         throw();
00965 
00972     _DWFTK_API
00973     void removeGroup( DWFGroup* pGroup )
00974         throw();
00975 
00982     _DWFTK_API
00983     void removeGroup( const DWFString& zID )
00984         throw();
00985 
00992     _DWFTK_API
00993     void removeInstance( DWFInstance* pInstance )
00994         throw();
00995 
01002     _DWFTK_API
01003     void removeInstance( const DWFString& zID )
01004         throw();
01005 
01012     _DWFTK_API
01013     void removeSharedPropertySet( DWFPropertySet* pPropertySet )
01014         throw();
01015     
01022     _DWFTK_API
01023     void removeSharedPropertySet( const DWFString& zID )
01024         throw();
01025 
01033     _DWFTK_API
01034     void addBaseClassToClass( DWFClass* pClass,
01035                               DWFClass* pBaseClass )
01036         throw();
01037 
01045     _DWFTK_API
01046     void addClassToEntity( DWFEntity* pEntity, 
01047                            DWFClass* pClass )
01048         throw();
01049     
01057     _DWFTK_API
01058     void addClassToFeature( DWFFeature* pFeature,
01059                             DWFClass* pClass )
01060         throw();
01061 
01069     _DWFTK_API
01070     void addFeatureToEntity( DWFEntity* pEntity,
01071                              DWFFeature* pFeature )
01072         throw();
01073 
01081     _DWFTK_API
01082     void addFeatureToObject( DWFObject* pObject,
01083                              DWFFeature* pFeature )
01084         throw();
01085 
01100     _DWFTK_API
01101     void addChildEntity( DWFEntity* pParentEntity,
01102                          DWFEntity* pChildEntity )
01103         throw();
01104     
01116     _DWFTK_API
01117     void addChildObject( DWFObject* pParentObject,
01118                          DWFObject* pChildObject )
01119         throw();
01120 
01128     _DWFTK_API
01129     void addElementToGroup( DWFGroup* pGroup,
01130                             DWFContentElement* pElement )
01131         throw();
01132 
01143     _DWFTK_API
01144     void addSharedPropertySetToElement( DWFContentElement* pElement,
01145                                         DWFPropertySet* pPropertySet )
01146         throw( DWFException );
01147 
01157     _DWFTK_API
01158     void addReferenceToPropertySet( DWFPropertySet* pReferingSet,
01159                                     DWFPropertySet* pPropertySet )
01160         throw( DWFException );
01161 
01169     _DWFTK_API
01170     void removeBaseClassFromClass( DWFClass* pClass,
01171                                    DWFClass* pBaseClass )
01172         throw();
01173     
01181     _DWFTK_API
01182     void removeClassFromEntity( DWFEntity* pEntity,
01183                                 DWFClass* pClass )
01184         throw();
01185     
01193     _DWFTK_API
01194     void removeClassFromFeature( DWFFeature* pFeature,
01195                                  DWFClass* pClass )
01196         throw();
01197 
01205     _DWFTK_API
01206     void removeFeatureFromEntity( DWFEntity* pEntity,
01207                                   DWFFeature* pFeature )
01208         throw();
01209     
01217     _DWFTK_API
01218     void removeFeatureFromObject( DWFObject* pObject,
01219                                   DWFFeature* pFeature )
01220         throw();
01221 
01229     _DWFTK_API
01230     void removeChildEntity( DWFEntity* pParentEntity,
01231                             DWFEntity* pChildEntity )
01232         throw();
01233     
01241     _DWFTK_API
01242     void removeChildObject( DWFObject* pParentObject,
01243                             DWFObject* pChildObject )
01244         throw();
01245 
01253     _DWFTK_API
01254     void removeElementFromGroup( DWFGroup* pGroup,
01255                                  DWFContentElement* pElement )
01256         throw();
01257 
01265     _DWFTK_API
01266     void removeSharedPropertySetFromElement( DWFContentElement* pElement,
01267                                              DWFPropertySet* pPropertySet )
01268         throw();
01269 
01278     _DWFTK_API
01279     DWFUUID* getIDProvider() const
01280         throw( DWFException );
01281 
01282 #ifndef DWFTK_READ_ONLY
01283 
01287     _DWFTK_API
01288     const DWFXMLNamespace& addNamespace( const DWFString& zNamespace, 
01289                                          const DWFString& zXMLNS )
01290         throw( DWFException );
01291 
01295     _DWFTK_API
01296     void serializeXML( DWFXMLSerializer& rSerializer, unsigned int nFlags )
01297         throw( DWFException );
01298 
01307     _DWFTK_API
01308     void setResourceForSerialization( const DWFString& zResourceID )
01309         throw()
01310     {
01311         _zSerializingResource = zResourceID;
01312     }
01313 
01314 #endif
01315 
01319     _DWFTK_API
01320     virtual void parseAttributeList( const char** ppAttributeList )
01321         throw( DWFException );
01322 
01323 public:
01324 
01331     _DWFTK_API
01332     DWFContentReader* getContentReader()
01333     {
01334         return this;
01335     }
01336 
01343     _DWFTK_API
01344     DWFContentResourceReader* getContentResourceReader()
01345     {
01346         return this;
01347     }
01348 
01361     _DWFTK_API
01362     virtual void load( DWFContentReader* pReaderFilter = NULL,
01363                        unsigned int nProviderFlags = DWFContentReader::eProvideAll )
01364         throw( DWFException );
01365 
01375     _DWFTK_API
01376     virtual void load( DWFContentReader& rCustomReader )
01377         throw( DWFException );
01378 
01393     _DWFTK_API
01394     virtual bool unload( bool bSkipIfAnyResourceModified = true )
01395         throw( DWFException );
01396 
01414     _DWFTK_API
01415     virtual bool unloadResourceInstances( const DWFString& zResourceObjectID, 
01416                                           bool bSkipIfResourceModified = true )
01417         throw();
01418 
01419 
01427     _DWFTK_API
01428     DWFInputStream* getInputStream()
01429         throw( DWFException );
01430 
01439     _DWFTK_API
01440     void mergeContent( DWFContent* pContent, bool bLocalHasPriority )
01441         throw( DWFException );
01442 
01452     _DWFTK_API
01453     DWFStringIterator* modifiedContentResources()
01454         throw();
01455 
01463     _DWFTK_API
01464     bool isSectionContentResourceModified( const DWFString zResourceObjectID ) const
01465         throw()
01466     {
01467         return (_oModifiedContentResources.count( zResourceObjectID ) == 1);
01468     }
01469 
01470 public:
01471 
01479     _DWFTK_API
01480     void notifyContentResourceAdded( const DWFString& zObjectID )
01481         throw();
01482 
01492     _DWFTK_API
01493     void notifyResourceIDUpdated( const DWFString& zOldObjectID, const DWFString& zNewObjectID )
01494         throw();
01495 
01496 public:
01497 
01501     _DWFTK_API
01502     virtual const char* provideVersion( const char* zVersion )
01503         throw( DWFException );
01504 
01508     _DWFTK_API
01509     virtual DWFClass* provideClass( DWFClass* pClass,
01510                                     const tUnresolvedList& rUnresolved )
01511         throw( DWFException );
01512 
01516     _DWFTK_API
01517     virtual DWFFeature* provideFeature( DWFFeature* pFeature,
01518                                         const tUnresolvedList& rUnresolved )
01519         throw( DWFException );
01520 
01524     _DWFTK_API
01525     virtual DWFEntity* provideEntity( DWFEntity* pEntity,
01526                                       const tUnresolvedList& rUnresolved )
01527         throw( DWFException );
01528 
01532     _DWFTK_API
01533     virtual DWFObject* provideObject( DWFObject* pObject,
01534                                       const tUnresolvedList& rUnresolved )
01535         throw( DWFException );
01536 
01540     _DWFTK_API
01541     virtual DWFObject* provideChildObject( DWFObject* pObject,
01542                                            DWFObject* pParent,
01543                                            const tUnresolvedList& rUnresolved )
01544        throw( DWFException );
01545 
01549     _DWFTK_API
01550     virtual DWFGroup* provideGroup( DWFGroup* pGroup,
01551                                     const tUnresolvedList& rUnresolved )
01552         throw( DWFException );
01553 
01557     _DWFTK_API
01558     virtual DWFPropertySet* provideSharedProperty( DWFPropertySet* pPropertySet,
01559                                                    const tUnresolvedList& rUnresolved )
01560         throw( DWFException );
01561 
01565     _DWFTK_API
01566     virtual DWFPropertySet* providePropertySet( DWFPropertySet* pPropertySet,
01567                                                 DWFPropertyContainer* pContainer,
01568                                                 const tUnresolvedList& rUnresolved )
01569         throw( DWFException );
01570 
01574     _DWFTK_API
01575     virtual DWFInstance* provideInstance( DWFInstance* pInstance, 
01576                                           const DWFString& zRenderableID,
01577                                           const DWFString& zResourceObjectID )
01578         throw( DWFException );
01579 
01583     _DWFTK_API
01584     virtual void resolveClasses()
01585         throw();
01586 
01590     _DWFTK_API
01591     virtual void resolveFeatures()
01592         throw();
01593 
01597     _DWFTK_API
01598     virtual void resolveEntities()
01599         throw();
01600 
01604     _DWFTK_API
01605     virtual void resolveObjects()
01606         throw();
01607 
01611     _DWFTK_API
01612     virtual void resolveGroups()
01613         throw();
01614 
01618     _DWFTK_API
01619     virtual void resolvePropertySets()
01620         throw();
01621 
01625     _DWFTK_API
01626     virtual void resolveInstances()
01627         throw();
01628 
01629 private:
01630 
01631     //
01632     //  Let the content manager reset the id for aggregation purposes
01633     //  This will not reset the href unless package reader is null.
01634     //
01635     _DWFTK_API
01636     void identify( const DWFString& zID )
01637         throw();
01638 
01639 private:
01640 
01641     //
01642     // Remove all mapping between given class and other classes
01643     //
01644     _DWFTK_API
01645     void _removeClassToClassMappings( DWFClass* pClass )
01646         throw();
01647 
01648     //
01649     // Remove all mappings of the given class to entities
01650     //
01651     _DWFTK_API
01652     void _removeClassToEntityMappings( DWFClass* pClass )
01653         throw();
01654 
01655     //
01656     // Remove all mappings of the given class to features
01657     //
01658     _DWFTK_API
01659     void _removeClassToFeatureMappings( DWFClass* pClass )
01660         throw();
01661 
01662     //
01663     // Remove all mappings of class to the given entity
01664     //
01665     _DWFTK_API
01666     void _removeClassToEntityMappings( DWFEntity* pEntity )
01667         throw();
01668 
01669     //
01670     // Remove all mappings of features to the given entity
01671     //
01672     _DWFTK_API
01673     void _removeFeatureToEntityMappings( DWFEntity* pEntity )
01674         throw();
01675 
01676     //
01677     // Remove references to and from pEntity with its parent and child entities
01678     //
01679     _DWFTK_API
01680     void _removeEntityToEntityMappings( DWFEntity* pEntity )
01681         throw();
01682 
01683     //
01684     // Remove all mappings of features to the given object
01685     //
01686     _DWFTK_API
01687     void _removeFeatureToObjectMappings( DWFObject* pObject )
01688         throw();
01689 
01690     //
01691     // Remove all mappings of groups to the given element
01692     //
01693     _DWFTK_API
01694     void _removeGroupToElementMappings( DWFContentElement* pElement )
01695         throw();
01696 
01697     //
01698     // Remove mappings between classes and the feature
01699     //
01700     _DWFTK_API
01701     void _removeClassToFeatureMappings( DWFFeature* pFeature )
01702         throw();
01703 
01704     //
01705     // Remove mappings between the feature and entities
01706     //
01707     _DWFTK_API
01708     void _removeFeatureToEntityMappings( DWFFeature* pFeature )
01709         throw();
01710 
01711     //
01712     // Remove mappings between the feature and objects
01713     //
01714     _DWFTK_API
01715     void _removeFeatureToObjectMappings( DWFFeature* pFeature )
01716         throw();
01717 
01718     //
01719     // The is called to remove an instance. Internally in some places it is
01720     // called to remove instance but not the mapping, e.g., when deleting objects
01721     // since the object deletion handles the map cleanup.
01722     // 
01723     _DWFTK_API
01724     void _removeInstance( DWFInstance* pInstance, 
01725                           bool bRemoveMappings = true )
01726         throw();
01727 
01728 private:
01729 
01730     _DWFTK_API
01731     void _identify( const DWFString& zID )
01732         throw()
01733     {
01734         _zID = zID;
01735     }
01736 
01737     //
01738     // Splitting the serialization into smaller chunks
01739     //
01740     _DWFTK_API
01741     void _serializeXMLSharedProperties( DWFXMLSerializer& rSerializer, 
01742                                         unsigned int nFlags )
01743         throw( DWFException );
01744 
01745     _DWFTK_API
01746     void _serializeXMLClasses( DWFXMLSerializer& rSerializer, 
01747                                unsigned int nFlags )
01748         throw( DWFException );
01749 
01750     _DWFTK_API
01751     void _serializeXMLFeatures( DWFXMLSerializer& rSerializer, 
01752                                 unsigned int nFlags )
01753         throw( DWFException );
01754 
01755     _DWFTK_API
01756     void _serializeXMLEntities( DWFXMLSerializer& rSerializer, 
01757                                 unsigned int nFlags )
01758         throw( DWFException );
01759 
01760     _DWFTK_API
01761     void _serializeXMLObjects( DWFXMLSerializer& rSerializer, 
01762                                unsigned int nFlags )
01763         throw( DWFException );
01764 
01765     _DWFTK_API
01766     void _serializeXMLGroups( DWFXMLSerializer& rSerializer, 
01767                               unsigned int nFlags )
01768         throw( DWFException );
01769 
01770     _DWFTK_API
01771     void _parseContentDocument( DWFInputStream& rDocumentStream,
01772                                 DWFCore::DWFXMLCallback& rDocumentReader )
01773         throw( DWFException );
01774 
01775 private:
01776 
01777     typedef DWFIterator<DWFString>              _tStringIterator;
01778 
01779 private:
01780 
01781     _tStringIterator* _tokenizeBySpace( const DWFString& zInput )
01782         throw();
01783 
01784     void _mergeSharedProperties( DWFContent* pContent, bool bLocalHasPriority )
01785         throw();
01786 
01787     void _mergeClasses( DWFContent* pContent, bool bLocalHasPriority )
01788         throw();
01789 
01790     void _mergeFeatures( DWFContent* pContent, bool bLocalHasPriority )
01791         throw();
01792 
01793     void _mergeEntities( DWFContent* pContent, bool bLocalHasPriority )
01794         throw();
01795 
01796     void _mergeObjects( DWFContent* pContent, bool bLocalHasPriority )
01797         throw( DWFException );
01798 
01799     void _mergeGroups( DWFContent* pContent, bool bLocalHasPriority )
01800         throw();
01801 
01802     void _mergeRefsSharedProperties( DWFContent* pContent )
01803         throw( DWFException );
01804 
01805     void _mergeRefsClasses( DWFContent* pContent )
01806         throw( DWFException );
01807 
01808     void _mergeRefsFeatures( DWFContent* pContent )
01809         throw( DWFException );
01810 
01811     void _mergeRefsEntities( DWFContent* pContent )
01812         throw( DWFException );
01813 
01814     void _mergeRefsObjects( DWFContent* pContent )
01815         throw( DWFException );
01816 
01817     void _mergeRefsGroups( DWFContent* pContent )
01818         throw( DWFException );
01819 
01820     void _acquireOwnedProperties( DWFPropertySet* pFrom, DWFPropertySet* pTo,
01821                                   bool bLocalHasPriority, bool bTargetExisted )
01822         throw();
01823 
01824     void _acquirePropertySetReferences( DWFPropertySet* pFrom, DWFPropertySet* pTo )
01825         throw( DWFException );
01826 
01827     void _acquireChildObjects( DWFObject* pFrom, DWFObject* pTo,
01828                                bool bLocalHasPriority )
01829         throw( DWFException );
01830 
01831 
01832 private:
01833 
01834     //
01835     // Maps to enable property inheritance heirarchy
01836     //
01837     typedef std::multimap<DWFClass*, DWFClass*>                     _tClassToClassMultiMap;
01838     typedef std::multimap<DWFClass*, DWFEntity*>                    _tClassToEntityMultiMap;
01839     typedef std::multimap<DWFClass*, DWFFeature*>                   _tClassToFeatureMultiMap;
01840     typedef std::multimap<DWFEntity*, DWFObject*>                   _tEntityToObjectMultiMap;
01841     typedef std::multimap<DWFFeature*, DWFEntity*>                  _tFeatureToEntityMultiMap;
01842     typedef std::multimap<DWFFeature*, DWFObject*>                  _tFeatureToObjectMultiMap;
01843 
01844     //
01845     // Maps to allow lower objects to determine their who references them
01846     //
01847     typedef std::multimap<DWFContentElement*, DWFGroup*>            _tElementToGroupMultiMap;
01848     typedef std::multimap<DWFPropertySet*, DWFPropertySet*>         _tSetToSetMultiMap;
01849 
01850     //
01851     // Instances are referenced via a two dimensional map, from resource object ID and renderable object
01852     //
01853     typedef std::multimap<DWFRenderable*, DWFInstance*>             _tRenderableToInstanceMultiMap;
01854     typedef std::map<DWFString, _tRenderableToInstanceMultiMap*>    _tResourceRenderableToInstanceMap;
01855     typedef _tResourceRenderableToInstanceMap::iterator             _tResourceRIMapIterator;
01856     typedef _tResourceRenderableToInstanceMap::const_iterator       _tResourceRIMapConstIterator;
01857 
01858     //
01859     //  These are used for intermediate storage during reading or merging, 
01860     //  to allow delayed resolution of IDs to pointers.
01861     //
01862     typedef std::multimap<DWFClass*, DWFString>                     _tClassToRefs;
01863     typedef std::multimap<DWFEntity*, DWFString>                    _tEntityToRefs;
01864     typedef std::multimap<DWFGroup*, DWFString>                     _tGroupToRefs;
01865     typedef std::multimap<DWFPropertyContainer*, DWFString>         _tContainerToRef;
01866     typedef std::map<DWFPropertySet*, DWFPropertySet*>              _tSetToSet;
01867 
01868     //
01869     //  
01870     //
01871     typedef std::set<DWFString>                                     _tSetOfIDs;
01872 
01873         //
01874         // Used for storage of extended namespaces.
01875         //
01876 #ifndef DWFTK_READ_ONLY
01877     typedef std::map<DWFString, DWFXMLNamespace>    _tNamespaceMap;
01878     _tNamespaceMap     _oAddedNamespaces;
01879 #endif
01880 
01881 private:
01882 
01883     DWFString                           _zID;
01884     DWFString                           _zHREF;
01885 
01886     DWFContentManager*                  _pContentManager;
01887     DWFPackageReader*                   _pPackageReader;
01888 
01889     //
01890     //  Container classes: mapping UUID to element pointer
01891     //
01892     DWFClass::tMap                      _oClasses;
01893     DWFFeature::tMap                    _oFeatures;
01894     DWFEntity::tMap                     _oEntities;
01895     DWFObject::tMap                     _oObjects;
01896     DWFGroup::tMap                      _oGroups;
01897     DWFInstance::tMap                   _oInstances;
01898     //
01899     //  Container for common properties referenced by the ODM elements. 
01900     //  These will be explicitly deleted in the content destructor.
01901     //
01902     DWFPropertySet::tMap                _oSharedProperties;
01903     //
01904     //  Container for property set lookup, for properties not in the shared
01905     //  property container - after completing read. These are deleted by
01906     //  the owner elements and sets.
01907     //
01908     DWFPropertySet::tMap                _oRefProperties;
01909 
01910     //
01911     //  Mappings allowing downward traversal in the ODM heirarchy.
01912     //
01913     _tClassToClassMultiMap              _oBaseClassToClass;
01914     _tClassToEntityMultiMap             _oClassToEntity;
01915     _tClassToFeatureMultiMap            _oClassToFeature;
01916     _tEntityToObjectMultiMap            _oEntityToObject;
01917     _tFeatureToEntityMultiMap           _oFeatureToEntity;
01918     _tFeatureToObjectMultiMap           _oFeatureToObject;
01919     _tElementToGroupMultiMap            _oElementToGroup;
01920     _tSetToSetMultiMap                  _oSetToSet;
01921     //
01922     //  mapping resource object GUIDs and object pointer to instance pointer
01923     //
01924     _tResourceRenderableToInstanceMap   _oResourceRenderableToInstance;
01925 
01926     //
01927     //  The load state of the content. If a content is created as a result of reading a
01928     //  package, then the content can be in a state where the content elements have not
01929     //  been loaded.
01930     //  If the content is created for publishing, or be other means this will be true.
01931     //
01932     bool                                _bElementsLoaded;
01933 
01934     //
01935     //  Version of the schema for generated XML
01936     //
01937     DWFString                           _zVersion;
01938 
01939     //
01940     //  We need to track the which resources (section content resources) need to go through
01941     //  the DWFSectionContentResource::serializeXML for saving. This is important especially
01942     //  in the cases where a the (Section Content) resource, i.e., the instance information
01943     //  is read in from a file and is then modified.
01944     //
01945     _tSetOfIDs                          _oModifiedContentResources;
01946 
01947 
01948     //
01949     //  This is used only when an instance resource is serializing. It's SectionContentResource
01950     //  lets the content know which set of instances to serialize
01951     //
01952     DWFString                           _zSerializingResource;
01953 
01954     //  These are read time storage structures required for delayed resolution string based
01955     //  IDs to pointers. Each element type's resolve step should empty the map.
01956     //
01957     _tClassToRefs                       _oReadClassBaseClassRefs;
01958     _tEntityToRefs                      _oReadEntityChildEntityRefs;
01959     _tGroupToRefs                       _oReadGroupElementRefs;
01960     _tContainerToRef                    _oReadPropertySetRefs;
01961 
01962     //
01963     //  This is used when another content is merged into this content, to track the mapping
01964     //  between elements and sets in the source content to created/existing elements or 
01965     //  sets in this content.
01966     //
01967     _tSetToSet                          _oMapFromSetToSet;
01968 
01969 private:
01970 
01971     DWFContent( const DWFContent& );
01972     DWFContent& operator=( const DWFContent& );
01973 
01974 };
01975 
01976 //
01977 // required for win32 dll external linkage
01978 //
01979 #ifdef  _DWFCORE_WIN32_SYSTEM
01980 #ifndef DWFTK_STATIC
01981 
01982 //DNT_START
01983 _declspec(selectany) const char* const DWFContent::kzExtension_ContentXML   = ".content.xml";
01984 //DNT_END
01985 
01986 #endif
01987 #endif
01988 
01989 }
01990 
01991 #endif
01992 

Generated on Tue Jan 6 22:40:02 2009 for Autodesk DWF Toolkit by  doxygen 1.4.5