Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
berryIDebugObjectListener.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 
14 #ifndef BERRYIDEBUGOBJECTLISTENER_H_
15 #define BERRYIDEBUGOBJECTLISTENER_H_
16 
17 #include "berryMessage.h"
18 
20 
21 namespace berry
22 {
23 
24 class Object;
25 
27 {
28 
30 
31  enum Type {
32  NONE = 0x00000000,
33  OBJECT_CREATED = 0x00000001,
34  OBJECT_DESTROYED = 0x00000002,
35  OBJECT_TRACING = 0x00000004,
36  SMARTPOINTER_CREATED = 0x00000008,
37  SMARTPOINTER_DESTROYED = 0x00000010,
38 
39  ALL = 0xffffffff
40  };
41 
42  Q_DECLARE_FLAGS(Types, Type)
43 
44  typedef Message1<const Object*> ObjectEventType;
45  typedef Message3<unsigned int, bool, const Object*> TracingEventType;
46  typedef Message2<unsigned int, const Object*> SmartPointerEventType;
47 
48  ObjectEventType objCreatedEvent;
49  ObjectEventType objDestroyedEvent;
50  TracingEventType objTracingEvent;
51  SmartPointerEventType spCreatedEvent;
52  SmartPointerEventType spDestroyedEvent;
53 
54  void AddListener(IDebugObjectListener* listener);
55  void RemoveListener(IDebugObjectListener* listener);
56 
58  typedef MessageDelegate3<IDebugObjectListener, unsigned int, bool, const Object*> TraceDelegate;
59  typedef MessageDelegate2<IDebugObjectListener, unsigned int, const Object*> SPDelegate;
60  };
61 
62  virtual ~IDebugObjectListener();
63 
64  virtual Events::Types GetEventTypes() const = 0;
65 
66  virtual void ObjectCreated(const Object* /*obj*/)
67  {
68  }
69 
70  virtual void ObjectDestroyed(const Object* /*obj*/)
71  {
72  }
73 
74  virtual void ObjectTracingChanged(unsigned int /*traceId*/, bool /*enabled*/ = true, const Object* /*obj*/ = nullptr)
75  {
76  }
77 
78  virtual void SmartPointerCreated(unsigned int /*id*/, const Object* /*obj*/)
79  {
80  }
81 
82  virtual void SmartPointerDestroyed(unsigned int /*id*/, const Object* /*obj*/)
83  {
84  }
85 
86 };
87 
88 }
89 
90 Q_DECLARE_OPERATORS_FOR_FLAGS(berry::IDebugObjectListener::Events::Types)
91 
92 #endif /* BERRYIDEBUGOBJECTLISTENER_H_ */
org_blueberry_core_runtime_Export.h
berry::IDebugObjectListener::Events::Type
Type
Definition: berryIDebugObjectListener.h:31
berry::IDebugObjectListener::Events
Definition: berryIDebugObjectListener.h:29
berryMessage.h
berry::Message1
Definition: berryMessage.h:787
berry::IDebugObjectListener::ObjectTracingChanged
virtual void ObjectTracingChanged(unsigned int, bool=true, const Object *=nullptr)
Definition: berryIDebugObjectListener.h:74
berry::IDebugObjectListener::SmartPointerCreated
virtual void SmartPointerCreated(unsigned int, const Object *)
Definition: berryIDebugObjectListener.h:78
berry::Message3
Definition: berryMessage.h:929
berry::Object
Light weight base class for most BlueBerry classes.
Definition: berryObject.h:72
berry::IDebugObjectListener
Definition: berryIDebugObjectListener.h:26
berry::MessageDelegate1
Definition: berryMessage.h:170
org_blueberry_core_runtime_EXPORT
#define org_blueberry_core_runtime_EXPORT
Definition: org_blueberry_core_runtime_Export.h:26
berry::IDebugObjectListener::SmartPointerDestroyed
virtual void SmartPointerDestroyed(unsigned int, const Object *)
Definition: berryIDebugObjectListener.h:82
berry::Message2
Definition: berryMessage.h:858
berry::IDebugObjectListener::ObjectDestroyed
virtual void ObjectDestroyed(const Object *)
Definition: berryIDebugObjectListener.h:70
berry::MessageDelegate2
Definition: berryMessage.h:216
berry
Definition: QmitkPropertyItemModel.h:24
berry::MessageDelegate3
Definition: berryMessage.h:262