TVM  0.9.4
TaskDynamics.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017-2020 CNRS-AIST JRL and CNRS-UM LIRMM
3  */
4 
5 #pragma once
6 
7 #include <tvm/defs.h>
8 
12 
13 #include <Eigen/Core>
14 
15 // FIXME add mechanisms for when the function's output is resized
16 // FIXME Consider the possibility of having variables in task dynamics?
17 
18 namespace tvm
19 {
20 
21 namespace task_dynamics
22 {
23 
24 namespace abstract
25 {
37 {
38 public:
39  virtual ~TaskDynamics() = default;
40 
41  std::unique_ptr<TaskDynamicsImpl> impl(FunctionPtr f, constraint::Type t, const Eigen::VectorXd & rhs) const;
42 
43  Order order() const;
44 
45 protected:
46  virtual std::unique_ptr<TaskDynamicsImpl> impl_(FunctionPtr f,
48  const Eigen::VectorXd & rhs) const = 0;
49  virtual Order order_() const = 0;
50 };
51 
52 } // namespace abstract
53 
54 } // namespace task_dynamics
55 
56 } // namespace tvm
57 
62 #define TASK_DYNAMICS_DERIVED_FACTORY(...) \
63  template<typename Derived, typename... Args> \
64  std::unique_ptr<tvm::task_dynamics::abstract::TaskDynamicsImpl> impl_( \
65  tvm::FunctionPtr f, tvm::constraint::Type t, const Eigen::VectorXd & rhs, Args &&... args) const \
66  { return std::make_unique<Derived>(f, t, rhs, std::forward<Args>(args)..., __VA_ARGS__); }
67 
71 #define TASK_DYNAMICS_DERIVED_FACTORY_Z() \
72  template<typename Derived, typename... Args> \
73  std::unique_ptr<tvm::task_dynamics::abstract::TaskDynamicsImpl> impl_( \
74  tvm::FunctionPtr f, tvm::constraint::Type t, const Eigen::VectorXd & rhs, Args &&... args) const \
75  { return std::make_unique<Derived>(f, t, rhs, std::forward<Args>(args)...); }
76 
82 #define COMPOSABLE_TASK_DYNAMICS_DERIVED_FACTORY(T, ...) \
83  template<typename Derived, typename... Args> \
84  std::unique_ptr<tvm::task_dynamics::abstract::TaskDynamicsImpl> impl_( \
85  tvm::FunctionPtr f, tvm::constraint::Type t, const Eigen::VectorXd & rhs, Args &&... args) const \
86  { return T::template impl_<Derived>(f, t, rhs, std::forward<Args>(args)..., __VA_ARGS__); }
#define TVM_DLLAPI
Definition: api.h:35
Definition: TaskDynamics.h:37
virtual std::unique_ptr< TaskDynamicsImpl > impl_(FunctionPtr f, constraint::Type t, const Eigen::VectorXd &rhs) const =0
std::unique_ptr< TaskDynamicsImpl > impl(FunctionPtr f, constraint::Type t, const Eigen::VectorXd &rhs) const
Type
Definition: enums.h:15
Order
Definition: enums.h:14
Definition: Clock.h:12
std::shared_ptr< function::abstract::Function > FunctionPtr
Definition: defs.h:57