mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
templatize: pullInterface(dir) -> pullInterface<dir>()
Also remove unused pushInterface(dir)
This commit is contained in:
parent
a31e52dd53
commit
fdd5ff880b
@ -100,17 +100,9 @@ public:
|
|||||||
inline InterfaceConstPtr prevEnds() const { return prev_ends_.lock(); }
|
inline InterfaceConstPtr prevEnds() const { return prev_ends_.lock(); }
|
||||||
inline InterfaceConstPtr nextStarts() const { return next_starts_.lock(); }
|
inline InterfaceConstPtr nextStarts() const { return next_starts_.lock(); }
|
||||||
|
|
||||||
/// direction-based access to pull/push interfaces
|
/// direction-based access to pull interface
|
||||||
inline InterfacePtr& pullInterface(Interface::Direction dir) { return dir == Interface::FORWARD ? starts_ : ends_; }
|
template <Interface::Direction dir>
|
||||||
inline InterfacePtr pushInterface(Interface::Direction dir) {
|
inline InterfacePtr pullInterface();
|
||||||
return dir == Interface::FORWARD ? next_starts_.lock() : prev_ends_.lock();
|
|
||||||
}
|
|
||||||
inline InterfaceConstPtr pullInterface(Interface::Direction dir) const {
|
|
||||||
return dir == Interface::FORWARD ? starts_ : ends_;
|
|
||||||
}
|
|
||||||
inline InterfaceConstPtr pushInterface(Interface::Direction dir) const {
|
|
||||||
return dir == Interface::FORWARD ? next_starts_.lock() : prev_ends_.lock();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// set parent of stage
|
/// set parent of stage
|
||||||
/// enforce only one parent exists
|
/// enforce only one parent exists
|
||||||
@ -204,6 +196,15 @@ private:
|
|||||||
PIMPL_FUNCTIONS(Stage)
|
PIMPL_FUNCTIONS(Stage)
|
||||||
std::ostream& operator<<(std::ostream& os, const StagePrivate& stage);
|
std::ostream& operator<<(std::ostream& os, const StagePrivate& stage);
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline InterfacePtr StagePrivate::pullInterface<Interface::FORWARD>() {
|
||||||
|
return starts_;
|
||||||
|
}
|
||||||
|
template <>
|
||||||
|
inline InterfacePtr StagePrivate::pullInterface<Interface::BACKWARD>() {
|
||||||
|
return ends_;
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline void StagePrivate::send<Interface::FORWARD>(const InterfaceState& start, InterfaceState&& end,
|
inline void StagePrivate::send<Interface::FORWARD>(const InterfaceState& start, InterfaceState&& end,
|
||||||
const SolutionBasePtr& solution) {
|
const SolutionBasePtr& solution) {
|
||||||
|
|||||||
@ -715,7 +715,7 @@ void ParallelContainerBasePrivate::validateConnectivity() const {
|
|||||||
template <Interface::Direction dir>
|
template <Interface::Direction dir>
|
||||||
void ParallelContainerBasePrivate::onNewExternalState(Interface::iterator external, bool updated) {
|
void ParallelContainerBasePrivate::onNewExternalState(Interface::iterator external, bool updated) {
|
||||||
for (const Stage::pointer& stage : children())
|
for (const Stage::pointer& stage : children())
|
||||||
copyState<dir>(external, stage->pimpl()->pullInterface(dir), updated);
|
copyState<dir>(external, stage->pimpl()->pullInterface<dir>(), updated);
|
||||||
}
|
}
|
||||||
|
|
||||||
ParallelContainerBase::ParallelContainerBase(ParallelContainerBasePrivate* impl) : ContainerBase(impl) {}
|
ParallelContainerBase::ParallelContainerBase(ParallelContainerBasePrivate* impl) : ContainerBase(impl) {}
|
||||||
|
|||||||
@ -713,9 +713,9 @@ ConnectingPrivate::StatePair ConnectingPrivate::make_pair<Interface::FORWARD>(In
|
|||||||
template <Interface::Direction dir>
|
template <Interface::Direction dir>
|
||||||
void ConnectingPrivate::newState(Interface::iterator it, bool updated) {
|
void ConnectingPrivate::newState(Interface::iterator it, bool updated) {
|
||||||
auto parent_pimpl = parent()->pimpl();
|
auto parent_pimpl = parent()->pimpl();
|
||||||
Interface::DisableNotify disable_source_interface(*pullInterface(dir));
|
Interface::DisableNotify disable_source_interface(*pullInterface<dir>());
|
||||||
if (updated) {
|
if (updated) {
|
||||||
if (pullInterface(opposite<dir>())->notifyEnabled()) // suppress recursive loop
|
if (pullInterface<opposite<dir>()>()->notifyEnabled()) // suppress recursive loop
|
||||||
{
|
{
|
||||||
// If status has changed, propagate the update to the opposite side
|
// If status has changed, propagate the update to the opposite side
|
||||||
auto status = it->priority().status();
|
auto status = it->priority().status();
|
||||||
@ -747,7 +747,7 @@ void ConnectingPrivate::newState(Interface::iterator it, bool updated) {
|
|||||||
pending.sort();
|
pending.sort();
|
||||||
} else { // new state: insert all pairs with other interface
|
} else { // new state: insert all pairs with other interface
|
||||||
assert(it->priority().enabled()); // new solutions are feasible, aren't they?
|
assert(it->priority().enabled()); // new solutions are feasible, aren't they?
|
||||||
InterfacePtr other_interface = pullInterface(dir);
|
InterfacePtr other_interface = pullInterface<dir>();
|
||||||
bool have_enabled_opposites = false;
|
bool have_enabled_opposites = false;
|
||||||
for (Interface::iterator oit = other_interface->begin(), oend = other_interface->end(); oit != oend; ++oit) {
|
for (Interface::iterator oit = other_interface->begin(), oend = other_interface->end(); oit != oend; ++oit) {
|
||||||
if (!static_cast<Connecting*>(me_)->compatible(*it, *oit))
|
if (!static_cast<Connecting*>(me_)->compatible(*it, *oit))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user