diff --git a/core/src/container.cpp b/core/src/container.cpp index 6e70b269..76338ca7 100644 --- a/core/src/container.cpp +++ b/core/src/container.cpp @@ -554,14 +554,17 @@ void SerialContainer::validateConnectivity() const // check that input / output interface of first / last child matches this' resp. interface if (!impl->children().empty()) { const StagePrivate* start = impl->children().front()->pimpl(); - if ((start->interfaceFlags() & INPUT_IF_MASK) != (this->pimpl()->interfaceFlags() & INPUT_IF_MASK)) - errors.push_back(*this, (desc % "input" % start->name() % flowSymbol(start->interfaceFlags()) - % flowSymbol(this->pimpl()->interfaceFlags())).str()); + const auto my_flags = this->pimpl()->interfaceFlags(); + auto child_flags = start->interfaceFlags() & INPUT_IF_MASK; + if (child_flags != (my_flags & INPUT_IF_MASK)) + errors.push_back(*this, (desc % "input" % start->name() % flowSymbol(child_flags) + % flowSymbol(my_flags & INPUT_IF_MASK)).str()); const StagePrivate* last = impl->children().back()->pimpl(); - if ((last->interfaceFlags() & OUTPUT_IF_MASK) != (this->pimpl()->interfaceFlags() & OUTPUT_IF_MASK)) - errors.push_back(*this, (desc % "output" % last->name() % flowSymbol(last->interfaceFlags()) - % flowSymbol(this->pimpl()->interfaceFlags())).str()); + child_flags = last->interfaceFlags() & OUTPUT_IF_MASK; + if (child_flags != (my_flags & OUTPUT_IF_MASK)) + errors.push_back(*this, (desc % "output" % last->name() % flowSymbol(child_flags) + % flowSymbol(my_flags & OUTPUT_IF_MASK)).str()); } // validate connectivity of children amongst each other diff --git a/core/src/stage.cpp b/core/src/stage.cpp index 7d382b58..15cdc9b4 100644 --- a/core/src/stage.cpp +++ b/core/src/stage.cpp @@ -349,13 +349,21 @@ const char* direction(const StagePrivate& stage) { return "<-"; } -const char* flowSymbol(moveit::task_constructor::InterfaceFlags f) { - if (f == InterfaceFlags(CONNECT)) return "∞"; - if (f == InterfaceFlags(PROPAGATE_FORWARDS)) return "↓"; - if (f == InterfaceFlags(PROPAGATE_BACKWARDS)) return "↑"; - if (f == PROPAGATE_BOTHWAYS) return "⇅"; - if (f == InterfaceFlags(GENERATE)) return "↕"; - return "?"; +const char* flowSymbol(InterfaceFlags f) { + if (f == InterfaceFlags()) + return "?"; // unknown interface + + // f should have either INPUT or OUTPUT flags set (not both) + assert(static_cast(f & INPUT_IF_MASK) ^ static_cast(f & OUTPUT_IF_MASK)); + + if (f & INPUT_IF_MASK) { + if (f == READS_START) return "->"; + if (f == WRITES_PREV_END) return "<-"; + } else if (f & OUTPUT_IF_MASK) { + if (f == READS_END) return "<-"; + if (f == WRITES_NEXT_START) return "->"; + } + return "<->"; } std::ostream& operator<<(std::ostream& os, const StagePrivate& impl) {