File indexing completed on 2025-01-18 10:05:22
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
0022 #include <NCollection_SparseArray.hxx>
0023 #include <TDF_Label.hxx>
0024
0025 typedef NCollection_SparseArray<Standard_Integer> TObj_TIntSparseArray_VecOfData;
0026 typedef NCollection_SparseArray<Standard_Integer> TObj_TIntSparseArray_MapOfData;
0027
0028 class Standard_GUID;
0029
0030
0031
0032
0033
0034
0035
0036 class TObj_TIntSparseArray : public TDF_Attribute
0037 {
0038 public:
0039
0040
0041 Standard_EXPORT TObj_TIntSparseArray();
0042
0043
0044 static Standard_EXPORT const Standard_GUID& GetID();
0045
0046
0047 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
0048
0049
0050 static Standard_EXPORT Handle(TObj_TIntSparseArray) Set
0051 (const TDF_Label& theLabel);
0052
0053 public:
0054
0055
0056
0057 Standard_Size Size() const
0058 { return myVector.Size(); }
0059
0060 typedef TObj_TIntSparseArray_VecOfData::ConstIterator Iterator;
0061
0062
0063 Iterator GetIterator() const { return Iterator(myVector); }
0064
0065
0066 Standard_Boolean HasValue (const Standard_Size theId) const
0067 { return myVector.HasValue(theId); }
0068
0069
0070
0071 Standard_Integer Value (const Standard_Size theId) const
0072 { return myVector.Value(theId); }
0073
0074
0075
0076 Standard_EXPORT void SetValue (const Standard_Size theId,
0077 const Standard_Integer theValue);
0078
0079
0080
0081 Standard_EXPORT void UnsetValue(const Standard_Size theId);
0082
0083
0084 Standard_EXPORT void Clear ();
0085
0086 public:
0087
0088
0089
0090
0091 Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
0092
0093
0094 Standard_EXPORT Handle(TDF_Attribute) BackupCopy() const Standard_OVERRIDE;
0095
0096
0097 Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theDelta) Standard_OVERRIDE;
0098
0099
0100
0101 Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theInto,
0102 const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE;
0103
0104
0105
0106 Standard_EXPORT void BeforeCommitTransaction() Standard_OVERRIDE;
0107
0108
0109 Standard_EXPORT void DeltaOnModification
0110 (const Handle(TDF_DeltaOnModification)& theDelta) Standard_OVERRIDE;
0111
0112
0113 Standard_EXPORT Standard_Boolean AfterUndo
0114 (const Handle(TDF_AttributeDelta)& theDelta,
0115 const Standard_Boolean toForce) Standard_OVERRIDE;
0116
0117 public:
0118
0119
0120
0121
0122 void SetDoBackup (const Standard_Boolean toDo)
0123 { myDoBackup = toDo; }
0124
0125 void ClearDelta ()
0126 { myOldMap.Clear(); }
0127
0128 private:
0129
0130
0131 enum
0132 {
0133 AbsentValue = -1
0134 };
0135
0136
0137 void backupValue (const Standard_Size theId,
0138 const Standard_Integer theCurrValue,
0139 const Standard_Integer theNewValue);
0140
0141 TObj_TIntSparseArray_VecOfData myVector;
0142 TObj_TIntSparseArray_MapOfData myOldMap;
0143 Standard_Boolean myDoBackup;
0144
0145 public:
0146
0147 DEFINE_STANDARD_RTTIEXT(TObj_TIntSparseArray,TDF_Attribute)
0148 };
0149
0150
0151 DEFINE_STANDARD_HANDLE(TObj_TIntSparseArray,TDF_Attribute)
0152
0153 #endif
0154
0155 #ifdef _MSC_VER
0156 #pragma once
0157 #endif