operator<< for Interface::Direction

This commit is contained in:
Robert Haschke 2022-03-04 08:54:26 +01:00
parent ca38d11303
commit 5310f9063a
3 changed files with 7 additions and 4 deletions

View File

@ -248,6 +248,7 @@ private:
std::ostream& operator<<(std::ostream& os, const InterfaceState::Priority& prio);
std::ostream& operator<<(std::ostream& os, const Interface& interface);
std::ostream& operator<<(std::ostream& os, Interface::Direction);
/// Find index of the iterator in the container. Counting starts at 1. Zero corresponds to not found.
template <typename T>

View File

@ -737,7 +737,6 @@ ConnectingPrivate::StatePair ConnectingPrivate::make_pair<Interface::FORWARD>(In
return StatePair(second, first);
}
// TODO: bool updated -> uint_8 updated (bitfield of PRIORITY | STATUS)
template <Interface::Direction dir>
void ConnectingPrivate::newState(Interface::iterator it, Interface::UpdateFlags updated) {
auto parent_pimpl = parent()->pimpl();
@ -799,8 +798,7 @@ void ConnectingPrivate::newState(Interface::iterator it, Interface::UpdateFlags
#if 0
auto& os = std::cerr;
for (auto d : { Interface::FORWARD, Interface::BACKWARD }) {
bool fw = (d == Interface::FORWARD);
if (fw)
if (d == Interface::FORWARD)
os << " " << std::setw(10) << std::left << this->name();
else
os << std::setw(12) << std::right << "";
@ -808,7 +806,7 @@ void ConnectingPrivate::newState(Interface::iterator it, Interface::UpdateFlags
os << (updated ? " !" : " +");
else
os << " ";
os << (fw ? "" : "") << this->pullInterface(d) << ": " << *this->pullInterface(d) << std::endl;
os << d << " " << this->pullInterface(d) << ": " << *this->pullInterface(d) << std::endl;
}
os << std::setw(15) << " ";
printPendingPairs(os) << std::endl;

View File

@ -178,6 +178,10 @@ std::ostream& operator<<(std::ostream& os, const InterfaceState::Priority& prio)
<< InterfaceState::STATUS_COLOR[3];
return os;
}
std::ostream& operator<<(std::ostream& os, Interface::Direction dir) {
os << (dir == Interface::FORWARD ? "" : "");
return os;
}
void SolutionBase::setCreator(Stage* creator) {
assert(creator_ == nullptr || creator_ == creator); // creator must only set once