Relationship.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 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/opc/Relationship.h#3 $
00019 //  $DateTime: 2008/09/27 13:04:31 $
00020 //  $Author: klugj $
00021 //  $Change: 114631 $
00022 //  $Revision: #3 $
00023 //
00024 //
00025 
00026 #ifndef _DWFTK_OPCRELATIONSHIP_H
00027 #define _DWFTK_OPCRELATIONSHIP_H
00028 
00033 
00034 #include "dwfcore/Vector.h"
00035 #include "dwfcore/SkipList.h"
00036 #include "dwfcore/XML.h"
00037 using namespace DWFCore;
00038 
00039 #include "dwf/Toolkit.h"
00040 
00041 namespace DWFToolkit
00042 {
00043 
00044 //
00045 // fwd declarations
00046 //
00047 class OPCPart;
00048 
00062 class OPCRelationship : public DWFXMLBuildable
00063                         _DWFTK_EXPORT_API_MEMORY_CONTROL_BASE_MEMBER
00064 {
00065 
00066     //
00067     //  Only a relationship container can create and destroy a relationship
00068     //
00069     friend class OPCRelationshipContainer;
00070     friend class OPCXMLElementBuilder;
00071 
00072 public:
00073 
00077     typedef DWFOrderedVector<OPCRelationship*>              tList;
00081     typedef DWFStringKeySkipList<OPCRelationship*>          tMap;
00086     typedef DWFCachingIterator<OPCRelationship*>            tCachingIterator;
00090     typedef DWFIterator<OPCRelationship*>                   tIterator;
00091 
00092 public:
00093 
00094     typedef enum teTargetMode {
00095         //
00096         //  Used for relationships targeting a part in the same package
00097         //
00098         eInternal,
00099         
00100         //
00101         //  Used to describe relationships to a part in another package
00102         //
00103         eExternal
00104 
00105     } teTargetMode;
00106 
00107 public:
00108 
00109     _DWFTK_API
00110     OPCPart* target() const 
00111         throw()
00112     {
00113         return _pTarget;
00114     }
00115 
00116     _DWFTK_API
00117     const DWFString& relationshipType() const
00118         throw()
00119     {
00120         return _zRelationshipType;
00121     }
00122 
00123     _DWFTK_API
00124     const DWFString& id() const
00125         throw();
00126 
00127     _DWFTK_API
00128     void setId( const DWFString& zId )
00129         throw();
00130 
00131     _DWFTK_API
00132     teTargetMode targetMode() const
00133         throw()
00134     {
00135         return _eTargetMode;
00136     }
00137 
00141     _DWFTK_API
00142     virtual void parseAttributeList( const char** ppAttributeList )
00143         throw( DWFException );
00144 
00145 
00146 #ifndef DWFTK_READ_ONLY
00147 
00154     _DWFTK_API
00155     virtual void serializeXML( DWFXMLSerializer& rSerializer )
00156         throw( DWFException );
00157 
00158 #endif
00159 
00160     _DWFTK_API
00161     const DWFString& targetURI()
00162         throw();
00163 
00164 protected:
00165 
00166     //
00167     //      Constructor
00168     //
00169     _DWFTK_API
00170     OPCRelationship()
00171         throw();
00172 
00173     //
00174     //     Constructor
00175     //
00176     _DWFTK_API
00177     OPCRelationship( OPCPart* pTarget, 
00178                      DWFString zRelationshipType,
00179                      OPCRelationship::teTargetMode eTargetMode = eInternal )
00180         throw();
00181 
00182     //
00183     //     Destructor
00184     //
00185     _DWFTK_API
00186     virtual ~OPCRelationship()
00187         throw();
00188 
00189 private:
00190 
00191     OPCPart*        _pTarget;
00192     DWFString       _zRelationshipType;
00193     teTargetMode    _eTargetMode;
00194     DWFString       _zId;
00195 
00196     //
00197     //  The target name is used when a relationship is read in because the corresponding
00198     //  target part may not have been serialized yet.
00199     //
00200     DWFString       _zTargetURI;
00201 };
00202 
00203 }
00204 
00205 #endif

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