Skip to content

Commit 6299110

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 301ea16 commit 6299110

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
@@ -127,13 +127,13 @@ class ParallelContainerBase : public ContainerBase
127127
void liftSolution(const SolutionBase& solution, double cost, std::string comment);
128128

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

core/src/container.cpp

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

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

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

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

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

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

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

816815

0 commit comments

Comments
 (0)