6016546fbe43108d6182e4838b381ca68b9eb960
[occt.git] / src / MoniTool / MoniTool_Element.hxx
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>
25 #include <Standard_Transient.hxx>
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;
33 DEFINE_STANDARD_HANDLE(MoniTool_Element, Standard_Transient)
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
40 class MoniTool_Element : public Standard_Transient
41 {
42
43 public:
44
45   
46   //! Empty constructor
47   Standard_EXPORT MoniTool_Element();
48   
49   //! Returns the HashCode which has been stored by SetHashCode
50   //! (remark that HashCode could be deferred then be defined by
51   //! sub-classes, the result is the same)
52   Standard_EXPORT Standard_Integer GetHashCode() const;
53   
54   //! Specific testof equallity : to be defined by each sub-class,
55   //! must be False if Elements have not the same true Type, else
56   //! their contents must be compared
57   Standard_EXPORT virtual Standard_Boolean Equates (const Handle(MoniTool_Element)& other) const = 0;
58   
59   //! Returns the Type of the Value. By default, returns the
60   //! DynamicType of <me>, but can be redefined
61   Standard_EXPORT virtual Handle(Standard_Type) ValueType() const;
62   
63   //! Returns the name of the Type of the Value. Default is name
64   //! of ValueType, unless it is for a non-handled object
65   Standard_EXPORT virtual Standard_CString ValueTypeName() const;
66   
67   //! Returns (readonly) the Attribute List
68   Standard_EXPORT const MoniTool_AttrList& ListAttr() const;
69   
70   //! Returns (modifiable) the Attribute List
71   Standard_EXPORT MoniTool_AttrList& ChangeAttr();
72
73
74
75
76   DEFINE_STANDARD_RTTIEXT(MoniTool_Element,Standard_Transient)
77
78 protected:
79
80   
81   //! Stores the HashCode which corresponds to the Value given to
82   //! create the Mapper
83   Standard_EXPORT void SetHashCode (const Standard_Integer code);
84
85
86
87 private:
88
89
90   Standard_Integer thecode;
91   MoniTool_AttrList theattrib;
92
93
94 };
95
96
97
98
99
100
101
102 #endif // _MoniTool_Element_HeaderFile