GCC Code Coverage Report


Directory: ./
File: python/octree.cc
Date: 2025-04-01 09:23:31
Exec Total Coverage
Lines: 21 29 72.4%
Branches: 28 62 45.2%

Line Branch Exec Source
1
2 #include "coal.hh"
3
4 #include <eigenpy/std-vector.hpp>
5
6 #include "coal/fwd.hh"
7 #include "coal/octree.h"
8
9 #ifdef COAL_HAS_DOXYGEN_AUTODOC
10 #include "doxygen_autodoc/functions.h"
11 #include "doxygen_autodoc/coal/octree.h"
12 #endif
13
14 bp::object toPyBytes(std::vector<uint8_t>& bytes) {
15 #if PY_MAJOR_VERSION == 2
16 PyObject* py_buf =
17 PyBuffer_FromMemory((char*)bytes.data(), Py_ssize_t(bytes.size()));
18 return bp::object(bp::handle<>(py_buf));
19 #else
20 PyObject* py_buf = PyMemoryView_FromMemory(
21 (char*)bytes.data(), Py_ssize_t(bytes.size()), PyBUF_READ);
22 return bp::object(bp::handle<>(PyBytes_FromObject(py_buf)));
23 #endif
24 }
25
26 bp::object tobytes(const coal::OcTree& self) {
27 std::vector<uint8_t> bytes = self.tobytes();
28 return toPyBytes(bytes);
29 }
30
31 5 void exposeOctree() {
32 using namespace coal;
33 namespace bp = boost::python;
34 namespace dv = doxygen::visitor;
35
36 5 bp::class_<OcTree, bp::bases<CollisionGeometry>, shared_ptr<OcTree> >(
37 "OcTree", doxygen::class_doc<OcTree>(), bp::no_init)
38
1/2
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 .def(dv::init<OcTree, Scalar>())
39
1/2
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 .def("clone", &OcTree::clone, doxygen::member_func_doc(&OcTree::clone),
40 bp::return_value_policy<bp::manage_new_object>())
41
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
5 .def(dv::member_func("getTreeDepth", &OcTree::getTreeDepth))
42
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
5 .def(dv::member_func("size", &OcTree::size))
43
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
5 .def(dv::member_func("getResolution", &OcTree::getResolution))
44
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
5 .def(dv::member_func("getOccupancyThres", &OcTree::getOccupancyThres))
45
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
5 .def(dv::member_func("getFreeThres", &OcTree::getFreeThres))
46
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
5 .def(dv::member_func("getDefaultOccupancy", &OcTree::getDefaultOccupancy))
47
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 .def(dv::member_func("setCellDefaultOccupancy",
48
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 &OcTree::setCellDefaultOccupancy))
49
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
5 .def(dv::member_func("setOccupancyThres", &OcTree::setOccupancyThres))
50
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
5 .def(dv::member_func("setFreeThres", &OcTree::setFreeThres))
51
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
5 .def(dv::member_func("getRootBV", &OcTree::getRootBV))
52
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
5 .def(dv::member_func("toBoxes", &OcTree::toBoxes))
53
1/2
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 .def("tobytes", tobytes, doxygen::member_func_doc(&OcTree::tobytes));
54
55 5 doxygen::def("makeOctree", &makeOctree);
56 5 eigenpy::enableEigenPySpecific<Vec6s>();
57
3/6
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 5 times.
✗ Branch 10 not taken.
5 eigenpy::StdVectorPythonVisitor<std::vector<Vec6s>, true>::expose(
58 "StdVec_Vec6");
59 5 }
60