GCC Code Coverage Report


Directory: ./
File: include/pinocchio/bindings/python/utils/constant.hpp
Date: 2025-02-12 21:03:38
Exec Total Coverage
Lines: 3 3 100.0%
Branches: 2 4 50.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2018 CNRS
3 //
4
5 #ifndef __pinocchio_python_utils_constant_hpp__
6 #define __pinocchio_python_utils_constant_hpp__
7
8 #include <boost/python/scope.hpp>
9
10 namespace boost
11 {
12 namespace python
13 {
14
15 ///
16 /// \brief Define a constant given its value and a name within the current Boost Python scope.
17 ///
18 /// \tparam T Type of the constant.
19 ///
20 /// \param[in] name Name of the constant.
21 /// \param[in] value Value of the constant.
22 ///
23 template<typename T>
24 207 void def_constant(const char * name, const T & value)
25 {
26 namespace bp = boost::python;
27
2/4
✓ Branch 2 taken 207 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 207 times.
✗ Branch 6 not taken.
207 bp::scope().attr(name) = value;
28 207 }
29
30 } // namespace python
31 } // namespace boost
32
33 #endif // ifndef __pinocchio_python_utils_constant_hpp__
34