42cf5bc1 |
1 | // Created on: 2007-07-31 |
2 | // Created by: Sergey ZARITCHNY |
3 | // Copyright (c) 2007-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 _TDataStd_IntPackedMap_HeaderFile |
17 | #define _TDataStd_IntPackedMap_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_Type.hxx> |
21 | |
22 | #include <Standard_Boolean.hxx> |
23 | #include <TDF_Attribute.hxx> |
24 | #include <TColStd_PackedMapOfInteger.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | #include <Standard_OStream.hxx> |
27 | class TColStd_HPackedMapOfInteger; |
28 | class TDataStd_DeltaOnModificationOfIntPackedMap; |
29 | class Standard_GUID; |
30 | class TDF_Label; |
31 | class TDF_Attribute; |
32 | class TDF_RelocationTable; |
33 | class TDF_DeltaOnModification; |
34 | |
35 | |
36 | class TDataStd_IntPackedMap; |
37 | DEFINE_STANDARD_HANDLE(TDataStd_IntPackedMap, TDF_Attribute) |
38 | |
39 | //! Attribute for storing TColStd_PackedMapOfInteger |
40 | class TDataStd_IntPackedMap : public TDF_Attribute |
41 | { |
42 | |
43 | public: |
44 | |
45 | |
46 | //! class methods |
47 | //! ============= |
48 | //! Returns the GUID of the attribute. |
49 | Standard_EXPORT static const Standard_GUID& GetID(); |
50 | |
51 | //! Finds or creates an integer map attribute on the given label. |
52 | //! If <isDelta> == False, DefaultDeltaOnModification is used. |
53 | //! If <isDelta> == True, DeltaOnModification of the current attribute is used. |
54 | //! If attribute is already set, input parameter <isDelta> is refused and the found |
55 | //! attribute returned. |
56 | //! Attribute methods |
57 | //! =================== |
58 | Standard_EXPORT static Handle(TDataStd_IntPackedMap) Set (const TDF_Label& label, const Standard_Boolean isDelta = Standard_False); |
59 | |
60 | Standard_EXPORT TDataStd_IntPackedMap(); |
61 | |
62 | Standard_EXPORT Standard_Boolean ChangeMap (const Handle(TColStd_HPackedMapOfInteger)& theMap); |
63 | |
64 | const TColStd_PackedMapOfInteger& GetMap() const; |
65 | |
66 | const Handle(TColStd_HPackedMapOfInteger)& GetHMap() const; |
67 | |
68 | Standard_EXPORT Standard_Boolean Clear(); |
69 | |
70 | Standard_EXPORT Standard_Boolean Add (const Standard_Integer theKey); |
71 | |
72 | Standard_EXPORT Standard_Boolean Remove (const Standard_Integer theKey); |
73 | |
74 | Standard_EXPORT Standard_Boolean Contains (const Standard_Integer theKey) const; |
75 | |
76 | Standard_Integer Extent() const; |
77 | |
78 | Standard_Boolean IsEmpty() const; |
79 | |
80 | Standard_Boolean GetDelta() const; |
81 | |
82 | //! for internal use only! |
83 | void SetDelta (const Standard_Boolean isDelta); |
84 | |
79104795 |
85 | Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; |
42cf5bc1 |
86 | |
79104795 |
87 | Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE; |
42cf5bc1 |
88 | |
79104795 |
89 | Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; |
42cf5bc1 |
90 | |
79104795 |
91 | Standard_EXPORT void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE; |
42cf5bc1 |
92 | |
93 | Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE; |
94 | |
95 | //! Makes a DeltaOnModification between <me> and |
96 | //! <anOldAttribute>. |
97 | Standard_EXPORT virtual Handle(TDF_DeltaOnModification) DeltaOnModification (const Handle(TDF_Attribute)& anOldAttribute) const Standard_OVERRIDE; |
98 | |
99 | |
100 | friend class TDataStd_DeltaOnModificationOfIntPackedMap; |
101 | |
102 | |
92efcf78 |
103 | DEFINE_STANDARD_RTTIEXT(TDataStd_IntPackedMap,TDF_Attribute) |
42cf5bc1 |
104 | |
105 | protected: |
106 | |
107 | |
108 | |
109 | |
110 | private: |
111 | |
112 | |
113 | void RemoveMap(); |
114 | |
115 | Handle(TColStd_HPackedMapOfInteger) myMap; |
116 | Standard_Boolean myIsDelta; |
117 | |
118 | |
119 | }; |
120 | |
121 | |
122 | #include <TDataStd_IntPackedMap.lxx> |
123 | |
124 | |
125 | |
126 | |
127 | |
128 | #endif // _TDataStd_IntPackedMap_HeaderFile |