Skip to content

Commit 8ac2968

Browse files
committed
accept const-refs in liftModifiedSolution
clang-tidy rightfully complained that moving rvalues doesn't make sense when the underlying method accepts const refs. The rvalue parameter interface, as it is used with spawn/etc. indicates that the solution is submitted to the system. But with the shared_ptr interface we need for `liftModifiedSolution` it does not make any sense, especially because we can't even move the passed pointer to the internal datastructures but have to copy...
1 parent 525080d commit 8ac2968

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

core/include/moveit/task_constructor/container.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ class ParallelContainerBase : public ContainerBase
128128
void liftSolution(const SolutionBase& solution, double cost, std::string comment);
129129

130130
/// lift a modified solution based on the solution of a child stage
131-
void liftModifiedSolution(SolutionBasePtr&& new_solution, const SolutionBase& child_solution);
131+
void liftModifiedSolution(const SolutionBasePtr& new_solution, const SolutionBase& child_solution);
132132
/// lift a modified solution, changing the (single!) new associated start or end InterfaceState
133-
void liftModifiedSolution(SolutionBasePtr&& new_solution, InterfaceState&& new_propagated_state,
133+
void liftModifiedSolution(const SolutionBasePtr& new_solution, InterfaceState&& new_propagated_state,
134134
const SolutionBase& child_solution);
135135
/// lift a modified solution, providing new start and end states
136136
/// The new states will only be used if this's should actually create the corresponding states
137-
void liftModifiedSolution(SolutionBasePtr&& new_solution, InterfaceState&& new_start_state,
137+
void liftModifiedSolution(const SolutionBasePtr& new_solution, InterfaceState&& new_start_state,
138138
InterfaceState&& new_end_state, const SolutionBase& child_solution);
139139
};
140140

core/src/container.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -781,35 +781,34 @@ void ParallelContainerBase::liftSolution(const SolutionBase& solution, double co
781781
solution.start(), solution.end());
782782
}
783783

784-
void ParallelContainerBase::liftModifiedSolution(SolutionBasePtr&& modified_solution, const SolutionBase& child_solution) {
784+
void ParallelContainerBase::liftModifiedSolution(const SolutionBasePtr& modified_solution, const SolutionBase& child_solution) {
785785
// child_solution is correctly prepared by a child of this container
786786
assert(child_solution.creator());
787787
assert(child_solution.creator()->parent() == this);
788788

789-
pimpl()->liftSolution(std::move(modified_solution),
790-
child_solution.start(), child_solution.end());
789+
pimpl()->liftSolution(modified_solution, child_solution.start(), child_solution.end());
791790
}
792791

793-
void ParallelContainerBase::liftModifiedSolution(SolutionBasePtr&& new_solution, InterfaceState&& new_propagated_state, const SolutionBase& child_solution) {
792+
void ParallelContainerBase::liftModifiedSolution(const SolutionBasePtr& new_solution, InterfaceState&& new_propagated_state, const SolutionBase& child_solution) {
794793
assert(child_solution.creator());
795794
assert(child_solution.creator()->parent() == this);
796795

797796
if(pimpl()->requiredInterface() == GENERATE){
798797
// in this case we need a second InterfaceState to move from
799798
InterfaceState new_to{ new_propagated_state };
800-
pimpl()->liftSolution(std::move(new_solution), child_solution.start(), child_solution.end(), &new_propagated_state, &new_to);
799+
pimpl()->liftSolution(new_solution, child_solution.start(), child_solution.end(), &new_propagated_state, &new_to);
801800
}
802801
else {
803802
// pass new_propagated_state as start *and* end. We know at most one will be used.
804-
pimpl()->liftSolution(std::move(new_solution), child_solution.start(), child_solution.end(), &new_propagated_state, &new_propagated_state);
803+
pimpl()->liftSolution(new_solution, child_solution.start(), child_solution.end(), &new_propagated_state, &new_propagated_state);
805804
}
806805
}
807806

808-
void ParallelContainerBase::liftModifiedSolution(SolutionBasePtr&& new_solution, InterfaceState&& new_from, InterfaceState&& new_to, const SolutionBase& child_solution) {
807+
void ParallelContainerBase::liftModifiedSolution(const SolutionBasePtr& new_solution, InterfaceState&& new_from, InterfaceState&& new_to, const SolutionBase& child_solution) {
809808
assert(child_solution.creator());
810809
assert(child_solution.creator()->parent() == this);
811810

812-
pimpl()->liftSolution(std::move(new_solution), child_solution.start(), child_solution.end(), &new_from, &new_to);
811+
pimpl()->liftSolution(new_solution, child_solution.start(), child_solution.end(), &new_from, &new_to);
813812
}
814813

815814

0 commit comments

Comments
 (0)