0029142: Exception on Redo.
[occt.git] / src / TDF / TDF_Delta.hxx
CommitLineData
42cf5bc1 1// Created by: DAUTRY Philippe
2// Copyright (c) 1997-1999 Matra Datavision
3// Copyright (c) 1999-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _TDF_Delta_HeaderFile
17#define _TDF_Delta_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_Type.hxx>
21
22#include <Standard_Integer.hxx>
23#include <TDF_AttributeDeltaList.hxx>
24#include <TCollection_ExtendedString.hxx>
25e59720 25#include <Standard_Transient.hxx>
42cf5bc1 26#include <Standard_Boolean.hxx>
27#include <TDF_LabelList.hxx>
28#include <Standard_OStream.hxx>
29class Standard_OutOfRange;
30class TDF_Data;
31class TDF_AttributeDelta;
32class TCollection_ExtendedString;
33
34
35class TDF_Delta;
25e59720 36DEFINE_STANDARD_HANDLE(TDF_Delta, Standard_Transient)
42cf5bc1 37
38//! A set of AttributeDelta for a given transaction
39//! number and reference time number.
40//! A delta set is available at <aSourceTime>. If
41//! applied, it restores the TDF_Data in the state it
42//! was at <aTargetTime>.
25e59720 43class TDF_Delta : public Standard_Transient
42cf5bc1 44{
45
46public:
47
48
49 //! Creates a delta.
50 Standard_EXPORT TDF_Delta();
51
52 //! Returns true if there is nothing to undo.
53 Standard_Boolean IsEmpty() const;
54
55 //! Returns true if the Undo action of <me> is
56 //! applicable at <aCurrentTime>.
57 Standard_Boolean IsApplicable (const Standard_Integer aCurrentTime) const;
58
59 //! Returns the field <myBeginTime>.
60 Standard_Integer BeginTime() const;
61
62 //! Returns the field <myEndTime>.
63 Standard_Integer EndTime() const;
64
65 //! Adds in <aLabelList> the labels of the attribute deltas.
66 //! Caution: <aLabelList> is not cleared before use.
67 Standard_EXPORT void Labels (TDF_LabelList& aLabelList) const;
68
69 //! Returns the field <myAttDeltaList>.
70 const TDF_AttributeDeltaList& AttributeDeltas() const;
71
72 //! Returns a name associated with this delta.
73 TCollection_ExtendedString Name() const;
74
75 //! Associates a name <theName> with this delta
76 void SetName (const TCollection_ExtendedString& theName);
a7378539 77
42cf5bc1 78 Standard_EXPORT void Dump (Standard_OStream& OS) const;
79
80
81friend class TDF_Data;
82
83
25e59720 84 DEFINE_STANDARD_RTTIEXT(TDF_Delta,Standard_Transient)
42cf5bc1 85
86protected:
87
88
89 //! Validates <me> at <aBeginTime>. If applied, it
90 //! restores the TDF_Data in the state it was at
91 //! <anEndTime>. Reserved to TDF_Data.
92 Standard_EXPORT void Validity (const Standard_Integer aBeginTime, const Standard_Integer anEndTime);
93
94 //! Adds an AttributeDelta to the list. Reserved to
95 //! TDF_Data.
96 Standard_EXPORT void AddAttributeDelta (const Handle(TDF_AttributeDelta)& anAttributeDelta);
97
42cf5bc1 98private:
99
a7378539 100 //! Replaces Attribute Delta List
101 Standard_EXPORT void ReplaceDeltaList(const TDF_AttributeDeltaList& theList);
102
42cf5bc1 103 Standard_EXPORT void BeforeOrAfterApply (const Standard_Boolean before) const;
104
105 Standard_EXPORT void Apply();
106
107 Standard_Integer myBeginTime;
108 Standard_Integer myEndTime;
109 TDF_AttributeDeltaList myAttDeltaList;
110 TCollection_ExtendedString myName;
111
112
113};
114
115
116#include <TDF_Delta.lxx>
117
118
119
120
121
122#endif // _TDF_Delta_HeaderFile