File indexing completed on 2026-09-13 09:18:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef TObj_TIntSparseArray_HeaderFile
0019 #define TObj_TIntSparseArray_HeaderFile
0020
0021 #include <NCollection_SparseArray.hxx>
0022 #include <TDF_Label.hxx>
0023
0024 class Standard_GUID;
0025
0026
0027
0028
0029
0030
0031
0032 class TObj_TIntSparseArray : public TDF_Attribute
0033 {
0034 public:
0035
0036 Standard_EXPORT TObj_TIntSparseArray();
0037
0038
0039 static Standard_EXPORT const Standard_GUID& GetID();
0040
0041
0042 Standard_EXPORT const Standard_GUID& ID() const override;
0043
0044
0045 static Standard_EXPORT occ::handle<TObj_TIntSparseArray> Set(const TDF_Label& theLabel);
0046
0047 public:
0048
0049
0050
0051 size_t Size() const { return myVector.Size(); }
0052
0053 typedef NCollection_SparseArray<int>::ConstIterator Iterator;
0054
0055
0056 Iterator GetIterator() const { return Iterator(myVector); }
0057
0058
0059 bool HasValue(const size_t theId) const { return myVector.HasValue(theId); }
0060
0061
0062
0063 int Value(const size_t theId) const { return myVector.Value(theId); }
0064
0065
0066
0067 Standard_EXPORT void SetValue(const size_t theId, const int theValue);
0068
0069
0070
0071 Standard_EXPORT void UnsetValue(const size_t theId);
0072
0073
0074 Standard_EXPORT void Clear();
0075
0076 public:
0077
0078
0079
0080
0081 Standard_EXPORT occ::handle<TDF_Attribute> NewEmpty() const override;
0082
0083
0084 Standard_EXPORT occ::handle<TDF_Attribute> BackupCopy() const override;
0085
0086
0087 Standard_EXPORT void Restore(const occ::handle<TDF_Attribute>& theDelta) override;
0088
0089
0090
0091 Standard_EXPORT void Paste(const occ::handle<TDF_Attribute>& theInto,
0092 const occ::handle<TDF_RelocationTable>& theRT) const override;
0093
0094
0095
0096 Standard_EXPORT void BeforeCommitTransaction() override;
0097
0098
0099 Standard_EXPORT void DeltaOnModification(
0100 const occ::handle<TDF_DeltaOnModification>& theDelta) override;
0101
0102
0103 Standard_EXPORT bool AfterUndo(const occ::handle<TDF_AttributeDelta>& theDelta,
0104 const bool toForce) override;
0105
0106 public:
0107
0108
0109
0110
0111 void SetDoBackup(const bool toDo) { myDoBackup = toDo; }
0112
0113 void ClearDelta() { myOldMap.Clear(); }
0114
0115 private:
0116
0117
0118 enum
0119 {
0120 AbsentValue = -1
0121 };
0122
0123
0124 void backupValue(const size_t theId, const int theCurrValue, const int theNewValue);
0125
0126 NCollection_SparseArray<int> myVector;
0127 NCollection_SparseArray<int> myOldMap;
0128 bool myDoBackup;
0129
0130 public:
0131
0132 DEFINE_STANDARD_RTTIEXT(TObj_TIntSparseArray, TDF_Attribute)
0133 };
0134
0135
0136 #endif
0137
0138 #ifdef _MSC_VER
0139 #pragma once
0140 #endif