mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
ComputeBase::addTrajectory -> ComputeBasePrivate::addTrajectory
Forbid indirect access to trajectories_. Only official compute classes have access.
This commit is contained in:
parent
5d5a74ecd0
commit
38f7696acf
@ -186,8 +186,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
/// ComputeBase can only be instantiated by derived classes in stage.cpp
|
/// ComputeBase can only be instantiated by derived classes in stage.cpp
|
||||||
ComputeBase(ComputeBasePrivate* impl);
|
ComputeBase(ComputeBasePrivate* impl);
|
||||||
|
|
||||||
SubTrajectory& addTrajectory(SubTrajectory&& trajectory);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -123,6 +123,9 @@ public:
|
|||||||
: StagePrivate(me, name)
|
: StagePrivate(me, name)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
// store trajectory in internal trajectories_ list
|
||||||
|
SubTrajectory& addTrajectory(SubTrajectory&& trajectory);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::list<SubTrajectory> trajectories_;
|
std::list<SubTrajectory> trajectories_;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -190,20 +190,18 @@ std::ostream& operator<<(std::ostream &os, const Stage& stage) {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SubTrajectory& ComputeBasePrivate::addTrajectory(SubTrajectory&& trajectory){
|
||||||
|
trajectory.setCreator(this);
|
||||||
|
trajectories_.emplace_back(trajectory);
|
||||||
|
return trajectories_.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ComputeBase::ComputeBase(ComputeBasePrivate *impl)
|
ComputeBase::ComputeBase(ComputeBasePrivate *impl)
|
||||||
: Stage(impl)
|
: Stage(impl)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SubTrajectory& ComputeBase::addTrajectory(SubTrajectory&& trajectory){
|
|
||||||
auto impl = pimpl();
|
|
||||||
auto &trajs = impl->trajectories_;
|
|
||||||
trajectory.setCreator(impl);
|
|
||||||
trajs.emplace_back(trajectory);
|
|
||||||
return trajs.back();
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t ComputeBase::numSolutions() const {
|
size_t ComputeBase::numSolutions() const {
|
||||||
return pimpl()->trajectories_.size();
|
return pimpl()->trajectories_.size();
|
||||||
}
|
}
|
||||||
@ -384,7 +382,7 @@ void PropagatingEitherWay::sendForward(const InterfaceState& from,
|
|||||||
SubTrajectory&& t) {
|
SubTrajectory&& t) {
|
||||||
auto impl = pimpl();
|
auto impl = pimpl();
|
||||||
std::cout << "sending state forward" << std::endl;
|
std::cout << "sending state forward" << std::endl;
|
||||||
SubTrajectory &trajectory = addTrajectory(std::move(t));
|
SubTrajectory &trajectory = impl->addTrajectory(std::move(t));
|
||||||
trajectory.setStartState(from);
|
trajectory.setStartState(from);
|
||||||
impl->nextStarts()->add(std::move(to), &trajectory, NULL);
|
impl->nextStarts()->add(std::move(to), &trajectory, NULL);
|
||||||
impl->newSolution(trajectory);
|
impl->newSolution(trajectory);
|
||||||
@ -395,7 +393,7 @@ void PropagatingEitherWay::sendBackward(InterfaceState&& from,
|
|||||||
SubTrajectory&& t) {
|
SubTrajectory&& t) {
|
||||||
auto impl = pimpl();
|
auto impl = pimpl();
|
||||||
std::cout << "sending state backward" << std::endl;
|
std::cout << "sending state backward" << std::endl;
|
||||||
SubTrajectory& trajectory = addTrajectory(std::move(t));
|
SubTrajectory& trajectory = impl->addTrajectory(std::move(t));
|
||||||
trajectory.setEndState(to);
|
trajectory.setEndState(to);
|
||||||
impl->prevEnds()->add(std::move(from), NULL, &trajectory);
|
impl->prevEnds()->add(std::move(from), NULL, &trajectory);
|
||||||
impl->newSolution(trajectory);
|
impl->newSolution(trajectory);
|
||||||
@ -474,7 +472,7 @@ void Generator::spawn(InterfaceState&& state, SubTrajectory&& t)
|
|||||||
assert(!t.trajectory());
|
assert(!t.trajectory());
|
||||||
|
|
||||||
auto impl = pimpl();
|
auto impl = pimpl();
|
||||||
SubTrajectory& trajectory = addTrajectory(std::move(t));
|
SubTrajectory& trajectory = impl->addTrajectory(std::move(t));
|
||||||
impl->prevEnds()->add(InterfaceState(state), NULL, &trajectory);
|
impl->prevEnds()->add(InterfaceState(state), NULL, &trajectory);
|
||||||
impl->nextStarts()->add(std::move(state), &trajectory, NULL);
|
impl->nextStarts()->add(std::move(state), &trajectory, NULL);
|
||||||
impl->newSolution(trajectory);
|
impl->newSolution(trajectory);
|
||||||
@ -534,7 +532,7 @@ Connecting::Connecting(const std::string &name)
|
|||||||
void Connecting::connect(const InterfaceState& from, const InterfaceState& to,
|
void Connecting::connect(const InterfaceState& from, const InterfaceState& to,
|
||||||
SubTrajectory&& t) {
|
SubTrajectory&& t) {
|
||||||
auto impl = pimpl();
|
auto impl = pimpl();
|
||||||
SubTrajectory& trajectory = addTrajectory(std::move(t));
|
SubTrajectory& trajectory = impl->addTrajectory(std::move(t));
|
||||||
trajectory.setStartState(from);
|
trajectory.setStartState(from);
|
||||||
trajectory.setEndState(to);
|
trajectory.setEndState(to);
|
||||||
impl->newSolution(trajectory);
|
impl->newSolution(trajectory);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user