Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:17:25

0001 // Created by: DAUTRY Philippe
0002 // Copyright (c) 1997-1999 Matra Datavision
0003 // Copyright (c) 1999-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 #ifndef _TDF_Delta_HeaderFile
0017 #define _TDF_Delta_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <Standard_Integer.hxx>
0023 #include <TDF_AttributeDelta.hxx>
0024 #include <NCollection_List.hxx>
0025 #include <TCollection_ExtendedString.hxx>
0026 #include <Standard_Transient.hxx>
0027 #include <TDF_Label.hxx>
0028 #include <Standard_OStream.hxx>
0029 class TDF_AttributeDelta;
0030 
0031 //! A set of AttributeDelta for a given transaction
0032 //! number and reference time number.
0033 //! A delta set is available at <aSourceTime>. If
0034 //! applied, it restores the TDF_Data in the state it
0035 //! was at <aTargetTime>.
0036 class TDF_Delta : public Standard_Transient
0037 {
0038 
0039 public:
0040   //! Creates a delta.
0041   Standard_EXPORT TDF_Delta();
0042 
0043   //! Returns true if there is nothing to undo.
0044   bool IsEmpty() const;
0045 
0046   //! Returns true if the Undo action of <me> is
0047   //! applicable at <aCurrentTime>.
0048   bool IsApplicable(const int aCurrentTime) const;
0049 
0050   //! Returns the field <myBeginTime>.
0051   int BeginTime() const;
0052 
0053   //! Returns the field <myEndTime>.
0054   int EndTime() const;
0055 
0056   //! Adds in <aLabelList> the labels of the attribute deltas.
0057   //! Caution: <aLabelList> is not cleared before use.
0058   Standard_EXPORT void Labels(NCollection_List<TDF_Label>& aLabelList) const;
0059 
0060   //! Returns the field <myAttDeltaList>.
0061   const NCollection_List<occ::handle<TDF_AttributeDelta>>& AttributeDeltas() const;
0062 
0063   //! Returns a name associated with this delta.
0064   TCollection_ExtendedString Name() const;
0065 
0066   //! Associates a name <theName> with this delta
0067   void SetName(const TCollection_ExtendedString& theName);
0068 
0069   Standard_EXPORT void Dump(Standard_OStream& OS) const;
0070 
0071   //! Dumps the content of me into the stream
0072   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const;
0073 
0074   friend class TDF_Data;
0075 
0076   DEFINE_STANDARD_RTTIEXT(TDF_Delta, Standard_Transient)
0077 
0078 protected:
0079   //! Validates <me> at <aBeginTime>. If applied, it
0080   //! restores the TDF_Data in the state it was at
0081   //! <anEndTime>. Reserved to TDF_Data.
0082   Standard_EXPORT void Validity(const int aBeginTime, const int anEndTime);
0083 
0084   //! Adds an AttributeDelta to the list. Reserved to
0085   //! TDF_Data.
0086   Standard_EXPORT void AddAttributeDelta(const occ::handle<TDF_AttributeDelta>& anAttributeDelta);
0087 
0088 private:
0089   //! Replaces Attribute Delta List
0090   void ReplaceDeltaList(const NCollection_List<occ::handle<TDF_AttributeDelta>>& theList);
0091 
0092   void BeforeOrAfterApply(const bool before) const;
0093 
0094   void Apply();
0095 
0096   int                                               myBeginTime;
0097   int                                               myEndTime;
0098   NCollection_List<occ::handle<TDF_AttributeDelta>> myAttDeltaList;
0099   TCollection_ExtendedString                        myName;
0100 };
0101 
0102 #include <TDF_Delta.lxx>
0103 
0104 #endif // _TDF_Delta_HeaderFile