GCC Code Coverage Report


Directory: ./
File: include/pinocchio/bindings/python/collision/geometry-functors.hpp
Date: 2024-08-27 18:20:05
Exec Total Coverage
Lines: 10 14 71.4%
Branches: 12 24 50.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2021 INRIA
3 //
4
5 #ifndef __pinocchio_python_collision_geometry_functors_hpp__
6 #define __pinocchio_python_collision_geometry_functors_hpp__
7
8 #include "pinocchio/bindings/python/utils/registration.hpp"
9
10 #include "pinocchio/multibody/geometry.hpp"
11
12 namespace pinocchio
13 {
14 namespace python
15 {
16 namespace bp = boost::python;
17
18 template<typename GeometryFunctor>
19 struct GeometryFunctorPythonVisitor
20 : public boost::python::def_visitor<GeometryFunctorPythonVisitor<GeometryFunctor>>
21 {
22
23 template<class PyClass>
24 80 void visit(PyClass & cl) const
25 {
26
2/4
✓ Branch 3 taken 40 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 40 times.
✗ Branch 7 not taken.
80 const std::string class_name = bp::type_id<GeometryFunctor>().name();
27
28
4/8
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 40 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 40 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 40 times.
✗ Branch 12 not taken.
160 cl.def(bp::init<const GeometryObject &, const GeometryObject &>(
29 bp::args("self", "geometry_object1", "geometry_object2"),
30
1/2
✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
160 (std::string("Constructor of a ") + class_name).c_str()))
31
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
160 .def(
32 "run", &GeometryFunctor::run, bp::args("self", "tf1", "tf2", "request", "result"),
33 "Call the function and return the result")
34
35
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
80 .def(
36 "getGeometryObject1", &GeometryFunctor::getGeometryObject1,
37 bp::return_value_policy<bp::copy_const_reference>())
38
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
80 .def(
39 "getGeometryObject2", &GeometryFunctor::getGeometryObject2,
40 80 bp::return_value_policy<bp::copy_const_reference>())
41
42
2/4
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 40 times.
✗ Branch 5 not taken.
80 .def("print", &print);
43 80 }
44
45 static void print(const GeometryFunctor & self)
46 {
47 std::cout << "address #1: " << &self.getGeometryObject1() << std::endl;
48 std::cout << "address #2: " << &self.getGeometryObject2() << std::endl;
49 }
50 };
51
52 } // namespace python
53 } // namespace pinocchio
54
55 #endif // ifndef __pinocchio_python_collision_geometry_functors_hpp__
56