Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:17

0001 // Created on: 1994-11-04
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1994-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _MoniTool_Element_HeaderFile
0018 #define _MoniTool_Element_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Standard_Integer.hxx>
0023 #include <MoniTool_AttrList.hxx>
0024 #include <Standard_Transient.hxx>
0025 #include <Standard_Type.hxx>
0026 
0027 
0028 class MoniTool_Element;
0029 DEFINE_STANDARD_HANDLE(MoniTool_Element, Standard_Transient)
0030 
0031 //! a Element allows to map any kind of object as a Key for a Map.
0032 //! This works by defining, for a Hash Code, that of the real Key,
0033 //! not of the Element which acts only as an intermediate.
0034 //! When a Map asks for the HashCode of a Element, this one returns
0035 //! the code it has determined at creation time
0036 class MoniTool_Element : public Standard_Transient
0037 {
0038 
0039 public:
0040 
0041   
0042   //! Empty constructor
0043   Standard_EXPORT MoniTool_Element();
0044   
0045   //! Returns the HashCode which has been stored by SetHashCode
0046   //! (remark that HashCode could be deferred then be defined by
0047   //! sub-classes, the result is the same)
0048   Standard_EXPORT size_t GetHashCode() const;
0049   
0050   //! Specific testof equality : to be defined by each sub-class,
0051   //! must be False if Elements have not the same true Type, else
0052   //! their contents must be compared
0053   Standard_EXPORT virtual Standard_Boolean Equates (const Handle(MoniTool_Element)& other) const = 0;
0054   
0055   //! Returns the Type of the Value. By default, returns the
0056   //! DynamicType of <me>, but can be redefined
0057   Standard_EXPORT virtual Handle(Standard_Type) ValueType() const;
0058   
0059   //! Returns the name of the Type of the Value. Default is name
0060   //! of ValueType, unless it is for a non-handled object
0061   Standard_EXPORT virtual Standard_CString ValueTypeName() const;
0062   
0063   //! Returns (readonly) the Attribute List
0064   Standard_EXPORT const MoniTool_AttrList& ListAttr() const;
0065   
0066   //! Returns (modifiable) the Attribute List
0067   Standard_EXPORT MoniTool_AttrList& ChangeAttr();
0068 
0069 
0070 
0071 
0072   DEFINE_STANDARD_RTTIEXT(MoniTool_Element,Standard_Transient)
0073 
0074 protected:
0075 
0076   
0077   //! Stores the HashCode which corresponds to the Value given to
0078   //! create the Mapper
0079   Standard_EXPORT void SetHashCode (const size_t code);
0080 
0081 
0082 
0083 private:
0084 
0085 
0086   size_t thecode;
0087   MoniTool_AttrList theattrib;
0088 
0089 
0090 };
0091 
0092 
0093 
0094 
0095 
0096 
0097 
0098 #endif // _MoniTool_Element_HeaderFile