AGX Dynamics  2.37.3.2
ObjectEvent.Declaration.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or
9 having been advised so by Algoryx Simulation AB for a time limited evaluation,
10 or having purchased a valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 //-----------------------------------------------
18 // AUTOMATICALLY GENERATED EVENT, DO NOT EDIT!
19 //-----------------------------------------------
20 
21 #ifndef GENERATED_AGX_OBJECT_H_DECLARATION
22 #define GENERATED_AGX_OBJECT_H_DECLARATION
23 
24 #include <agx/macros.h>
25 
27 class EventDispatch;
28 
29 class AGXCORE_EXPORT EventListener
30 {
31 public:
32 
33  EventListener(agx::Object *owner = nullptr);
34  virtual ~EventListener();
35 
36  agx::Object* getOwner();
37  template <typename T>
38  T* getOwner();
39 
40  virtual void destroyCallback(agx::Object* object);
41 
42 private:
43  friend class EventDispatch;
44 private:
45  agx::Object* m_owner;
46  agx::UInt32 m_numRegistered;
47 };
48 
49 class AGXCORE_EXPORT EventDispatch
50 {
51 public:
52  EventDispatch();
53  ~EventDispatch();
54 
55 public:
56  void addListener(EventListener* listener);
57  void removeListener(EventListener* listener);
58  bool hasListener(EventListener* listener) const;
59 
61  const EventListenerPtrVector& getListeners() const;
62 
63 public:
64  void triggerDestroyEvent(agx::Object* object);
65 
66 private:
67  EventListenerPtrVector m_listeners;
68  agx::Thread *m_activeThread;
69  agx::UInt32 m_iterationIndex;
70 };
71 
72 class AGXCORE_EXPORT DestroyEvent : public agx::Object::Event
73 {
74 public:
75  DestroyEvent(agx::Object* object);
76 
77  agx::Object* getObject();
78 
79 protected:
80  virtual ~DestroyEvent();
81 
82 private:
83  agx::Object* m_object;
84 };
85 
86 
88 #endif // GENERATED_AGX_OBJECT_H_DECLARATION
agx::Thread is a representation of an OS specific implementation of a computational thread...
Definition: Thread.h:198
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
agx::Vector< EventListener * > EventListenerPtrVector
Definition: EventListener.h:32
uint32_t UInt32
Definition: Integer.h:40
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define AGXCORE_EXPORT
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97
agx::Object is a refcounted object with a name.
Definition: Object.h:58