MCPcopy Create free account
hub / github.com/ceph/ceph / cmd_getval_or

Function cmd_getval_or

src/common/cmdparse.h:102–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100
101template <typename T, typename V>
102T cmd_getval_or(const cmdmap_t& cmdmap, std::string_view k,
103 const V& defval)
104{
105 auto found = cmdmap.find(k);
106 if (found == cmdmap.cend()) {
107 return T(defval);
108 }
109 try {
110 return boost::get<T>(found->second);
111 } catch (boost::bad_get&) {
112 throw bad_cmd_get(k, cmdmap);
113 }
114}
115
116/**
117 * with default, to be used when the parameter type (which matches the type of the

Callers

nothing calls this directly

Calls 4

TClass · 0.85
bad_cmd_getClass · 0.85
findMethod · 0.45
cendMethod · 0.45

Tested by

no test coverage detected