1 // Created on: 1997-02-04
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _TNaming_NamedShape_HeaderFile
18 #define _TNaming_NamedShape_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <TNaming_PtrNode.hxx>
24 #include <TNaming_Evolution.hxx>
25 #include <Standard_Integer.hxx>
26 #include <TDF_Attribute.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <Standard_OStream.hxx>
29 class TNaming_Builder;
30 class TNaming_Iterator;
31 class TNaming_NewShapeIterator;
32 class TNaming_OldShapeIterator;
36 class TDF_DeltaOnModification;
37 class TDF_DeltaOnRemoval;
38 class TDF_RelocationTable;
40 class TDF_AttributeDelta;
43 class TNaming_NamedShape;
44 DEFINE_STANDARD_HANDLE(TNaming_NamedShape, TDF_Attribute)
46 //! The basis to define an attribute for the storage of
47 //! topology and naming data.
48 //! This attribute contains two parts:
49 //! - The type of evolution, a term of the
50 //! enumeration TNaming_Evolution
51 //! - A list of pairs of shapes called the "old"
52 //! shape and the "new" shape. The meaning
53 //! depends on the type of evolution.
54 class TNaming_NamedShape : public TDF_Attribute
62 //! Returns the GUID for named shapes.
63 Standard_EXPORT static const Standard_GUID& GetID();
65 Standard_EXPORT TNaming_NamedShape();
67 Standard_EXPORT Standard_Boolean IsEmpty() const;
69 //! Returns the shapes contained in <NS>. Returns a null
71 Standard_EXPORT TopoDS_Shape Get() const;
73 //! Returns the Evolution of the attribute.
74 TNaming_Evolution Evolution() const;
76 //! Returns the Version of the attribute.
77 Standard_Integer Version() const;
79 //! Set the Version of the attribute.
80 void SetVersion (const Standard_Integer version);
82 Standard_EXPORT void Clear();
88 //! Returns the ID of the attribute.
89 const Standard_GUID& ID() const Standard_OVERRIDE;
91 //! Copies the attribute contents into a new other
92 //! attribute. It is used by Backup().
93 Standard_EXPORT virtual Handle(TDF_Attribute) BackupCopy() const Standard_OVERRIDE;
95 //! Restores the contents from <anAttribute> into this
96 //! one. It is used when aborting a transaction.
97 Standard_EXPORT virtual void Restore (const Handle(TDF_Attribute)& anAttribute) Standard_OVERRIDE;
99 //! Makes a DeltaOnModification between <me> and
101 Standard_EXPORT virtual Handle(TDF_DeltaOnModification) DeltaOnModification (const Handle(TDF_Attribute)& anOldAttribute) const Standard_OVERRIDE;
103 //! Applies a DeltaOnModification to <me>.
104 Standard_EXPORT virtual void DeltaOnModification (const Handle(TDF_DeltaOnModification)& aDelta) Standard_OVERRIDE;
106 //! Makes a DeltaOnRemoval on <me> because <me> has
107 //! disappeared from the DS.
108 Standard_EXPORT virtual Handle(TDF_DeltaOnRemoval) DeltaOnRemoval() const Standard_OVERRIDE;
110 //! Returns an new empty attribute from the good end
111 //! type. It is used by the copy algorithm.
112 Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
114 //! This method is different from the "Copy" one,
115 //! because it is used when copying an attribute from
116 //! a source structure into a target structure. This
117 //! method pastes the current attribute to the label
118 //! corresponding to the insertor. The pasted
119 //! attribute may be a brand new one or a new version
120 //! of the previous one.
121 Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& intoAttribute, const Handle(TDF_RelocationTable)& aRelocTationable) const Standard_OVERRIDE;
123 //! Adds the directly referenced attributes and labels
124 //! to <aDataSet>. "Directly" means we have only to
125 //! look at the first level of references.
126 Standard_EXPORT virtual void References (const Handle(TDF_DataSet)& aDataSet) const Standard_OVERRIDE;
128 Standard_EXPORT virtual void BeforeRemoval() Standard_OVERRIDE;
130 //! Something to do before applying <anAttDelta>
131 Standard_EXPORT virtual Standard_Boolean BeforeUndo (const Handle(TDF_AttributeDelta)& anAttDelta, const Standard_Boolean forceIt = Standard_False) Standard_OVERRIDE;
133 //! Something to do after applying <anAttDelta>.
134 Standard_EXPORT virtual Standard_Boolean AfterUndo (const Handle(TDF_AttributeDelta)& anAttDelta, const Standard_Boolean forceIt = Standard_False) Standard_OVERRIDE;
136 //! Dumps the attribute on <aStream>.
137 Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE;
139 friend class TNaming_Builder;
140 friend class TNaming_Iterator;
141 friend class TNaming_NewShapeIterator;
142 friend class TNaming_OldShapeIterator;
145 DEFINE_STANDARD_RTTIEXT(TNaming_NamedShape,TDF_Attribute)
155 //! Adds an evolution
156 Standard_EXPORT void Add (TNaming_PtrNode& Evolution);
158 TNaming_PtrNode myNode;
159 TNaming_Evolution myEvolution;
160 Standard_Integer myVersion;
166 #include <TNaming_NamedShape.lxx>
172 #endif // _TNaming_NamedShape_HeaderFile