AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
CallbackWrappers.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. 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
9having been advised so by Algoryx Simulation AB for a time limited evaluation,
10or having purchased a valid 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 <agx/config/AGX_USE_WEBSOCKETS.h>
20
21// The callback wrappers are tightly coupled to the agxSDK::SimulationController,
22// and that class doesn't exist when we're building without web sockets.
23#if AGX_USE_WEBSOCKETS()
24
25#include <agx/Real.h>
26#include <agx/Callback.h>
27
28namespace agxSDK
29{
30 class SimulationController;
31
43 class AGXPHYSICS_EXPORT CallbackWrapperBase : public agx::Referenced
44 {
45 public:
46 CallbackWrapperBase();
47 protected:
48 virtual ~CallbackWrapperBase() {}
49 friend class SimulationController;
50 void setSimulationController( SimulationController* controller );
51 SimulationController* m_controller;
52 };
53
54
55 class AGXPHYSICS_EXPORT CallbackWrapper : public CallbackWrapperBase
56 {
57 public:
58 CallbackWrapper();
59 virtual void callback( SimulationController* /*application*/) {}
60 agx::Callback* getCallback();
61 protected:
62 virtual ~CallbackWrapper() {}
63
64 private:
65 // The method called by 'm_callback'. Calls the virtual 'callback' method.
66 void bridge();
67
69 agx::Callback m_callback;
70 };
71
72
73 class AGXPHYSICS_EXPORT CallbackWrapper_Real : public CallbackWrapperBase
74 {
75 public:
76 CallbackWrapper_Real();
77 virtual void callback( SimulationController* /*application*/, agx::Real /*value*/) {}
78 agx::Callback1<agx::Real>* getCallback();
79
80 protected:
81 virtual ~CallbackWrapper_Real() {}
82
83 private:
84 // The method called by 'm_callback'. Calls the virtual 'callback' method.
85 void bridge(agx::Real value);
86
89 };
90
91 class AGXPHYSICS_EXPORT CallbackWrapper_Bool : public CallbackWrapperBase
92 {
93 public:
94 CallbackWrapper_Bool();
95 virtual void callback( SimulationController* /*application*/, bool /*value*/) {}
96 agx::Callback1<bool>* getCallback();
97 protected:
98 virtual ~CallbackWrapper_Bool() {}
99
100 private:
101 // The method called by 'm_callback'. Calls the virtual 'callback' method.
102 void bridge(bool value);
103
105 agx::Callback1<bool> m_callback;
106 };
107
108 class AGXPHYSICS_EXPORT CallbackWrapper_String : public CallbackWrapperBase
109 {
110 public:
111 CallbackWrapper_String();
112 virtual void callback( SimulationController* /*application*/, agx::String /*value*/) {}
113 agx::Callback1<agx::String>* getCallback();
114 protected:
115 virtual ~CallbackWrapper_String() {}
116
117 private:
118 // The method called by 'm_callback'. Calls the virtual 'callback' method.
119 void bridge(agx::String value);
120
123 };
124}
125
126#endif // AGX_USE_WEBSOCKETS()
#define AGXPHYSICS_EXPORT
Templated callback with one argument.
Definition Callback.h:101
Generalized callback, using std::function.
Definition Callback.h:54
Base class providing referencing counted objects.
Definition Referenced.h:120
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition Constraint.h:31
double Real
Definition Real.h:42