utils/check.hpp
Go to the documentation of this file.
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>
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  static bool run(const void * expression_ptr)
29  {
30  return *static_cast<const bool *>(expression_ptr);
31  }
32  };
33 
34  template<typename Scalar, typename Any>
35  bool check_expression_if_real(const Any & expression)
36  {
37  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  bool check_expression_if_real(const Any & expression)
42  {
44  static_cast<const void *>(&expression));
45  }
46 
47 } // namespace pinocchio
48 
49 #endif // ifndef __pinocchio_utils_check_hpp__
pinocchio::python::Scalar
context::Scalar Scalar
Definition: admm-solver.cpp:29
pinocchio::check_expression_if_real_valued::run
static bool run(const void *)
Definition: utils/check.hpp:19
pinocchio::check_expression_if_real_valued< Scalar, default_value, true >::run
static bool run(const void *expression_ptr)
Definition: utils/check.hpp:28
pinocchio::check_expression_if_real_valued
Definition: utils/check.hpp:17
pinocchio::check_expression_if_real
bool check_expression_if_real(const Any &expression)
Definition: utils/check.hpp:35
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:26