1 // Created on: 2007-07-31
2 // Created by: Sergey ZARITCHNY
3 // Copyright (c) 2007-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _TDataStd_IntPackedMap_HeaderFile
17 #define _TDataStd_IntPackedMap_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
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;
32 class TDF_RelocationTable;
33 class TDF_DeltaOnModification;
36 class TDataStd_IntPackedMap;
37 DEFINE_STANDARD_HANDLE(TDataStd_IntPackedMap, TDF_Attribute)
39 //! Attribute for storing TColStd_PackedMapOfInteger
40 class TDataStd_IntPackedMap : public TDF_Attribute
48 //! Returns the GUID of the attribute.
49 Standard_EXPORT static const Standard_GUID& GetID();
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.
57 //! ===================
58 Standard_EXPORT static Handle(TDataStd_IntPackedMap) Set (const TDF_Label& label, const Standard_Boolean isDelta = Standard_False);
60 Standard_EXPORT TDataStd_IntPackedMap();
62 Standard_EXPORT Standard_Boolean ChangeMap (const Handle(TColStd_HPackedMapOfInteger)& theMap);
64 const TColStd_PackedMapOfInteger& GetMap() const;
66 const Handle(TColStd_HPackedMapOfInteger)& GetHMap() const;
68 Standard_EXPORT Standard_Boolean Clear();
70 Standard_EXPORT Standard_Boolean Add (const Standard_Integer theKey);
72 Standard_EXPORT Standard_Boolean Remove (const Standard_Integer theKey);
74 Standard_EXPORT Standard_Boolean Contains (const Standard_Integer theKey) const;
76 Standard_Integer Extent() const;
78 Standard_Boolean IsEmpty() const;
80 Standard_Boolean GetDelta() const;
82 //! for internal use only!
83 void SetDelta (const Standard_Boolean isDelta);
85 Standard_EXPORT const Standard_GUID& ID() const;
87 Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with);
89 Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
91 Standard_EXPORT void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const;
93 Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE;
95 //! Makes a DeltaOnModification between <me> and
97 Standard_EXPORT virtual Handle(TDF_DeltaOnModification) DeltaOnModification (const Handle(TDF_Attribute)& anOldAttribute) const Standard_OVERRIDE;
100 friend class TDataStd_DeltaOnModificationOfIntPackedMap;
103 DEFINE_STANDARD_RTTI(TDataStd_IntPackedMap,TDF_Attribute)
115 Handle(TColStd_HPackedMapOfInteger) myMap;
116 Standard_Boolean myIsDelta;
122 #include <TDataStd_IntPackedMap.lxx>
128 #endif // _TDataStd_IntPackedMap_HeaderFile