25 #include <boost/algorithm/string.hpp> 26 #include <boost/lexical_cast.hpp> 41 return os <<
"non-local";
45 return os << static_cast<unsigned>(faceScope);
51 switch (facePersistency) {
55 return os <<
"persistent";
57 return os <<
"on-demand";
59 return os <<
"permanent";
61 return os << static_cast<unsigned>(facePersistency);
71 return os <<
"point-to-point";
73 return os <<
"multi-access";
77 return os << static_cast<unsigned>(linkType);
83 switch (faceEventKind) {
87 return os <<
"created";
89 return os <<
"destroyed";
95 return os << static_cast<unsigned>(faceEventKind);
101 using boost::algorithm::iequals;
106 if (iequals(s,
"none"))
108 else if (iequals(s,
"app"))
110 else if (iequals(s,
"autoreg"))
112 else if (iequals(s,
"client"))
114 else if (iequals(s,
"autoconf"))
116 else if (iequals(s,
"nlsr"))
118 else if (iequals(s,
"static"))
122 static_assert(std::numeric_limits<std::underlying_type<RouteOrigin>::type>::max() <=
123 std::numeric_limits<int>::max(),
"");
127 v = boost::lexical_cast<
int>(s);
129 catch (
const boost::bad_lexical_cast&) {
132 if (v >= std::numeric_limits<std::underlying_type<RouteOrigin>::type>::min() &&
133 v <= std::numeric_limits<std::underlying_type<RouteOrigin>::type>::max()) {
138 is.setstate(std::ios::failbit);
148 switch (routeOrigin) {
154 return os <<
"autoreg";
156 return os <<
"client";
158 return os <<
"autoconf";
162 return os <<
"static";
164 return os << static_cast<unsigned>(routeOrigin);
174 static const std::map<RouteFlags, std::string> knownBits = {
180 for (
const auto& pair : knownBits) {
183 std::tie(bit, token) = pair;
185 if ((routeFlags & bit) != 0) {
187 routeFlags =
static_cast<RouteFlags>(routeFlags & ~bit);
192 join =
AsHex{routeFlags};
Copyright (c) 2013-2017 Regents of the University of California.
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...
ostream_joiner< typename std::decay< DelimT >::type, CharT, Traits > make_ostream_joiner(std::basic_ostream< CharT, Traits > &os, DelimT &&delimiter)
face went UP (from DOWN state)
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
face went DOWN (from UP state)