AGX Dynamics  2.37.2.0
ValueEvent.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_VALUE_H_DECLARATION
22 #define GENERATED_AGX_VALUE_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(agxData::Value* value);
41  virtual void updateCallback(agxData::Value* value);
42  virtual void bindCallback(agxData::Value* value, agxData::Value* binding, agxData::Value* oldBinding);
43 
44 private:
45  friend class EventDispatch;
46 private:
47  agx::Object* m_owner;
48  agx::UInt32 m_numRegistered;
49 };
50 
51 class AGXCORE_EXPORT EventDispatch
52 {
53 public:
54  EventDispatch();
55  ~EventDispatch();
56 
57 public:
58  void addListener(EventListener* listener);
59  void removeListener(EventListener* listener);
60  bool hasListener(EventListener* listener) const;
61 
63  const EventListenerPtrVector& getListeners() const;
64 
65 public:
66  void triggerDestroyEvent(agxData::Value* value);
67  void triggerUpdateEvent(agxData::Value* value);
68  void triggerBindEvent(agxData::Value* value, agxData::Value* binding, agxData::Value* oldBinding);
69 
70 private:
71  EventListenerPtrVector m_listeners;
72  agx::Thread *m_activeThread;
73  agx::UInt32 m_iterationIndex;
74 };
75 
76 class AGXCORE_EXPORT DestroyEvent : public agx::Object::Event
77 {
78 public:
79  DestroyEvent(agxData::Value* value);
80 
81  agxData::Value* getValue();
82 
83 protected:
84  virtual ~DestroyEvent();
85 
86 private:
87  agxData::Value* m_value;
88 };
89 
90 class AGXCORE_EXPORT UpdateEvent : public agx::Object::Event
91 {
92 public:
93  UpdateEvent(agxData::Value* value);
94 
95  agxData::Value* getValue();
96 
97 protected:
98  virtual ~UpdateEvent();
99 
100 private:
101  agxData::Value* m_value;
102 };
103 
104 class AGXCORE_EXPORT BindEvent : public agx::Object::Event
105 {
106 public:
107  BindEvent(agxData::Value* value, agxData::Value* binding, agxData::Value* oldBinding);
108 
109  agxData::Value* getValue();
110  agxData::Value* getBinding();
111  agxData::Value* getOldBinding();
112 
113 protected:
114  virtual ~BindEvent();
115 
116 private:
117  agxData::Value* m_value;
118  agxData::Value* m_binding;
119  agxData::Value* m_oldBinding;
120 };
121 
122 
124 #endif // GENERATED_AGX_VALUE_H_DECLARATION
agx::Thread is a representation of an OS specific implementation of a computational thread...
Definition: Thread.h:198
Abstract representation of a value.
Definition: Value.h:48
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