@@ -219,28 +219,32 @@ void StagePrivate::sendBackward(InterfaceState&& from, const InterfaceState& to,
219219 newSolution (solution);
220220}
221221
222- void StagePrivate::spawn (InterfaceState&& state , const SolutionBasePtr& solution) {
222+ void StagePrivate::spawn (InterfaceState&& from, InterfaceState&& to , const SolutionBasePtr& solution) {
223223 assert (prevEnds () && nextStarts ());
224224
225- computeCost (state, state , *solution);
225+ computeCost (from, to , *solution);
226226
227227 if (!storeSolution (solution, nullptr , nullptr ))
228228 return ; // solution dropped
229229
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 ));
232232
233- solution->setStartState (*from );
234- solution->setEndState (*to );
233+ solution->setStartState (*from_it );
234+ solution->setEndState (*to_it );
235235
236236 if (!solution->isFailure ()) {
237- prevEnds ()->add (*from );
238- nextStarts ()->add (*to );
237+ prevEnds ()->add (*from_it );
238+ nextStarts ()->add (*to_it );
239239 }
240240
241241 newSolution (solution);
242242}
243243
244+ void StagePrivate::spawn (InterfaceState&& state, const SolutionBasePtr& solution) {
245+ spawn (InterfaceState (state), std::move (state), solution);
246+ }
247+
244248void StagePrivate::connect (const InterfaceState& from, const InterfaceState& to, const SolutionBasePtr& solution) {
245249 computeCost (from, to, *solution);
246250
@@ -688,6 +692,10 @@ void GeneratorPrivate::compute() {
688692Generator::Generator (GeneratorPrivate* impl) : ComputeBase(impl) {}
689693Generator::Generator (const std::string& name) : Generator(new GeneratorPrivate(this , name)) {}
690694
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+
691699void Generator::spawn (InterfaceState&& state, SubTrajectory&& t) {
692700 pimpl ()->spawn (std::move (state), std::make_shared<SubTrajectory>(std::move (t)));
693701}
0 commit comments