@@ -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
+
225
+ computeCost (from, to, *solution);
224
226
225
- computeCost (state, state, *solution);
226
-
227
- if (!storeSolution (solution, nullptr , nullptr ))
227
+ if (!storeSolution (solution, &from, &to))
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 (), InterfaceState (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 (std::move (state), std::move (state), solution); // copy start and end states
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
}
@@ -699,7 +707,7 @@ MonitoringGenerator::MonitoringGenerator(const std::string& name, Stage* monitor
699
707
: Generator(new MonitoringGeneratorPrivate(this , name)) {
700
708
setMonitoredStage (monitored);
701
709
}
702
-
710
+
703
711
void MonitoringGenerator::setMonitoredStage (Stage* monitored) {
704
712
auto impl = pimpl ();
705
713
if (impl->monitored_ == monitored)
0 commit comments