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