Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryHandleObject.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef BERRYHANDLEOBJECT_H_
18 #define BERRYHANDLEOBJECT_H_
19 
20 #include <berryMacros.h>
21 #include <berryObject.h>
23 
24 #include <QHash>
25 
26 namespace berry {
27 
52 class BERRY_COMMANDS HandleObject : public virtual Object { // extends EventManager implements IIdentifiable {
53 
54 public:
55 
57 
58 private:
59 
64  static const uint HASH_CODE_NOT_COMPUTED; // = 0;
65 
69  static const uint HASH_FACTOR; // = 89;
70 
74  static const uint HASH_INITIAL;
75 
80  mutable uint hashCode; // = HASH_CODE_NOT_COMPUTED;
81 
82 
83 protected:
84 
89  bool defined;
90 
96  const QString id;
97 
104  mutable QString str;
105 
112  HandleObject(const QString& id);
113 
114 
115 public:
116 
126  bool operator==(const Object* object) const override;
127 
128  QString GetId() const;
129 
135  virtual uint HashCode() const override
136  {
137  if (hashCode == HASH_CODE_NOT_COMPUTED)
138  {
139  hashCode = HASH_INITIAL * HASH_FACTOR + qHash(id);
140  if (hashCode == HASH_CODE_NOT_COMPUTED)
141  {
142  hashCode++;
143  }
144  }
145  return hashCode;
146  }
147 
156  bool IsDefined() const;
157 
163  virtual void Undefine() = 0;
164 };
165 
166 }
167 
168 #endif /*BERRYHANDLEOBJECT_H_*/
virtual uint HashCode() const override
Light weight base class for most BlueBerry classes.
Definition: berryObject.h:78
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
#define berryObjectMacro(...)
Definition: berryMacros.h:37
unsigned int uint
uint qHash(const berry::Object &o)