AGX Dynamics 2.42.2.1
Loading...
Searching...
No Matches
EventListener.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agxSDK/agxSDK.h>
20#include <agx/Component.h>
21
23#include <agx/SetVector.h>
24
25namespace agxSDK
26{
27
28 class Simulation;
29
34
40 {
41 public:
42
44 enum Type {
48 GUI_EVENT_LISTENER
49 };
50
55 virtual void setMask(int f);
56
58 int getMask() const;
59
64 void setEnable( bool enable );
65
69 bool isEnabled( ) const;
70
75
79 const Simulation* getSimulation() const;
80
85 virtual void addNotification() {}
86
90 virtual void removeNotification() {}
91
93 Type getType() const;
94
97
98#ifndef SWIG
100#endif
101
102 private:
104 void setPriority( agx::UInt32 priority );
105
106 protected:
111 EventListener( Type type = UNDEFINED_TYPE );
112
113
114 friend class Simulation;
115 friend class EventManager;
116
118 void setSimulation( Simulation* simulation );
119
121 virtual ~EventListener();
122
124
128 private:
129
130 Simulation* m_simulation;
131 };
132
133}
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#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
#define AGXPHYSICS_EXPORT
An EventListener can be associated to a Simulation and triggered upon various events.
Definition: EventListener.h:40
Type
Type of EventListener.
Definition: EventListener.h:44
@ CONTACT_EVENT_LISTENER
Of type ContactEventListener.
Definition: EventListener.h:47
@ UNDEFINED_TYPE
Undefined type.
Definition: EventListener.h:45
@ STEP_EVENT_LISTENER
Of type StepEventListener.
Definition: EventListener.h:46
void setEnable(bool enable)
Specify whether the listener should react at all at events.
virtual void addNotification()
Called when this listener is added to the simulation.
Definition: EventListener.h:85
const Simulation * getSimulation() const
virtual void setMask(int f)
Specifies a bit mask which determines which event types that will activate this listener.
EventListener(Type type=UNDEFINED_TYPE)
Default constructor.
virtual void removeNotification()
Called when this listener is removed from the simulation.
Definition: EventListener.h:90
Simulation * getSimulation()
virtual ~EventListener()
Destructor.
Type getType() const
void setSimulation(Simulation *simulation)
Set the associated simulation for this EventListener.
bool isEnabled() const
agx::UInt32 getPriority() const
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:131
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
A component is an object containing other objects, enabling hierarchical structuring.
Definition: Component.h:39
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: SetVector.h:38
Templated vector class.
Definition: agx/Vector.h:53
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
agx::SetVector< agx::ref_ptr< agxSDK::EventListener > > EventListenerRefSetVector
Definition: EventListener.h:32
agx::Vector< EventListener * > EventListenerPtrVector
Definition: EventListener.h:31
agx::Vector< agx::ref_ptr< agxSDK::EventListener > > EventListenerRefVector
Definition: EventListener.h:33
uint32_t UInt32
Definition: Integer.h:32