AGX Dynamics  2.37.3.2
StepEventListener.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 #pragma once
18 
19 #include <agxSDK/agxSDK.h>
20 
21 #include <agxSDK/EventListener.h>
22 #include <agx/TimeStamp.h>
23 
24 namespace agxSDK
25 {
38  {
39  public:
40 
43  STEP_NONE = 0x0,
44  PRE_COLLIDE = 0x1,
45  PRE_STEP = 0x2,
46  POST_STEP = 0x4,
47  LAST_STEP = 0x8,
48  DEFAULT = PRE_STEP | POST_STEP,
49  ALL = PRE_COLLIDE | PRE_STEP | POST_STEP | LAST_STEP
50  };
51 
53  StepEventListener( int mask = DEFAULT );
54 
59  virtual void setMask(int mask) override;
60 
61 
62  // ================ Override these three methods to catch events
68  virtual void preCollide(const agx::TimeStamp& time);
69 
75  virtual void pre(const agx::TimeStamp& time);
76 
82  virtual void post(const agx::TimeStamp& time);
83 
90  virtual void last(const agx::TimeStamp& time);
91 
92 #ifndef SWIG
94 #endif
95 
96  protected:
97 
98 
100  virtual ~StepEventListener();
101  };
102 
103 
104 
105  inline void StepEventListener::preCollide(const agx::TimeStamp& /*time*/) { }
106  inline void StepEventListener::pre(const agx::TimeStamp& /*time*/) { }
107  inline void StepEventListener::post(const agx::TimeStamp& /*time*/) { }
108  inline void StepEventListener::last(const agx::TimeStamp& /*time*/) { }
109 
110 
111 }
Derive from this class to implement a listener for simulation step events.
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
agx::Real TimeStamp
Definition: TimeStamp.h:26
virtual void last(const agx::TimeStamp &time)
Called after a step is taken in the simulation Implement this method in the derived class to get call...
virtual void post(const agx::TimeStamp &time)
Called after a step is taken in the simulation Implement this method in the derived class to get call...
#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
An EventListener can be associated to a Simulation and triggered upon various events.
Definition: EventListener.h:40
ActivationMask
Defines the event states for which a listener will be activated, a mask can be bitwise OR:ed from the...
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
virtual void pre(const agx::TimeStamp &time)
Called before a step is taken in the simulation Implement this method in the derived class to get cal...
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
virtual void preCollide(const agx::TimeStamp &time)
Called before collision detection is performed in the simulation Implement this method in the derived...