AGX Dynamics  2.37.2.0
InterpolatingOperation.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 
19 
20 
21 #ifndef AGXCONTROL_INTERPOLATING_OPERATION_H
22 #define AGXCONTROL_INTERPOLATING_OPERATION_H
23 
24 #include <agx/config.h>
25 
27 #include <agxControl/Operation.h>
29 
30 namespace agxControl
31 {
32 
33 
34  class AGXPHYSICS_EXPORT InterpolatingOperation : public agxControl::Operation, public agxControl::ActionImplementationVisitor
35  {
36  public:
37  InterpolatingOperation(agxControl::Action* begin, agxControl::Action* end, InterpolationController* controller);
38 
39  virtual void activate(agx::Real time) override;
40  virtual void update(agx::Real time) override;
41  virtual void deactivate(agx::Real time) override;
42 
43 
44  AGXSTREAM_DECLARE_SERIALIZABLE(agxControl::InterpolatingOperation);
46  InterpolatingOperation() {};
47 
48  public:
49 
50  /*
51  Single dispatch visitor pattern. Is this ever used? When will we need to visit
52  only a single action?
53  */
54  void update(agxControl::ActionImplementation* action, agx::Real time) override;
55  void update(agxControl::CallbackActionImplementation* action, agx::Real time) override;
56  void update(agxControl::Callback1ActionImplementation<agx::Real>* action, agx::Real time) override;
57  void update(agxControl::CallbackR1ActionImplementation<void, agx::Real>* action, agx::Real time) override;
58  void update(agxControl::Callback2ActionImplementation<agx::Real, agx::Int>* action, agx::Real time) override;
59 
60 
61  /*
62  Dual dispatch visitor pattern. The Operation contains two Actions and we want
63  to run one of the update methods below. This is achieved by calling the virtual
64  visit(Visitor*, ActionImplementation*, .) method on the begin ActionImplementation,
65  which in turn will call the virtual dispatchVisit(Visitor*, <something>Implementation<something>*, .)
66  on the received ActionImplementation. Implementations for all supported variants
67  of the virtual dispatchVisit method is given in the base ActionImplementation,
68  but they all Throw exception. Implementation in the derived classes are given
69  for the methods that take a derivative of ActionImplementation being the same
70  type as the class providing the implementation. That implementation calls one
71  of the update methods below.
72  */
73  void update(agxControl::ActionImplementation* begin, agxControl::ActionImplementation* end, agx::Real time) override;
74  void update(agxControl::CallbackActionImplementation* begin, agxControl::CallbackActionImplementation* end, agx::Real time) override;
75  void update(agxControl::Callback1ActionImplementation<agx::Real>* begin, agxControl::Callback1ActionImplementation<agx::Real>* end, agx::Real time) override;
76  void update(agxControl::CallbackR1ActionImplementation<void, agx::Real>* begin, agxControl::CallbackR1ActionImplementation<void, agx::Real>* end, agx::Real time) override;
77  void update(agxControl::Callback2ActionImplementation<agx::Real, agx::Int>* begin, agxControl::Callback2ActionImplementation<agx::Real, agx::Int>* end, agx::Real time) override;
78 
79 
80  protected:
81  virtual ~InterpolatingOperation() {}
82  private:
83  agxControl::InterpolationControllerRef m_controller;
84  };
85 
86 }
87 
88 // Include guard.
89 #endif
90 
#define AGXPHYSICS_EXPORT
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
This namespace contains general operation and action classes which can be used to control a agxSDK::S...
#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
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
double Real
Definition: Real.h:42