AGX Dynamics  2.37.3.2
EventListener.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 having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 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 #ifndef AGXSDK_EVENTLISTENER_H
18 #define AGXSDK_EVENTLISTENER_H
19 
20 #include <agxSDK/agxSDK.h>
21 #include <agx/Component.h>
22 
23 #include <agxStream/Serializable.h>
24 #include <agx/SetVector.h>
25 
26 namespace agxSDK
27 {
28 
29  class Simulation;
30 
34 
35 
41  {
42  public:
43 
45  enum Type {
49  GUI_EVENT_LISTENER
50  };
51 
56  virtual void setMask(int f);
57 
59  int getMask() const;
60 
65  void setEnable( bool enable );
66 
70  bool isEnabled( ) const;
71 
75  Simulation* getSimulation();
76 
80  const Simulation* getSimulation() const;
81 
86  virtual void addNotification() {}
87 
91  virtual void removeNotification() {}
92 
94  Type getType() const;
95 
97  agx::UInt32 getPriority() const;
98 
99 #ifndef SWIG
101 #endif
102 
103  private:
105  void setPriority( agx::UInt32 priority );
106 
107  protected:
112  EventListener( Type type = UNDEFINED_TYPE );
113 
114 
115  friend class Simulation;
116  friend class EventManager;
117 
119  void setSimulation( Simulation* simulation );
120 
122  virtual ~EventListener();
123 
125 
126  int m_mask;
127  bool m_enabled;
129  private:
130 
131  Simulation* m_simulation;
132  };
133 
134 }
135 
136 #endif
AGXCORE_EXPORT Type * getType(const agx::String &name)
Type
Type of EventListener.
Definition: EventListener.h:45
A component is an object containing other objects, enabling hierarchical structuring.
Definition: Component.h:38
virtual void removeNotification()
Called when this listener is removed from the simulation.
Definition: EventListener.h:91
#define AGXPHYSICS_EXPORT
agx::SetVector< agx::ref_ptr< agxSDK::EventListener > > EventListenerRefSetVector
Definition: EventListener.h:33
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
virtual void addNotification()
Called when this listener is added to the simulation.
Definition: EventListener.h:86
Templated vector class.
Definition: Vector.h:52
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
An EventListener can be associated to a Simulation and triggered upon various events.
Definition: EventListener.h:40
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126
Of type ContactEventListener.
Definition: EventListener.h:48
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
agx::Vector< EventListener * > EventListenerPtrVector
Definition: EventListener.h:32
uint32_t UInt32
Definition: Integer.h:40
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: SetVector.h:37