AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StepEventListener.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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_STEPEVENTLISTENER_H
18 #define AGXSDK_STEPEVENTLISTENER_H
19 
20 #include <agxSDK/agxSDK.h>
21 
22 #include <agxSDK/EventListener.h>
23 #include <agx/TimeStamp.h>
24 
25 namespace agxSDK
26 {
41  {
42  public:
43 
46  STEP_NONE = 0x0,
47  PRE_COLLIDE = 0x1,
48  PRE_STEP = 0x2,
49  POST_STEP = 0x4,
50  LAST_STEP = 0x8,
51  DEFAULT = PRE_STEP | POST_STEP,
52  ALL = PRE_COLLIDE | PRE_STEP | POST_STEP | LAST_STEP
53  };
54 
56  StepEventListener( int mask = DEFAULT );
57 
62  virtual void setMask(int mask) override;
63 
64 
65  // ================ Override these three methods to catch events
71  virtual void preCollide(const agx::TimeStamp& time);
72 
78  virtual void pre(const agx::TimeStamp& time);
79 
85  virtual void post(const agx::TimeStamp& time);
86 
92  virtual void last(const agx::TimeStamp& time);
93 
94 #ifndef SWIG
96 #endif
97 
98  protected:
99 
100 
101  virtual ~StepEventListener();
102  };
103 
104 
105 
106  inline void StepEventListener::preCollide(const agx::TimeStamp& /*time*/) { }
107  inline void StepEventListener::pre(const agx::TimeStamp& /*time*/) { }
108  inline void StepEventListener::post(const agx::TimeStamp& /*time*/) { }
109  inline void StepEventListener::last(const agx::TimeStamp& /*time*/) { }
110 
111 
112 }
113 #endif
Derive from this class to implement a listener for simulation Step events.
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
agx::Real TimeStamp
Definition: TimeStamp.h:26
AGX_DECLARE_VECTOR_TYPES(CollisionGroupFilter)
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:206
An EventListener can be associated to a Simulation and triggered upon various events.
Definition: EventListener.h:37
ActivationMask
Defines the event states for which a listener will be activated, a mask can be bitwise OR:ed from the...
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...
virtual void preCollide(const agx::TimeStamp &time)
Called before collision detection is performed in the simulation Implement this method in the derived...