AGX Dynamics  2.37.3.2
EntityStorageEvent.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_ENTITYSTORAGE_H_DECLARATION
22 #define GENERATED_AGX_ENTITYSTORAGE_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::EntityStorage* storage);
41  virtual void createInstanceCallback(agxData::EntityStorage* storage, agxData::EntityPtr instance);
42  virtual void createInstancesCallback(agxData::EntityStorage* storage, agxData::EntityRange range);
43  virtual void createInstancesCallback(agxData::EntityStorage* storage, agxData::Array< agxData::EntityPtr > instances);
44  virtual void destroyInstanceCallback(agxData::EntityStorage* storage, agxData::EntityPtr instance);
45  virtual void destroyInstancesCallback(agxData::EntityStorage* storage, agxData::EntityRange range);
46  virtual void destroyInstancesCallback(agxData::EntityStorage* storage, agxData::Array< agxData::EntityPtr > instances);
47  virtual void permuteCallback(agxData::EntityStorage* storage, agxData::Array< agx::Index > permutation);
48 
49 private:
50  friend class EventDispatch;
51 private:
52  agx::Object* m_owner;
53  agx::UInt32 m_numRegistered;
54 };
55 
56 class AGXCORE_EXPORT EventDispatch
57 {
58 public:
59  EventDispatch();
60  ~EventDispatch();
61 
62 public:
63  void addListener(EventListener* listener);
64  void removeListener(EventListener* listener);
65  bool hasListener(EventListener* listener) const;
66 
68  const EventListenerPtrVector& getListeners() const;
69 
70 public:
71  void triggerDestroyEvent(agxData::EntityStorage* storage);
72  void triggerCreateInstanceEvent(agxData::EntityStorage* storage, agxData::EntityPtr instance);
73  void triggerCreateInstancesEvent(agxData::EntityStorage* storage, agxData::EntityRange range);
74  void triggerCreateInstancesEvent(agxData::EntityStorage* storage, agxData::Array< agxData::EntityPtr > instances);
75  void triggerDestroyInstanceEvent(agxData::EntityStorage* storage, agxData::EntityPtr instance);
76  void triggerDestroyInstancesEvent(agxData::EntityStorage* storage, agxData::EntityRange range);
77  void triggerDestroyInstancesEvent(agxData::EntityStorage* storage, agxData::Array< agxData::EntityPtr > instances);
78  void triggerPermuteEvent(agxData::EntityStorage* storage, agxData::Array< agx::Index > permutation);
79 
80 private:
81  EventListenerPtrVector m_listeners;
82  agx::Thread *m_activeThread;
83  agx::UInt32 m_iterationIndex;
84 };
85 
86 class AGXCORE_EXPORT DestroyEvent : public agx::Object::Event
87 {
88 public:
89  DestroyEvent(agxData::EntityStorage* storage);
90 
92 
93 protected:
94  virtual ~DestroyEvent();
95 
96 private:
97  agxData::EntityStorage* m_storage;
98 };
99 
100 class AGXCORE_EXPORT CreateInstanceEvent : public agx::Object::Event
101 {
102 public:
103  CreateInstanceEvent(agxData::EntityStorage* storage, agxData::EntityPtr instance);
104 
106  agxData::EntityPtr getInstance();
107 
108 protected:
109  virtual ~CreateInstanceEvent();
110 
111 private:
112  agxData::EntityStorage* m_storage;
113  agxData::EntityPtr m_instance;
114 };
115 
116 class AGXCORE_EXPORT CreateInstancesEvent : public agx::Object::Event
117 {
118 public:
119  CreateInstancesEvent(agxData::EntityStorage* storage, agxData::EntityRange range);
120 
122  agxData::EntityRange getRange();
123 
124 protected:
125  virtual ~CreateInstancesEvent();
126 
127 private:
128  agxData::EntityStorage* m_storage;
129  agxData::EntityRange m_range;
130 };
131 
132 class AGXCORE_EXPORT CreateInstancesEvent2 : public agx::Object::Event
133 {
134 public:
135  CreateInstancesEvent2(agxData::EntityStorage* storage, agxData::Array< agxData::EntityPtr > instances);
136 
139 
140 protected:
141  virtual ~CreateInstancesEvent2();
142 
143 private:
144  agxData::EntityStorage* m_storage;
146 };
147 
148 class AGXCORE_EXPORT DestroyInstanceEvent : public agx::Object::Event
149 {
150 public:
151  DestroyInstanceEvent(agxData::EntityStorage* storage, agxData::EntityPtr instance);
152 
154  agxData::EntityPtr getInstance();
155 
156 protected:
157  virtual ~DestroyInstanceEvent();
158 
159 private:
160  agxData::EntityStorage* m_storage;
161  agxData::EntityPtr m_instance;
162 };
163 
164 class AGXCORE_EXPORT DestroyInstancesEvent : public agx::Object::Event
165 {
166 public:
167  DestroyInstancesEvent(agxData::EntityStorage* storage, agxData::EntityRange range);
168 
170  agxData::EntityRange getRange();
171 
172 protected:
173  virtual ~DestroyInstancesEvent();
174 
175 private:
176  agxData::EntityStorage* m_storage;
177  agxData::EntityRange m_range;
178 };
179 
180 class AGXCORE_EXPORT DestroyInstancesEvent2 : public agx::Object::Event
181 {
182 public:
183  DestroyInstancesEvent2(agxData::EntityStorage* storage, agxData::Array< agxData::EntityPtr > instances);
184 
187 
188 protected:
189  virtual ~DestroyInstancesEvent2();
190 
191 private:
192  agxData::EntityStorage* m_storage;
194 };
195 
196 class AGXCORE_EXPORT PermuteEvent : public agx::Object::Event
197 {
198 public:
199  PermuteEvent(agxData::EntityStorage* storage, agxData::Array< agx::Index > permutation);
200 
202  agxData::Array< agx::Index > getPermutation();
203 
204 protected:
205  virtual ~PermuteEvent();
206 
207 private:
208  agxData::EntityStorage* m_storage;
209  agxData::Array< agx::Index > m_permutation;
210 };
211 
212 
214 #endif // GENERATED_AGX_ENTITYSTORAGE_H_DECLARATION
agx::Thread is a representation of an OS specific implementation of a computational thread...
Definition: Thread.h:198
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:72
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:51
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
AGXTERRAIN_EXPORT TimingStorage & getStorage()
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