ConstraintSet.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2022 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
7 #include <mc_solver/QPSolver.h>
8 
9 #include <memory>
10 
11 namespace mc_solver
12 {
13 
21 {
23  ConstraintSet();
24 
26  void addToSolver(mc_solver::QPSolver & solver);
27 
34  virtual void update(QPSolver &) {}
35 
37  void removeFromSolver(mc_solver::QPSolver & solver);
38 
40  virtual ~ConstraintSet() {}
41 
42  inline bool inSolver() const noexcept { return inSolver_; }
43 
44  inline QPSolver::Backend backend() const noexcept { return backend_; }
45 
46 protected:
48  virtual void addToSolverImpl(mc_solver::QPSolver & solver) = 0;
49 
51  virtual void removeFromSolverImpl(mc_solver::QPSolver & solver) = 0;
52 
55 
57  bool inSolver_ = false;
58 
59 private:
60  // Forbid copy of ConstraintSet objects
61  ConstraintSet(const ConstraintSet &) = delete;
62  ConstraintSet & operator=(const ConstraintSet &) = delete;
63  // Move is ok
64  ConstraintSet(ConstraintSet &&) = default;
65  ConstraintSet & operator=(ConstraintSet &&) = default;
66 };
67 
68 using ConstraintSetPtr = std::shared_ptr<ConstraintSet>;
69 
70 } // namespace mc_solver
mc_solver::QPSolver
Definition: QPSolver.h:85
mc_solver::ConstraintSet::backend
QPSolver::Backend backend() const noexcept
Definition: ConstraintSet.h:44
mc_solver::ConstraintSet
This class is a basis to wrap Constraint functions from Tasks. The aim of such wrappers should be two...
Definition: ConstraintSet.h:20
mc_solver::ConstraintSet::~ConstraintSet
virtual ~ConstraintSet()
Definition: ConstraintSet.h:40
mc_solver::QPSolver::Backend
Backend
Definition: QPSolver.h:90
mc_solver::ConstraintSetPtr
std::shared_ptr< ConstraintSet > ConstraintSetPtr
Definition: ConstraintSet.h:68
mc_solver::ConstraintSet::backend_
QPSolver::Backend backend_
Definition: ConstraintSet.h:54
mc_solver
Definition: Contact.h:17
mc_solver::ConstraintSet::update
virtual void update(QPSolver &)
Update the constraint.
Definition: ConstraintSet.h:34
MC_SOLVER_DLLAPI
#define MC_SOLVER_DLLAPI
Definition: api.h:50
QPSolver.h
mc_solver::ConstraintSet::inSolver
bool inSolver() const noexcept
Definition: ConstraintSet.h:42