GCC Code Coverage Report


Directory: ./
File: src/comparison.hxx
Date: 2025-05-04 12:09:19
Exec Total Coverage
Lines: 19 19 100.0%
Branches: 1 2 50.0%

Line Branch Exec Source
1 // Copyright (c) 2017, CNRS
2 // Authors: Florent Lamiraux
3 //
4
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // 1. Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27 // DAMAGE.
28
29 namespace hpp {
30 namespace pinocchio {
31 namespace liegroup {
32
33 namespace level1 {
34 436 IsEqualVisitor::IsEqualVisitor(const LiegroupType& lg2) : lg2_(lg2) {}
35
36 template <typename LgT1>
37 872 bool IsEqualVisitor::operator()(const LgT1& lg1) {
38 hppDout(info, "level1::isEqual::operator ()");
39 872 return isEqual(lg1, lg2_);
40 }
41
42 template <typename LgT1>
43 872 bool isEqual(const LgT1& lgt1, const LiegroupType& lgt2) {
44 hppDout(info, "level1::isEqual");
45 872 level2::IsEqualVisitor<LgT1> visitor(lgt1);
46
1/2
✓ Branch 1 taken 436 times.
✗ Branch 2 not taken.
1744 return boost::apply_visitor(visitor, lgt2);
47 }
48 } // namespace level1
49
50 namespace level2 {
51
52 template <typename LgT1>
53 872 IsEqualVisitor<LgT1>::IsEqualVisitor(const LgT1& lg1) : lg1_(lg1) {}
54
55 template <typename LgT1>
56 template <typename LgT2>
57 872 bool IsEqualVisitor<LgT1>::operator()(const LgT2& lg2) {
58 hppDout(info, "level2::isEqual::operator ()");
59 Comparison<LgT1, LgT2> comp;
60 872 return comp(lg1_, lg2);
61 }
62 } // namespace level2
63
64 // Specialization for vector spaces
65 template <bool rot>
66 204 bool Comparison<VectorSpaceOperation<Eigen::Dynamic, rot>,
67 VectorSpaceOperation<Eigen::Dynamic, rot> >::
68 operator()(const VectorSpaceOperation<Eigen::Dynamic, rot>& lgt1,
69 const VectorSpaceOperation<Eigen::Dynamic, rot>& lgt2) {
70 hppDout(info, "Comparison::operator () for vector spaces");
71 204 return (lgt1.nq() == lgt2.nq());
72 }
73
74 template <int Size, bool rot>
75 8 bool Comparison<VectorSpaceOperation<Eigen::Dynamic, rot>,
76 VectorSpaceOperation<Size, rot> >::
77 operator()(const VectorSpaceOperation<Eigen::Dynamic, rot>& lgt1,
78 const VectorSpaceOperation<Size, rot>& lgt2) {
79 hppDout(info, "Comparison::operator () for vector spaces");
80 8 return (lgt1.nq() == lgt2.nq());
81 }
82
83 template <int Size, bool rot>
84 2 bool Comparison<VectorSpaceOperation<Size, rot>,
85 VectorSpaceOperation<Eigen::Dynamic, rot> >::
86 operator()(const VectorSpaceOperation<Size, rot>& lgt1,
87 const VectorSpaceOperation<Eigen::Dynamic, rot>& lgt2) {
88 hppDout(info, "Comparison::operator () for vector spaces");
89 2 return (lgt1.nq() == lgt2.nq());
90 }
91
92 // Specialization for same types
93 template <typename LgT>
94 434 bool Comparison<LgT, LgT>::operator()(const LgT&, const LgT&) {
95 hppDout(info, "Comparison::operator () for same types");
96 434 return true;
97 }
98
99 template <typename LgT1, typename LgT2>
100 10 bool Comparison<LgT1, LgT2>::operator()(const LgT1&, const LgT2&) {
101 hppDout(info, "Default Comparison::operator ()");
102 10 return false;
103 }
104
105 } // namespace liegroup
106 } // namespace pinocchio
107 } // namespace hpp
108