Add helpers for AggregatedTopologyState

This commit is contained in:
Alexey Rybalchenko
2020-07-17 11:45:47 +02:00
committed by Dennis Klein
parent 3eca8e9def
commit b5545c1575
2 changed files with 55 additions and 1 deletions

View File

@@ -105,12 +105,30 @@ inline auto operator==(AggregatedTopologyState lhs, DeviceState rhs) -> bool
inline std::ostream& operator<<(std::ostream& os, const AggregatedTopologyState& state)
{
if (state == AggregatedTopologyState::Mixed) {
return os << "Mixed";
return os << "MIXED";
} else {
return os << static_cast<DeviceState>(state);
}
}
inline std::string GetAggregatedTopologyStateName(AggregatedTopologyState s)
{
if (s == AggregatedTopologyState::Mixed) {
return "MIXED";
} else {
return GetStateName(static_cast<State>(s));
}
}
inline AggregatedTopologyState GetAggregatedTopologyState(const std::string& state)
{
if (state == "MIXED") {
return AggregatedTopologyState::Mixed;
} else {
return static_cast<AggregatedTopologyState>(GetState(state));
}
}
struct DeviceStatus
{
bool subscribed_to_state_changes;