GCC Code Coverage Report


Directory: ./
File: include/tsid/bindings/python/solvers/HQPOutput.hpp
Date: 2024-08-26 20:29:39
Exec Total Coverage
Lines: 13 13 100.0%
Branches: 9 18 50.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2018 CNRS
3 //
4 // This file is part of tsid
5 // tsid is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 // tsid is distributed in the hope that it will be
10 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Lesser Public License for more details. You should have
13 // received a copy of the GNU Lesser General Public License along with
14 // tsid If not, see
15 // <http://www.gnu.org/licenses/>.
16 //
17
18 #ifndef __tsid_python_HQPOutput_hpp__
19 #define __tsid_python_HQPOutput_hpp__
20
21 #include "tsid/bindings/python/fwd.hpp"
22
23 #include "tsid/solvers/solver-HQP-output.hpp"
24
25 namespace tsid {
26 namespace python {
27 namespace bp = boost::python;
28
29 template <typename T>
30 struct HQPOutputPythonVisitor
31 : public boost::python::def_visitor<HQPOutputPythonVisitor<T> > {
32 template <class PyClass>
33
34 7 void visit(PyClass& cl) const {
35
1/2
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
7 cl.def(bp::init<>("Default Constructor"))
36
3/6
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 7 times.
✗ Branch 8 not taken.
14 .def(bp::init<int, int, int>((bp::args("nVars", "nEq", "nInCon"))))
37
1/2
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
7 .add_property("x", &HQPOutputPythonVisitor::x)
38
1/2
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
7 .add_property("status", &HQPOutputPythonVisitor::status);
39 7 }
40 300 static Eigen::VectorXd x(const T& self) { return self.x; }
41 100 static int status(const T& self) { return self.status; }
42 7 static void expose(const std::string& class_name) {
43
1/2
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
7 std::string doc = "HQPOutput info.";
44
1/2
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
7 bp::class_<T>(class_name.c_str(), doc.c_str(), bp::no_init)
45
1/2
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
7 .def(HQPOutputPythonVisitor<T>());
46 7 }
47 };
48 } // namespace python
49 } // namespace tsid
50
51 #endif // ifndef __tsid_python_HQPOutput_hpp__
52