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 |
|
|
#ifndef HPP_PINOCCHIO_SRC_SIZE_VISITOR_HH |
30 |
|
|
#define HPP_PINOCCHIO_SRC_SIZE_VISITOR_HH |
31 |
|
|
|
32 |
|
|
namespace hpp { |
33 |
|
|
namespace pinocchio { |
34 |
|
|
namespace liegroupType { |
35 |
|
|
|
36 |
|
|
/// Visitor to compute size of LiegroupType |
37 |
|
|
struct SizeVisitor : public boost::static_visitor<> { |
38 |
|
7327 |
inline SizeVisitor() : nq(-1), nv(-1) {} |
39 |
|
|
template <typename LiegroupType> |
40 |
|
16558 |
void operator()(LiegroupType& op) { |
41 |
|
16558 |
nq = op.nq(); |
42 |
|
16558 |
nv = op.nv(); |
43 |
|
|
} |
44 |
|
|
size_type nq, nv; |
45 |
|
|
}; // struct SizeVisitor |
46 |
|
|
|
47 |
|
|
/// Visitor to compute neutral element of LiegroupType |
48 |
|
|
struct NeutralVisitor : public boost::static_visitor<> { |
49 |
|
|
template <typename LiegroupType> |
50 |
|
8778 |
void operator()(LiegroupType& op) { |
51 |
1/2
✓ Branch 2 taken 3416 times.
✗ Branch 3 not taken.
|
8778 |
neutral = op.neutral(); |
52 |
|
|
} |
53 |
|
|
vector_t neutral; |
54 |
|
|
}; // struct NeutralVisitor |
55 |
|
|
|
56 |
|
|
/// Visitor to check if a LiegroupType is a vector space |
57 |
|
|
struct IsVectorSpace : public boost::static_visitor<> { |
58 |
|
2283 |
IsVectorSpace() : isVectorSpace(false) {} |
59 |
|
|
template <typename LiegroupType> |
60 |
|
2002 |
void operator()(const LiegroupType&) { |
61 |
|
2002 |
isVectorSpace = false; |
62 |
|
|
} |
63 |
|
|
template <int Size, bool rot> |
64 |
|
6460 |
void operator()(const liegroup::VectorSpaceOperation<Size, rot>&) { |
65 |
|
6460 |
isVectorSpace = true; |
66 |
|
|
} |
67 |
|
|
bool isVectorSpace; |
68 |
|
|
}; // struct SizeVisitor |
69 |
|
|
|
70 |
|
|
} // namespace liegroupType |
71 |
|
|
} // namespace pinocchio |
72 |
|
|
} // namespace hpp |
73 |
|
|
|
74 |
|
|
#endif // HPP_PINOCCHIO_SRC_SIZE_VISITOR_HH |
75 |
|
|
|