26 #include <boost/algorithm/string.hpp> 27 #include <boost/lexical_cast.hpp> 42 return os <<
"non-local";
46 return os << static_cast<unsigned>(faceScope);
52 switch (facePersistency) {
56 return os <<
"persistent";
58 return os <<
"on-demand";
60 return os <<
"permanent";
62 return os << static_cast<unsigned>(facePersistency);
72 return os <<
"point-to-point";
74 return os <<
"multi-access";
78 return os << static_cast<unsigned>(linkType);
84 switch (faceEventKind) {
88 return os <<
"created";
90 return os <<
"destroyed";
96 return os << static_cast<unsigned>(faceEventKind);
102 using boost::algorithm::iequals;
107 if (iequals(s,
"none"))
109 else if (iequals(s,
"app"))
111 else if (iequals(s,
"autoreg"))
113 else if (iequals(s,
"client"))
115 else if (iequals(s,
"autoconf"))
117 else if (iequals(s,
"nlsr"))
119 else if (iequals(s,
"prefixann"))
121 else if (iequals(s,
"static"))
125 static_assert(std::numeric_limits<std::underlying_type_t<RouteOrigin>>::max() <=
126 std::numeric_limits<int>::max(),
"");
130 v = boost::lexical_cast<
int>(s);
132 catch (
const boost::bad_lexical_cast&) {
135 if (v >= std::numeric_limits<std::underlying_type_t<RouteOrigin>>::min() &&
136 v <= std::numeric_limits<std::underlying_type_t<RouteOrigin>>::max()) {
141 is.setstate(std::ios::failbit);
151 switch (routeOrigin) {
157 return os <<
"autoreg";
159 return os <<
"client";
161 return os <<
"autoconf";
165 return os <<
"prefixann";
167 return os <<
"static";
169 return os << static_cast<unsigned>(routeOrigin);
179 static const std::map<RouteFlags, std::string> knownBits = {
185 for (
const auto& pair : knownBits) {
188 std::tie(bit, token) = pair;
190 if ((routeFlags & bit) != 0) {
192 routeFlags =
static_cast<RouteFlags>(routeFlags & ~bit);
197 join =
AsHex{routeFlags};
std::istream & operator>>(std::istream &is, RouteOrigin &routeOrigin)
extract RouteOrigin from stream
Helper class to convert a number to hexadecimal format, for use with stream insertion operators...
Backport of ostream_joiner from the Library Fundamentals v2 TS.
face went UP (from DOWN state)
ostream_joiner< std::decay_t< DelimT >, CharT, Traits > make_ostream_joiner(std::basic_ostream< CharT, Traits > &os, DelimT &&delimiter)
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
face went DOWN (from UP state)