Medical Imaging Interaction Toolkit  2021.10.99-1c4db16f
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_ */
Light weight base class for most BlueBerry classes.
Definition: berryObject.h:72
virtual void SmartPointerDestroyed(unsigned int, const Object *)
virtual void ObjectTracingChanged(unsigned int, bool=true, const Object *=nullptr)
#define org_blueberry_core_runtime_EXPORT
virtual void SmartPointerCreated(unsigned int, const Object *)
virtual void ObjectDestroyed(const Object *)