Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:22

0001 // Created on: 1997-02-04
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_NamedShape_HeaderFile
0018 #define _TNaming_NamedShape_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TNaming_PtrNode.hxx>
0024 #include <TNaming_Evolution.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <TDF_Attribute.hxx>
0027 #include <Standard_OStream.hxx>
0028 class Standard_GUID;
0029 class TopoDS_Shape;
0030 class TDF_DeltaOnModification;
0031 class TDF_DeltaOnRemoval;
0032 class TDF_RelocationTable;
0033 class TDF_DataSet;
0034 class TDF_AttributeDelta;
0035 
0036 
0037 class TNaming_NamedShape;
0038 DEFINE_STANDARD_HANDLE(TNaming_NamedShape, TDF_Attribute)
0039 
0040 //! The basis to define an attribute for the storage of
0041 //! topology and naming data.
0042 //! This attribute contains two parts:
0043 //! -   The type of evolution, a term of the
0044 //! enumeration TNaming_Evolution
0045 //! -   A list of pairs of shapes called the "old"
0046 //! shape and the "new" shape. The meaning
0047 //! depends on the type of evolution.
0048 class TNaming_NamedShape : public TDF_Attribute
0049 {
0050 
0051 public:
0052 
0053   
0054   //! class method
0055   //! ============
0056   //! Returns the GUID for named shapes.
0057   Standard_EXPORT static const Standard_GUID& GetID();
0058   
0059   Standard_EXPORT TNaming_NamedShape();
0060   
0061   Standard_EXPORT Standard_Boolean IsEmpty() const;
0062   
0063   //! Returns the shapes contained in <NS>. Returns a null
0064   //! shape if IsEmpty.
0065   Standard_EXPORT TopoDS_Shape Get() const;
0066   
0067   //! Returns the Evolution of the attribute.
0068     TNaming_Evolution Evolution() const;
0069   
0070   //! Returns the Version of the attribute.
0071     Standard_Integer Version() const;
0072   
0073   //! Set the Version of the attribute.
0074     void SetVersion (const Standard_Integer version);
0075   
0076   Standard_EXPORT void Clear();
0077 ~TNaming_NamedShape()
0078 {
0079   Clear();
0080 }
0081   
0082   //! Returns the ID of the attribute.
0083     const Standard_GUID& ID() const Standard_OVERRIDE;
0084   
0085   //! Copies  the attribute  contents into  a  new other
0086   //! attribute. It is used by Backup().
0087   Standard_EXPORT virtual Handle(TDF_Attribute) BackupCopy() const Standard_OVERRIDE;
0088   
0089   //! Restores the contents from <anAttribute> into this
0090   //! one. It is used when aborting a transaction.
0091   Standard_EXPORT virtual void Restore (const Handle(TDF_Attribute)& anAttribute) Standard_OVERRIDE;
0092   
0093   //! Makes a DeltaOnModification between <me> and
0094   //! <anOldAttribute.
0095   Standard_EXPORT virtual Handle(TDF_DeltaOnModification) DeltaOnModification (const Handle(TDF_Attribute)& anOldAttribute) const Standard_OVERRIDE;
0096   
0097   //! Applies a DeltaOnModification to <me>.
0098   Standard_EXPORT virtual void DeltaOnModification (const Handle(TDF_DeltaOnModification)& aDelta) Standard_OVERRIDE;
0099   
0100   //! Makes a DeltaOnRemoval on <me> because <me> has
0101   //! disappeared from the DS.
0102   Standard_EXPORT virtual Handle(TDF_DeltaOnRemoval) DeltaOnRemoval() const Standard_OVERRIDE;
0103   
0104   //! Returns an new empty attribute from the good end
0105   //! type. It is used by the copy algorithm.
0106   Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
0107   
0108   //! This method is different from the "Copy" one,
0109   //! because it is used when copying an attribute from
0110   //! a source structure into a target structure. This
0111   //! method pastes the current attribute to the label
0112   //! corresponding to the insertor. The pasted
0113   //! attribute may be a brand new one or a new version
0114   //! of the previous one.
0115   Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& intoAttribute, const Handle(TDF_RelocationTable)& aRelocTationable) const Standard_OVERRIDE;
0116   
0117   //! Adds the directly referenced attributes and labels
0118   //! to <aDataSet>. "Directly" means we have only to
0119   //! look at the first level of references.
0120   Standard_EXPORT virtual void References (const Handle(TDF_DataSet)& aDataSet) const Standard_OVERRIDE;
0121   
0122   Standard_EXPORT virtual void BeforeRemoval() Standard_OVERRIDE;
0123   
0124   //! Something to do before applying <anAttDelta>
0125   Standard_EXPORT virtual Standard_Boolean BeforeUndo (const Handle(TDF_AttributeDelta)& anAttDelta, const Standard_Boolean forceIt = Standard_False) Standard_OVERRIDE;
0126   
0127   //! Something to do after applying <anAttDelta>.
0128   Standard_EXPORT virtual Standard_Boolean AfterUndo (const Handle(TDF_AttributeDelta)& anAttDelta, const Standard_Boolean forceIt = Standard_False) Standard_OVERRIDE;
0129   
0130   //! Dumps the attribute on <aStream>.
0131   Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE;
0132   
0133   //! Dumps the content of me into the stream
0134   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0135 
0136 friend class TNaming_Builder;
0137 friend class TNaming_Iterator;
0138 friend class TNaming_NewShapeIterator;
0139 friend class TNaming_OldShapeIterator;
0140 
0141 
0142   DEFINE_STANDARD_RTTIEXT(TNaming_NamedShape,TDF_Attribute)
0143 
0144 protected:
0145 
0146 
0147 
0148 
0149 private:
0150 
0151   
0152   //! Adds an evolution
0153   Standard_EXPORT void Add (TNaming_PtrNode& Evolution);
0154 
0155   TNaming_PtrNode myNode;
0156   TNaming_Evolution myEvolution;
0157   Standard_Integer myVersion;
0158 
0159 
0160 };
0161 
0162 
0163 #include <TNaming_NamedShape.lxx>
0164 
0165 
0166 
0167 
0168 
0169 #endif // _TNaming_NamedShape_HeaderFile