Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-04 08:46:31

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