|
|
|||
File indexing completed on 2026-10-01 09:02:37
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 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 occ::handle<TObj_TReference> Set( 0056 const TDF_Label& theLabel, 0057 const occ::handle<TObj_Object>& theObject, 0058 const occ::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 occ::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, const TDF_Label& theMasterLabel); 0070 0071 //! Returns the referenced theObject 0072 Standard_EXPORT occ::handle<TObj_Object> Get() const; 0073 0074 //! Returns the Label of master object. 0075 TDF_Label GetMasterLabel() const { return myMasterLabel; } 0076 0077 //! Returns the referred label. 0078 TDF_Label GetLabel() const { return myLabel; } 0079 0080 public: 0081 //! Redefined OCAF abstract methods 0082 0083 //! Returns an new empty TObj_TReference attribute. It is used by the 0084 //! copy algorithm. 0085 Standard_EXPORT occ::handle<TDF_Attribute> NewEmpty() const override; 0086 0087 //! Restores the backuped contents from <theWith> into this one. It is used 0088 //! when aborting a transaction. 0089 Standard_EXPORT void Restore(const occ::handle<TDF_Attribute>& theWith) override; 0090 0091 //! This method is used when copying an attribute from a source structure 0092 //! into a target structure. 0093 Standard_EXPORT void Paste(const occ::handle<TDF_Attribute>& theInto, 0094 const occ::handle<TDF_RelocationTable>& theRT) const override; 0095 0096 //! Remove back references of it reference if it is in other document. 0097 Standard_EXPORT void BeforeForget() override; 0098 0099 //! It is necessary for tranzaction mechanism (Undo/Redo). 0100 Standard_EXPORT bool BeforeUndo(const occ::handle<TDF_AttributeDelta>& theDelta, 0101 const bool isForced = false) override; 0102 0103 //! It is necessary for tranzaction mechanism (Undo/Redo). 0104 Standard_EXPORT bool AfterUndo(const occ::handle<TDF_AttributeDelta>& theDelta, 0105 const bool isForced = false) override; 0106 0107 //! Check if back reference exists for reference. 0108 Standard_EXPORT void AfterResume() override; 0109 0110 //! Called after retrieval reference from file. 0111 Standard_EXPORT bool AfterRetrieval(const bool forceIt = false) override; 0112 0113 private: 0114 //! Fields 0115 TDF_Label myLabel; //!< Label that indicate referenced object 0116 TDF_Label myMasterLabel; //!< Label of object that have this reference. 0117 0118 public: 0119 //! CASCADE RTTI 0120 DEFINE_STANDARD_RTTIEXT(TObj_TReference, TDF_Attribute) 0121 }; 0122 0123 //! Define handle class for TObj_TReference 0124 #endif 0125 0126 #ifdef _MSC_VER 0127 #pragma once 0128 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|