42cf5bc1 |
1 | // Created on: 1994-11-04 |
2 | // Created by: Christian CAILLET |
3 | // Copyright (c) 1994-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _MoniTool_Element_HeaderFile |
18 | #define _MoniTool_Element_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Integer.hxx> |
24 | #include <MoniTool_AttrList.hxx> |
25e59720 |
25 | #include <Standard_Transient.hxx> |
42cf5bc1 |
26 | #include <Standard_Boolean.hxx> |
27 | #include <Standard_Type.hxx> |
28 | #include <Standard_CString.hxx> |
29 | class MoniTool_AttrList; |
30 | |
31 | |
32 | class MoniTool_Element; |
25e59720 |
33 | DEFINE_STANDARD_HANDLE(MoniTool_Element, Standard_Transient) |
42cf5bc1 |
34 | |
35 | //! a Element allows to map any kind of object as a Key for a Map. |
36 | //! This works by defining, for a Hash Code, that of the real Key, |
37 | //! not of the Element which acts only as an intermediate. |
38 | //! When a Map asks for the HashCode of a Element, this one returns |
39 | //! the code it has determined at creation time |
25e59720 |
40 | class MoniTool_Element : public Standard_Transient |
42cf5bc1 |
41 | { |
42 | |
43 | public: |
44 | |
45 | |
46 | //! Returns the HashCode which has been stored by SetHashCode |
47 | //! (remark that HashCode could be deferred then be defined by |
48 | //! sub-classes, the result is the same) |
49 | Standard_EXPORT Standard_Integer GetHashCode() const; |
50 | |
51 | //! Specific testof equallity : to be defined by each sub-class, |
52 | //! must be False if Elements have not the same true Type, else |
53 | //! their contents must be compared |
54 | Standard_EXPORT virtual Standard_Boolean Equates (const Handle(MoniTool_Element)& other) const = 0; |
55 | |
56 | //! Returns the Type of the Value. By default, returns the |
57 | //! DynamicType of <me>, but can be redefined |
58 | Standard_EXPORT virtual Handle(Standard_Type) ValueType() const; |
59 | |
60 | //! Returns the name of the Type of the Value. Default is name |
61 | //! of ValueType, unless it is for a non-handled object |
62 | Standard_EXPORT virtual Standard_CString ValueTypeName() const; |
63 | |
64 | //! Returns (readonly) the Attribute List |
65 | Standard_EXPORT const MoniTool_AttrList& ListAttr() const; |
66 | |
67 | //! Returns (modifiable) the Attribute List |
68 | Standard_EXPORT MoniTool_AttrList& ChangeAttr(); |
69 | |
70 | |
71 | |
72 | |
25e59720 |
73 | DEFINE_STANDARD_RTTIEXT(MoniTool_Element,Standard_Transient) |
42cf5bc1 |
74 | |
75 | protected: |
76 | |
77 | |
78 | //! Stores the HashCode which corresponds to the Value given to |
79 | //! create the Mapper |
80 | Standard_EXPORT void SetHashCode (const Standard_Integer code); |
81 | |
82 | |
83 | |
84 | private: |
85 | |
86 | |
87 | Standard_Integer thecode; |
88 | MoniTool_AttrList theattrib; |
89 | |
90 | |
91 | }; |
92 | |
93 | |
94 | |
95 | |
96 | |
97 | |
98 | |
99 | #endif // _MoniTool_Element_HeaderFile |