PublishedContentElement.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, 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/publisher/impl/PublishedContentElement.h#2 $
00019 //  $DateTime: 2008/06/18 18:08:14 $
00020 //  $Author: gaoje $
00021 //  $Change: 101166 $
00022 //  $Revision: #2 $
00023 //
00024 
00025 #ifndef _DWFTK_PUBLISHED_CONTENT_ELEMENT_H
00026 #define _DWFTK_PUBLISHED_CONTENT_ELEMENT_H
00027 
00028 
00033 
00034 #ifndef DWFTK_READ_ONLY
00035 
00036 #include "dwf/package/Content.h"
00037 #include "dwf/publisher/PublishedObject.h"
00038 
00039 namespace DWFToolkit
00040 {
00041  
00042 //
00043 // fwd declarations
00044 //
00045 class DWFSectionContentResource;
00046 
00056 class DWFPublishedContentElement : public DWFPublishedObject
00057                                    _DWFTK_EXPORT_API_MEMORY_CONTROL_BASE_MEMBER
00058 {
00059 
00060 public:
00061 
00065     typedef DWFPublishedObject::tKey                                            tKey;
00069     typedef _DWFTK_STD_VECTOR(DWFPublishedContentElement*)                      tList;
00073     typedef DWFSkipList<DWFPublishedObject::tKey, DWFPublishedContentElement*>  tMap;
00074 
00075 public:
00076 
00086     class Factory : public DWFPublishedObject::Factory
00087                     _DWFTK_EXPORT_API_MEMORY_CONTROL_BASE_MEMBER
00088     {
00089 
00090     public:
00091 
00097         _DWFTK_API
00098         Factory()
00099             throw();
00100 
00106         _DWFTK_API
00107         virtual ~Factory()
00108             throw();
00109 
00118         _DWFTK_API
00119         virtual DWFPublishedObject* makePublishedObject( tKey              nKey,
00120                                                          const DWFString&  zName )
00121             throw( DWFException );
00122 
00130         _DWFTK_API
00131         virtual DWFPublishedObject& findPublishedObject( tKey nKey )
00132             throw( DWFException );
00133 
00140         _DWFTK_API
00141         DWFPublishedContentElement::tMap::Iterator* getPublishedObjects()
00142             throw()
00143         {
00144             return _oPublishedElements.iterator();
00145         }
00146 
00147     private:
00148 
00149         DWFPublishedContentElement::tMap    _oPublishedElements;
00150 
00151     private:
00152 
00153         //
00154         //  Not implemented
00155         //
00156         Factory( const Factory& );
00157         Factory& operator=( const Factory& );
00158 
00159     };
00160 
00161 public:
00162 
00171     class NotificationSink _DWFTK_EXPORT_API_MEMORY_CONTROL_BASE
00172     {
00173 
00174     public:
00175 
00181         _DWFTK_API
00182         NotificationSink()
00183             throw()
00184         {;}
00185 
00191         _DWFTK_API
00192         virtual ~NotificationSink()
00193             throw()
00194         {;}
00195 
00196     public:
00197 
00204         _DWFTK_API
00205         virtual void notifyInstanceCreated( tKey         /*nKey*/,
00206                                             DWFInstance* /*pInstance*/ )
00207             throw()
00208         {;}
00209 
00216         _DWFTK_API
00217         virtual void notifyObjectCreated( tKey       /*nKey*/,
00218                                           DWFObject* /*pObject*/ )
00219             throw()
00220         {;}
00221 
00228         _DWFTK_API
00229         virtual void notifyFeatureCreated( tKey        /*nKey*/,
00230                                            DWFFeature* /*pFeature*/ )
00231             throw()
00232         {;}
00233 
00240         _DWFTK_API
00241         virtual void notifyEntityCreated( tKey       /*nKey*/,
00242                                           DWFEntity* /*pEntity*/ )
00243             throw()
00244         {;}
00245 
00246     };
00247 
00248 public:
00249 
00260     class Visitor : public DWFPublishedObject::Visitor
00261                     _DWFTK_EXPORT_API_MEMORY_CONTROL_BASE_MEMBER
00262     {
00263 
00264     public: 
00265 
00271         _DWFTK_API
00272         Visitor()
00273             throw( DWFException );
00274 
00280         _DWFTK_API
00281         virtual ~Visitor()
00282             throw()
00283         {;}
00284 
00292         _DWFTK_API
00293         void setContent( DWFContent* pContent )
00294             throw()
00295         {
00296             _pContent = pContent;
00297         }
00298 
00306         _DWFTK_API
00307         DWFContent* getContent() const
00308             throw()
00309         {
00310             return _pContent;
00311         }
00312 
00321         _DWFTK_API
00322         void setContentResource( DWFSectionContentResource* pResource )
00323             throw();
00324 
00331         _DWFTK_API
00332         DWFSectionContentResource* getContentResource() const
00333             throw()
00334         {
00335             return _pContentResource;
00336         }
00337 
00341         _DWFTK_API
00342         void visitPublishedObject( DWFPublishedObject& rObject )
00343             throw( DWFException );
00344 
00353         _DWFTK_API
00354         void setNotificationSink( DWFPublishedContentElement::NotificationSink* pSink )
00355             throw();
00356 
00363         _DWFTK_API
00364         void removeNotificationSink( DWFPublishedContentElement::NotificationSink* pSink )
00365             throw();
00366         
00367         _DWFTK_API
00368         DWFSortedVector<DWFInstance*>& instancesExcludedFromModel()
00369             throw()
00370         {
00371             return _oExcludedInstances;
00372         }
00373 
00380         _DWFTK_API
00381         void reset()
00382             throw();
00383 
00384     private:
00385 
00386         _DWFTK_API
00387         DWFObject* _getParentContentObject( DWFPublishedContentElement* pPublishedElement )
00388             throw( DWFException );
00389 
00390         //
00391         //  Find an element corresponding to the provided published index.
00392         //
00393         _DWFTK_API
00394         DWFContentElement* _findContentElement( DWFPublishedObject::tIndex index )
00395             throw();
00396 
00397         //
00398         //  Given a published content element, which must be a referenced element,
00399         //  get the corresponding entity. If no entity is found then a new one is
00400         //  created.
00401         //
00402         _DWFTK_API
00403         DWFEntity* _getReferencedEntity( DWFPublishedObject* pPublishedObject )
00404             throw( DWFException );
00405 
00406         _DWFTK_API
00407         void _copyProperties( DWFPropertyContainer* pFrom, DWFPropertyContainer* pTo, bool bTakeContainers = true )
00408             throw();
00409 
00410         _DWFTK_API
00411         void _notifyInstanceCreated( tKey nKey, DWFInstance* pInstance )
00412             throw();
00413 
00414         _DWFTK_API
00415         void _notifyObjectCreated( tKey nKey, DWFObject* pObject )
00416             throw();
00417 
00418         _DWFTK_API
00419         void _notifyEntityCreated( tKey nKey, DWFEntity* pEntity )
00420             throw();
00421 
00422     private:
00423 
00424         typedef std::map<DWFPublishedObject::tIndex, DWFContentElement*>            _tMapElement;
00425         typedef _DWFTK_STD_VECTOR(DWFPublishedContentElement::NotificationSink*)    _tNotifySinks;
00426 
00427     private:
00428 
00429         //
00430         //  The content library into which the metadata will go.
00431         //
00432         DWFContent*                         _pContent;
00433         //
00434         //  The resource associated with the generated instances.
00435         //
00436         DWFSectionContentResource*          _pContentResource;
00437         //
00438         //  The resrouce object ID used to generate the instances.
00439         //
00440         DWFString                           _zResourceID;
00441 
00442         //
00443         //  Instances to exclude from the model because of the HideFromDefaultModel flag
00444         //
00445         DWFSortedVector<DWFInstance*>       _oExcludedInstances;
00446 
00447         //
00448         //  Map from the published object index to a content element pointer 
00449         //
00450         _tMapElement                        _oIndexToElement;       
00451 
00452         //
00453         //  The notification sinks are used to notify an observer/listener of
00454         //  entity/object/instance creation events.
00455         //
00456         _tNotifySinks                       _oNotifySinks;
00457     };
00458 
00459 public:
00460 
00468     _DWFTK_API
00469     DWFPublishedContentElement( tKey             nKey,
00470                                 const DWFString& zName )
00471         throw();
00472 
00479     _DWFTK_API
00480     DWFPublishedContentElement( DWFPublishedContentElement& rSource)
00481         throw();
00482 
00489     _DWFTK_API
00490     DWFPublishedContentElement& operator=( DWFPublishedContentElement& rSource)
00491         throw();
00492 
00498     _DWFTK_API
00499     virtual ~DWFPublishedContentElement()
00500         throw();
00501 
00512     _DWFTK_API
00513     virtual void addReference( DWFPublishedObject*  pObject,
00514                                tKey                 nKey,
00515                                const DWFString*     pzInstanceName,
00516                                bool                 bFromNamedSegment = false )
00517         throw( DWFException );
00518 
00525     _DWFTK_API
00526     bool hideFromDefaultModel() const
00527         throw()
00528     {
00529         return _bHideFromDefaultModel;
00530     }
00531 
00535     _DWFTK_API
00536     virtual bool setHideFromDefaultModel( DWFPublishedObject::tKey nKey )
00537         throw();
00538 
00550     _DWFTK_API
00551     virtual void setContentEntity( DWFEntity* pEntity,
00552                                    tKey nKey, 
00553                                    const DWFString* pzInstanceName )
00554         throw( DWFException );
00555 
00566     _DWFTK_API
00567     virtual void setContentObject( DWFObject* pObject, 
00568                                    tKey nKey )
00569         throw( DWFException );
00570 
00571     //
00572     //  TODO: Implement or remove before final release of 7.2.0
00573     //
00583     //_DWFTK_API
00584     //virtual DWFContentElement* getContentElement()
00585     //    throw()
00586     //{
00587     //    return _pContentRef;
00588     //}
00589 
00590     _DWFTK_API
00591     tReference* getNamedSegmentIncludeRef() const
00592     {
00593         return _pNamedSegIncludeRef;
00594     }
00595 
00596 private:
00597 
00598     bool            _bHideFromDefaultModel;
00599 
00600     //
00601     //  If include is applied to a named segment, use this ref for the include
00602     //
00603     tReference*     _pNamedSegIncludeRef;
00604 
00605     //
00606     //  TODO: Implement or remove before final release of 7.2.0
00607     //
00614     //DWFContentElement::tList    _oContentRef;
00615     //
00620     //DWFContentElement*          _pContentRef;
00621 };
00622 
00623 }
00624 
00625 #endif
00626 #endif
00627 

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