streamline trait parameters

state asked for a reference, but trajectories for a pointer.
This commit is contained in:
v4hn 2021-03-17 00:03:55 +01:00
parent bca01e8aa7
commit a82b88355e
3 changed files with 7 additions and 7 deletions

View File

@ -391,14 +391,14 @@ inline const InterfaceState* state<Interface::BACKWARD>(const SolutionBase& solu
/// Trait to retrieve outgoing (FORWARD) or incoming (BACKWARD) solution segments of a given state /// Trait to retrieve outgoing (FORWARD) or incoming (BACKWARD) solution segments of a given state
template <Interface::Direction dir> template <Interface::Direction dir>
const InterfaceState::Solutions& trajectories(const InterfaceState* state); const InterfaceState::Solutions& trajectories(const InterfaceState& state);
template <> template <>
inline const InterfaceState::Solutions& trajectories<Interface::FORWARD>(const InterfaceState* state) { inline const InterfaceState::Solutions& trajectories<Interface::FORWARD>(const InterfaceState& state) {
return state->outgoingTrajectories(); return state.outgoingTrajectories();
} }
template <> template <>
inline const InterfaceState::Solutions& trajectories<Interface::BACKWARD>(const InterfaceState* state) { inline const InterfaceState::Solutions& trajectories<Interface::BACKWARD>(const InterfaceState& state) {
return state->incomingTrajectories(); return state.incomingTrajectories();
} }
/// Trait to retrieve opposite direction (FORWARD <-> BACKWARD) /// Trait to retrieve opposite direction (FORWARD <-> BACKWARD)

View File

@ -317,7 +317,7 @@ struct SolutionCollector
} }
void traverse(const SolutionBase& start, const InterfaceState::Priority& prio) { void traverse(const SolutionBase& start, const InterfaceState::Priority& prio) {
const InterfaceState::Solutions& next = trajectories<dir>(state<dir>(start)); const InterfaceState::Solutions& next = trajectories<dir>(*state<dir>(start));
if (next.empty()) { // when reaching the end, add the trace to solutions if (next.empty()) { // when reaching the end, add the trace to solutions
assert(prio.depth() == trace.size()); assert(prio.depth() == trace.size());
assert(prio.depth() <= max_depth); assert(prio.depth() <= max_depth);

View File

@ -166,7 +166,7 @@ void StagePrivate::setStatus(const InterfaceState* s, InterfaceState::Status sta
status = InterfaceState::DISABLED; // only the first state is marked as FAILED status = InterfaceState::DISABLED; // only the first state is marked as FAILED
// traverse solution tree // traverse solution tree
for (const SolutionBase* successor : trajectories<dir>(s)) for (const SolutionBase* successor : trajectories<dir>(*s))
setStatus<dir>(state<dir>(*successor), status); setStatus<dir>(state<dir>(*successor), status);
} }
template void StagePrivate::setStatus<Interface::FORWARD>(const InterfaceState* s, InterfaceState::Status status); template void StagePrivate::setStatus<Interface::FORWARD>(const InterfaceState* s, InterfaceState::Status status);