1 // Created on: 1997-02-05
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_UsedShapes_HeaderFile
18 #define _TNaming_UsedShapes_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <TNaming_DataMapOfShapePtrRefShape.hxx>
24 #include <TDF_Attribute.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_OStream.hxx>
27 class TNaming_Builder;
30 class TDF_AttributeDelta;
31 class TDF_DeltaOnAddition;
32 class TDF_DeltaOnRemoval;
33 class TDF_RelocationTable;
37 class TNaming_UsedShapes;
38 DEFINE_STANDARD_HANDLE(TNaming_UsedShapes, TDF_Attribute)
40 //! Global attribute located under root label to store all
41 //! the shapes handled by the framework
42 //! Set of Shapes Used in a Data from TDF
43 //! Only one instance by Data, it always
44 //! Stored as Attribute of The Root.
45 class TNaming_UsedShapes : public TDF_Attribute
51 Standard_EXPORT void Destroy();
57 TNaming_DataMapOfShapePtrRefShape& Map();
59 //! Returns the ID of the attribute.
60 const Standard_GUID& ID() const Standard_OVERRIDE;
62 //! Returns the ID: 2a96b614-ec8b-11d0-bee7-080009dc3333.
63 Standard_EXPORT static const Standard_GUID& GetID();
65 //! Copies the attribute contents into a new other
66 //! attribute. It is used by Backup().
67 Standard_EXPORT virtual Handle(TDF_Attribute) BackupCopy() const Standard_OVERRIDE;
69 //! Restores the contents from <anAttribute> into this
70 //! one. It is used when aborting a transaction.
71 Standard_EXPORT virtual void Restore (const Handle(TDF_Attribute)& anAttribute) Standard_OVERRIDE;
74 Standard_EXPORT virtual void BeforeRemoval() Standard_OVERRIDE;
76 //! Something to do after applying <anAttDelta>.
77 Standard_EXPORT virtual Standard_Boolean AfterUndo (const Handle(TDF_AttributeDelta)& anAttDelta, const Standard_Boolean forceIt = Standard_False) Standard_OVERRIDE;
79 //! this method returns a null handle (no delta).
80 Standard_EXPORT virtual Handle(TDF_DeltaOnAddition) DeltaOnAddition() const Standard_OVERRIDE;
82 //! this method returns a null handle (no delta).
83 Standard_EXPORT virtual Handle(TDF_DeltaOnRemoval) DeltaOnRemoval() const Standard_OVERRIDE;
85 //! Returns an new empty attribute from the good end
86 //! type. It is used by the copy algorithm.
87 Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
89 //! This method is different from the "Copy" one,
90 //! because it is used when copying an attribute from
91 //! a source structure into a target structure. This
92 //! method pastes the current attribute to the label
93 //! corresponding to the insertor. The pasted
94 //! attribute may be a brand new one or a new version
95 //! of the previous one.
96 Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& intoAttribute, const Handle(TDF_RelocationTable)& aRelocTationable) const Standard_OVERRIDE;
98 //! Adds the directly referenced attributes and labels
99 //! to <aDataSet>. "Directly" means we have only to
100 //! look at the first level of references.
102 //! For this, use only the AddLabel() & AddAttribute()
103 //! from DataSet and do not try to modify information
104 //! previously stored in <aDataSet>.
105 Standard_EXPORT virtual void References (const Handle(TDF_DataSet)& aDataSet) const Standard_OVERRIDE;
107 //! Dumps the attribute on <aStream>.
108 Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE;
110 //! Dumps the content of me into the stream
111 Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
113 friend class TNaming_Builder;
116 DEFINE_STANDARD_RTTIEXT(TNaming_UsedShapes,TDF_Attribute)
126 Standard_EXPORT TNaming_UsedShapes();
128 TNaming_DataMapOfShapePtrRefShape myMap;
134 #include <TNaming_UsedShapes.lxx>
140 #endif // _TNaming_UsedShapes_HeaderFile