Medical Imaging Interaction Toolkit  2024.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
berryHandleObject.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef BERRYHANDLEOBJECT_H_
14 #define BERRYHANDLEOBJECT_H_
15 
16 #include <berryMacros.h>
17 #include <berryObject.h>
19 
20 #include <QHash>
21 
22 namespace berry {
23 
48 class BERRY_COMMANDS HandleObject : public virtual Object { // extends EventManager implements IIdentifiable {
49 
50 public:
51 
53 
54 private:
55 
60  static const uint HASH_CODE_NOT_COMPUTED; // = 0;
61 
65  static const uint HASH_FACTOR; // = 89;
66 
70  static const uint HASH_INITIAL;
71 
76  mutable uint hashCode; // = HASH_CODE_NOT_COMPUTED;
77 
78 
79 protected:
80 
85  bool defined;
86 
92  const QString id;
93 
100  mutable QString str;
101 
108  HandleObject(const QString& id);
109 
110 
111 public:
112 
122  bool operator==(const Object* object) const override;
123 
124  QString GetId() const;
125 
131  uint HashCode() const override
132  {
133  if (hashCode == HASH_CODE_NOT_COMPUTED)
134  {
135  hashCode = HASH_INITIAL * HASH_FACTOR + qHash(id);
136  if (hashCode == HASH_CODE_NOT_COMPUTED)
137  {
138  hashCode++;
139  }
140  }
141  return hashCode;
142  }
143 
152  bool IsDefined() const;
153 
159  virtual void Undefine() = 0;
160 };
161 
162 }
163 
164 #endif /*BERRYHANDLEOBJECT_H_*/
org_blueberry_core_commands_Export.h
berryMacros.h
BERRY_COMMANDS
#define BERRY_COMMANDS
Definition: org_blueberry_core_commands_Export.h:26
berry::Object
Light weight base class for most BlueBerry classes.
Definition: berryObject.h:72
berry::HandleObject::HashCode
uint HashCode() const override
Definition: berryHandleObject.h:131
qHash
org_blueberry_core_runtime_EXPORT uint qHash(const berry::Object &o)
mitk::operator==
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
berry::HandleObject::str
QString str
Definition: berryHandleObject.h:100
berry::HandleObject
Definition: berryHandleObject.h:48
berryObjectMacro
#define berryObjectMacro(...)
Definition: berryMacros.h:31
berryObject.h
berry::HandleObject::defined
bool defined
Definition: berryHandleObject.h:85
berry
Definition: QmitkPropertyItemModel.h:24
berry::HandleObject::id
const QString id
Definition: berryHandleObject.h:92