@@ -219,28 +219,32 @@ void StagePrivate::sendBackward(InterfaceState&& from, const InterfaceState& to,
219
219
newSolution (solution);
220
220
}
221
221
222
- void StagePrivate::spawn (InterfaceState&& state , const SolutionBasePtr& solution) {
222
+ void StagePrivate::spawn (InterfaceState&& from, InterfaceState&& to , const SolutionBasePtr& solution) {
223
223
assert (prevEnds () && nextStarts ());
224
224
225
- computeCost (state, state , *solution);
225
+ computeCost (from, to , *solution);
226
226
227
227
if (!storeSolution (solution, nullptr , nullptr ))
228
228
return ; // solution dropped
229
229
230
- auto from = states_.insert (states_.end (), InterfaceState (state )); // copy
231
- auto to = states_.insert (states_.end (), std::move (state ));
230
+ auto from_it = states_.insert (states_.end (), std::move (from ));
231
+ auto to_it = states_.insert (states_.end (), std::move (to ));
232
232
233
- solution->setStartState (*from );
234
- solution->setEndState (*to );
233
+ solution->setStartState (*from_it );
234
+ solution->setEndState (*to_it );
235
235
236
236
if (!solution->isFailure ()) {
237
- prevEnds ()->add (*from );
238
- nextStarts ()->add (*to );
237
+ prevEnds ()->add (*from_it );
238
+ nextStarts ()->add (*to_it );
239
239
}
240
240
241
241
newSolution (solution);
242
242
}
243
243
244
+ void StagePrivate::spawn (InterfaceState&& state, const SolutionBasePtr& solution) {
245
+ spawn (InterfaceState (state), std::move (state), solution);
246
+ }
247
+
244
248
void StagePrivate::connect (const InterfaceState& from, const InterfaceState& to, const SolutionBasePtr& solution) {
245
249
computeCost (from, to, *solution);
246
250
@@ -688,6 +692,10 @@ void GeneratorPrivate::compute() {
688
692
Generator::Generator (GeneratorPrivate* impl) : ComputeBase(impl) {}
689
693
Generator::Generator (const std::string& name) : Generator(new GeneratorPrivate(this , name)) {}
690
694
695
+ void Generator::spawn (InterfaceState&& from, InterfaceState&& to, SubTrajectory&& t) {
696
+ pimpl ()->spawn (std::move (from), std::move (to), std::make_shared<SubTrajectory>(std::move (t)));
697
+ }
698
+
691
699
void Generator::spawn (InterfaceState&& state, SubTrajectory&& t) {
692
700
pimpl ()->spawn (std::move (state), std::make_shared<SubTrajectory>(std::move (t)));
693
701
}
0 commit comments