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

PublishedObject.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 #ifndef _DWFTK_PUBLISHED_OBJECT_H
00020 #define _DWFTK_PUBLISHED_OBJECT_H
00021 
00022 
00027 
00028 
00029 #ifndef DWFTK_READ_ONLY
00030 
00031 #include "dwfcore/STL.h"
00032 #include "dwfcore/String.h"
00033 #include "dwfcore/Exception.h"
00034 using namespace DWFCore;
00035 
00036 #include "dwf/Toolkit.h"
00037 #include "dwf/package/utility/PropertyContainer.h"
00038 
00039 
00040 namespace DWFToolkit
00041 {
00042 
00043 //
00044 // fwd decl
00045 //
00046 class DWFPropertyVisitor;
00047 
00048 
00057 class DWFPublishedObject : public DWFPropertyContainer
00058 {
00059 public:
00060 
00064     typedef long    tKey;
00068     typedef int     tIndex;
00069 
00073     typedef struct
00074     {
00075         tKey                nKey;
00076         tIndex              nIndex;
00077         DWFPublishedObject* pObj;
00078         DWFString           zName;
00079     } tReference;
00080 
00084     typedef vector<tReference*>                     tReferenceList;
00088     typedef vector<DWFPublishedObject*>             tList;
00092     typedef DWFSkipList<tKey, DWFPublishedObject*>  tMap;
00093 
00094 public:
00095 
00102     class Factory
00103     {
00104 
00105     public:
00106 
00112         _DWFTK_API
00113         Factory( const Factory& )
00114             throw()
00115         {;}
00116 
00122         _DWFTK_API
00123         Factory& operator=( const Factory& )
00124             throw()
00125         {
00126             return *this;
00127         }
00128 
00134         _DWFTK_API
00135         virtual ~Factory()
00136             throw()
00137         {;}
00138 
00147         _DWFTK_API
00148         virtual DWFPublishedObject* makePublishedObject( tKey              nKey,
00149                                                          const DWFString&  zName )
00150             throw( DWFException ) = 0;
00151 
00162         _DWFTK_API
00163         virtual DWFPublishedObject& findPublishedObject( tKey nKey )
00164             throw( DWFException ) = 0;
00165 
00166     protected:
00167 
00173         _DWFTK_API
00174         Factory()
00175             throw()
00176         {;}
00177     };
00178 
00179 public:
00180 
00189     class Visitor
00190     {
00191 
00192     public:
00193 
00199         _DWFTK_API
00200         virtual ~Visitor()
00201             throw()
00202         {;}
00203 
00211         virtual void visitPublishedObject( DWFPublishedObject& rObject )
00212             throw( DWFException )
00213         {
00214             if (_pComposite)
00215             {
00216                 _pComposite->visitPublishedObject( rObject );
00217             }
00218         }
00219 
00220     protected:
00221 
00227         _DWFTK_API
00228         Visitor( Visitor* pComposite = NULL )
00229             throw()
00230             : _pComposite( pComposite )
00231         {;}
00232 
00233     private:
00234 
00235         Visitor( const Visitor& );
00236         Visitor& operator=( const Visitor& );
00237 
00238     private:
00239 
00240         Visitor* _pComposite;
00241     };
00242 
00243 public:
00244 
00252     _DWFTK_API
00253     DWFPublishedObject( tKey             nKey,
00254                         const DWFString& zName )
00255         throw();
00256 
00263     _DWFTK_API
00264     DWFPublishedObject( DWFPublishedObject& rSource )
00265         throw();
00266 
00273     _DWFTK_API
00274     DWFPublishedObject& operator=( DWFPublishedObject& rSource )
00275         throw();
00276 
00282     _DWFTK_API
00283     virtual ~DWFPublishedObject()
00284         throw();
00285 
00297     _DWFTK_API
00298     const DWFString& name() const
00299         throw()
00300     {
00301         return _zName;
00302     }
00303 
00313     _DWFTK_API
00314     void path( DWFString& zPath )
00315         throw();
00316 
00328     _DWFTK_API
00329     tKey key() const
00330         throw()
00331     {
00332         return _nKey;
00333     }
00334 
00346     _DWFTK_API
00347     tIndex index() const
00348         throw()
00349     {
00350         return _nIndex;
00351     }
00352 
00359     _DWFTK_API
00360     void setIndex( tIndex nIndex )
00361         throw()
00362     {
00363         _nIndex = nIndex;
00364     }
00365 
00372     _DWFTK_API
00373     DWFPublishedObject* parent() const
00374         throw()
00375     {
00376         return _pParent;
00377     }
00378 
00386     _DWFTK_API
00387     void setParent( DWFPublishedObject* pParentObject )
00388         throw()
00389     {
00390         _pParent = pParentObject;
00391     }
00392 
00410     _DWFTK_API
00411     void referenced()
00412         throw()
00413     {
00414         _bRef = true;
00415     }
00416 
00423     _DWFTK_API
00424     bool isReferenced()
00425         throw()
00426     {
00427         return _bRef;
00428     }
00429 
00441     _DWFTK_API
00442     void addReference( DWFPublishedObject*      pObject,
00443                        DWFPublishedObject::tKey nKey,
00444                        const DWFString*         zInstanceName = NULL,
00445                                            bool                                         bPropertiesOnly = false )
00446         throw( DWFException );
00447 
00456     _DWFTK_API
00457     tReferenceList& references()
00458         throw( DWFException );
00459 
00466     _DWFTK_API
00467     void accept( DWFPublishedObject::Visitor& rVisitor )
00468         throw( DWFException );
00469 
00476     _DWFTK_API
00477     void accept( DWFPropertyVisitor& rVisitor )
00478         throw( DWFException );
00479 
00480 private:
00481 
00482     bool                _bRef;
00483     tKey                _nKey;
00484     unsigned int        _nIndex;
00485     DWFPublishedObject* _pParent;
00486     DWFString           _zName;
00487 
00488     tReferenceList      _oReferenceList;
00489 
00490 private:
00491 
00492     DWFPublishedObject();
00493 };
00494 
00495 
00496 }
00497 
00498 
00499 #endif  
00500 #endif
00501 

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