|
||||
File indexing completed on 2025-01-18 10:05:22
0001 // Created on: 2004-11-23 0002 // Created by: Pavel TELKOV 0003 // Copyright (c) 2004-2014 OPEN CASCADE SAS 0004 // 0005 // This file is part of Open CASCADE Technology software library. 0006 // 0007 // This library is free software; you can redistribute it and/or modify it under 0008 // the terms of the GNU Lesser General Public License version 2.1 as published 0009 // by the Free Software Foundation, with special exception defined in the file 0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0011 // distribution for complete text of the license and disclaimer of any warranty. 0012 // 0013 // Alternatively, this file may be used under the terms of Open CASCADE 0014 // commercial license or contractual agreement. 0015 0016 // The original implementation Copyright: (C) RINA S.p.A 0017 0018 #ifndef TObj_TReference_HeaderFile 0019 #define TObj_TReference_HeaderFile 0020 0021 #include <TDF_Attribute.hxx> 0022 #include <TDF_Label.hxx> 0023 0024 class TObj_Object; 0025 class Standard_GUID; 0026 0027 /** 0028 * Attribute for storing references to the objects which implement 0029 * TObj_Object interface in the OCAF tree. 0030 * Its persistency mechanism provides transparent method for storing 0031 * cross-model references. 0032 * Each reference, when created, registers itself in the referred object, 0033 * to support back references 0034 */ 0035 0036 class TObj_TReference : public TDF_Attribute 0037 { 0038 public: 0039 //! Standard methods of OCAF attribute 0040 0041 //! Empty constructor 0042 Standard_EXPORT TObj_TReference(); 0043 0044 //! This method is used in implementation of ID() 0045 static Standard_EXPORT const Standard_GUID& GetID(); 0046 0047 //! Returns the ID of TObj_TReference attribute. 0048 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; 0049 0050 public: 0051 //! Method for create TObj_TReference object 0052 0053 //! Creates reference on TDF_Label <theLabel> to the object <theObject> and 0054 //! creates backreference from the object <theObject> to <theMaster> one. 0055 static Standard_EXPORT Handle(TObj_TReference) Set 0056 (const TDF_Label& theLabel, 0057 const Handle(TObj_Object)& theObject, 0058 const Handle(TObj_Object)& theMaster); 0059 0060 public: 0061 //! Methods for setting and obtaining referenced object 0062 0063 //! Sets the reference to the theObject 0064 Standard_EXPORT void Set(const Handle(TObj_Object)& theObject, 0065 const TDF_Label& theMasterLabel); 0066 0067 //! Sets the reference to the theObject at indicated Label. 0068 //! It is method for persistent only. Don`t use anywhere else. 0069 Standard_EXPORT void Set(const TDF_Label& theLabel, 0070 const TDF_Label& theMasterLabel); 0071 0072 //! Returns the referenced theObject 0073 Standard_EXPORT Handle(TObj_Object) Get() const; 0074 0075 //! Returns the Label of master object. 0076 TDF_Label GetMasterLabel() const {return myMasterLabel;} 0077 0078 //! Returns the referred label. 0079 TDF_Label GetLabel() const {return myLabel;} 0080 0081 public: 0082 //! Redefined OCAF abstract methods 0083 0084 //! Returns an new empty TObj_TReference attribute. It is used by the 0085 //! copy algorithm. 0086 Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; 0087 0088 //! Restores the backuped contents from <theWith> into this one. It is used 0089 //! when aborting a transaction. 0090 Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theWith) Standard_OVERRIDE; 0091 0092 //! This method is used when copying an attribute from a source structure 0093 //! into a target structure. 0094 Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theInto, 0095 const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE; 0096 0097 //! Remove back references of it reference if it is in other document. 0098 virtual Standard_EXPORT void BeforeForget() Standard_OVERRIDE; 0099 0100 //! It is necessary for tranzaction mechanism (Undo/Redo). 0101 virtual Standard_EXPORT Standard_Boolean BeforeUndo 0102 (const Handle(TDF_AttributeDelta)& theDelta, 0103 const Standard_Boolean isForced = Standard_False) Standard_OVERRIDE; 0104 0105 //! It is necessary for tranzaction mechanism (Undo/Redo). 0106 virtual Standard_EXPORT Standard_Boolean AfterUndo 0107 (const Handle(TDF_AttributeDelta)& theDelta, 0108 const Standard_Boolean isForced = Standard_False) Standard_OVERRIDE; 0109 0110 //! Check if back reference exists for reference. 0111 virtual Standard_EXPORT void AfterResume() Standard_OVERRIDE; 0112 0113 //! Called after retrieval reference from file. 0114 virtual Standard_EXPORT Standard_Boolean AfterRetrieval 0115 (const Standard_Boolean forceIt = Standard_False) Standard_OVERRIDE; 0116 0117 private: 0118 //! Fields 0119 TDF_Label myLabel; //!< Label that indicate referenced object 0120 TDF_Label myMasterLabel; //!< Label of object that have this reference. 0121 0122 public: 0123 //! CASCADE RTTI 0124 DEFINE_STANDARD_RTTIEXT(TObj_TReference,TDF_Attribute) 0125 }; 0126 0127 //! Define handle class for TObj_TReference 0128 DEFINE_STANDARD_HANDLE(TObj_TReference,TDF_Attribute) 0129 0130 #endif 0131 0132 #ifdef _MSC_VER 0133 #pragma once 0134 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |