GCC Code Coverage Report


Directory: ./
File: include/pinocchio/utils/check.hpp
Date: 2024-08-27 18:20:05
Exec Total Coverage
Lines: 7 7 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 //
2 // Copyright (c) 2020 INRIA
3 //
4
5 #ifndef __pinocchio_utils_check_hpp__
6 #define __pinocchio_utils_check_hpp__
7
8 #include <boost/type_traits/is_floating_point.hpp>
9
10 namespace pinocchio
11 {
12
13 template<
14 typename Scalar,
15 bool default_value = true,
16 bool is_real_valued = boost::is_floating_point<Scalar>::value>
17 struct check_expression_if_real_valued
18 {
19 static bool run(const void *)
20 {
21 return default_value;
22 }
23 };
24
25 template<typename Scalar, bool default_value>
26 struct check_expression_if_real_valued<Scalar, default_value, true>
27 {
28 328745 static bool run(const void * expression_ptr)
29 {
30 328745 return *static_cast<const bool *>(expression_ptr);
31 }
32 };
33
34 template<typename Scalar, typename Any>
35 145054 bool check_expression_if_real(const Any & expression)
36 {
37 145054 return check_expression_if_real_valued<Scalar>::run(static_cast<const void *>(&expression));
38 }
39
40 template<typename Scalar, bool default_value, typename Any>
41 86202 bool check_expression_if_real(const Any & expression)
42 {
43 86202 return check_expression_if_real_valued<Scalar, default_value>::run(
44 86202 static_cast<const void *>(&expression));
45 }
46
47 } // namespace pinocchio
48
49 #endif // ifndef __pinocchio_utils_check_hpp__
50