GCC Code Coverage Report


Directory: ./
File: include/hpp/manipulation/steering-method/graph.hh
Date: 2025-03-07 11:10:46
Exec Total Coverage
Lines: 7 15 46.7%
Branches: 0 4 0.0%

Line Branch Exec Source
1 // Copyright (c) 2014, LAAS-CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
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_MANIPULATION_STEERING_METHOD_GRAPH_HH
30 #define HPP_MANIPULATION_STEERING_METHOD_GRAPH_HH
31
32 #include <hpp/core/problem-solver.hh> // SteeringMethodBuilder_t
33 #include <hpp/core/steering-method.hh>
34 #include <hpp/manipulation/config.hh>
35 #include <hpp/manipulation/fwd.hh>
36 #include <hpp/manipulation/graph/fwd.hh>
37 #include <hpp/manipulation/steering-method/fwd.hh>
38
39 namespace hpp {
40 namespace manipulation {
41 /// \addtogroup steering_method
42 /// \{
43 class HPP_MANIPULATION_DLLAPI SteeringMethod : public core::SteeringMethod {
44 public:
45 8 const core::SteeringMethodPtr_t& innerSteeringMethod() const {
46 8 return steeringMethod_;
47 }
48
49 void innerSteeringMethod(const core::SteeringMethodPtr_t& sm) {
50 steeringMethod_ = sm;
51 }
52
53 protected:
54 /// Constructor
55 SteeringMethod(const ProblemConstPtr_t& problem);
56
57 /// Copy constructor
58 SteeringMethod(const SteeringMethod& other);
59
60 4 void init(SteeringMethodWkPtr_t weak) { core::SteeringMethod::init(weak); }
61
62 /// A pointer to the manipulation problem
63 ProblemConstPtr_t problem_;
64 /// The encapsulated steering method
65 core::SteeringMethodPtr_t steeringMethod_;
66 };
67
68 namespace steeringMethod {
69 using core::PathPtr_t;
70
71 class HPP_MANIPULATION_DLLAPI Graph : public SteeringMethod {
72 typedef core::SteeringMethodBuilder_t SteeringMethodBuilder_t;
73
74 public:
75 /// Create instance and return shared pointer
76 /// \warning core::Problem will be casted to Problem
77 static GraphPtr_t create(const core::ProblemConstPtr_t& problem);
78
79 template <typename T>
80 static GraphPtr_t create(const core::ProblemConstPtr_t& problem);
81
82 /// Create copy and return shared pointer
83 static GraphPtr_t createCopy(const GraphPtr_t& other);
84
85 /// Copy instance and return shared pointer
86 virtual core::SteeringMethodPtr_t copy() const {
87 return createCopy(weak_.lock());
88 }
89
90 protected:
91 /// Constructor
92 Graph(const ProblemConstPtr_t& problem);
93
94 /// Copy constructor
95 Graph(const Graph&);
96
97 virtual PathPtr_t impl_compute(ConfigurationIn_t q1,
98 ConfigurationIn_t q2) const;
99
100 4 void init(GraphWkPtr_t weak) {
101 4 SteeringMethod::init(weak);
102 4 weak_ = weak;
103 4 }
104
105 private:
106 /// Weak pointer to itself
107 GraphWkPtr_t weak_;
108 };
109
110 template <typename T>
111 GraphPtr_t Graph::create(const core::ProblemConstPtr_t& problem) {
112 GraphPtr_t gsm = Graph::create(problem);
113 gsm->innerSteeringMethod(T::create(problem));
114 return gsm;
115 }
116 } // namespace steeringMethod
117 /// \}
118 } // namespace manipulation
119 } // namespace hpp
120
121 #endif // HPP_MANIPULATION_STEERING_METHOD_GRAPH_HH
122