Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:19:24

0001 // Created on: 1997-02-05
0002 // Created by: Yves FRICAUD
0003 // Copyright (c) 1997-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _TNaming_UsedShapes_HeaderFile
0018 #define _TNaming_UsedShapes_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TopoDS_Shape.hxx>
0024 #include <TNaming_PtrRefShape.hxx>
0025 #include <TopTools_ShapeMapHasher.hxx>
0026 #include <NCollection_DataMap.hxx>
0027 #include <TDF_Attribute.hxx>
0028 #include <Standard_OStream.hxx>
0029 class Standard_GUID;
0030 class TDF_AttributeDelta;
0031 class TDF_DeltaOnAddition;
0032 class TDF_DeltaOnRemoval;
0033 class TDF_RelocationTable;
0034 class TDF_DataSet;
0035 
0036 //! Global attribute located under root label to store all
0037 //! the shapes handled by the framework
0038 //! Set of Shapes Used in a Data from TDF
0039 //! Only one instance by Data, it always
0040 //! Stored as Attribute of The Root.
0041 class TNaming_UsedShapes : public TDF_Attribute
0042 {
0043 
0044 public:
0045   Standard_EXPORT void Destroy();
0046 
0047   ~TNaming_UsedShapes() override { Destroy(); }
0048 
0049   NCollection_DataMap<TopoDS_Shape, TNaming_PtrRefShape, TopTools_ShapeMapHasher>& Map();
0050 
0051   //! Returns the ID of the attribute.
0052   const Standard_GUID& ID() const override;
0053 
0054   //! Returns the ID: 2a96b614-ec8b-11d0-bee7-080009dc3333.
0055   Standard_EXPORT static const Standard_GUID& GetID();
0056 
0057   //! Copies the attribute contents into a new other
0058   //! attribute. It is used by Backup().
0059   Standard_EXPORT occ::handle<TDF_Attribute> BackupCopy() const override;
0060 
0061   //! Restores the contents from <anAttribute> into this
0062   //! one. It is used when aborting a transaction.
0063   Standard_EXPORT void Restore(const occ::handle<TDF_Attribute>& anAttribute) override;
0064 
0065   //! Clears the table.
0066   Standard_EXPORT void BeforeRemoval() override;
0067 
0068   //! Something to do after applying <anAttDelta>.
0069   Standard_EXPORT bool AfterUndo(const occ::handle<TDF_AttributeDelta>& anAttDelta,
0070                                  const bool                             forceIt = false) override;
0071 
0072   //! this method returns a null handle (no delta).
0073   Standard_EXPORT occ::handle<TDF_DeltaOnAddition> DeltaOnAddition() const override;
0074 
0075   //! this method returns a null handle (no delta).
0076   Standard_EXPORT occ::handle<TDF_DeltaOnRemoval> DeltaOnRemoval() const override;
0077 
0078   //! Returns an new empty attribute from the good end
0079   //! type. It is used by the copy algorithm.
0080   Standard_EXPORT occ::handle<TDF_Attribute> NewEmpty() const override;
0081 
0082   //! This method is different from the "Copy" one,
0083   //! because it is used when copying an attribute from
0084   //! a source structure into a target structure. This
0085   //! method pastes the current attribute to the label
0086   //! corresponding to the insertor. The pasted
0087   //! attribute may be a brand new one or a new version
0088   //! of the previous one.
0089   Standard_EXPORT void Paste(
0090     const occ::handle<TDF_Attribute>&       intoAttribute,
0091     const occ::handle<TDF_RelocationTable>& aRelocTationable) const override;
0092 
0093   //! Adds the directly referenced attributes and labels
0094   //! to <aDataSet>. "Directly" means we have only to
0095   //! look at the first level of references.
0096   //!
0097   //! For this, use only the AddLabel() & AddAttribute()
0098   //! from DataSet and do not try to modify information
0099   //! previously stored in <aDataSet>.
0100   Standard_EXPORT void References(const occ::handle<TDF_DataSet>& aDataSet) const override;
0101 
0102   //! Dumps the attribute on <aStream>.
0103   Standard_EXPORT Standard_OStream& Dump(Standard_OStream& anOS) const override;
0104 
0105   //! Dumps the content of me into the stream
0106   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0107 
0108   friend class TNaming_Builder;
0109 
0110   DEFINE_STANDARD_RTTIEXT(TNaming_UsedShapes, TDF_Attribute)
0111 
0112 private:
0113   Standard_EXPORT TNaming_UsedShapes();
0114 
0115   NCollection_DataMap<TopoDS_Shape, TNaming_PtrRefShape, TopTools_ShapeMapHasher> myMap;
0116 };
0117 
0118 #include <TNaming_UsedShapes.lxx>
0119 
0120 #endif // _TNaming_UsedShapes_HeaderFile