X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fcommon%2Fcmdparse.h;fp=src%2Fceph%2Fsrc%2Fcommon%2Fcmdparse.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=41495f5551a283c3628c86b608fdf3e13216931c;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/common/cmdparse.h b/src/ceph/src/common/cmdparse.h deleted file mode 100644 index 41495f5..0000000 --- a/src/ceph/src/common/cmdparse.h +++ /dev/null @@ -1,84 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -#ifndef CEPH_COMMON_CMDPARSE_H -#define CEPH_COMMON_CMDPARSE_H - -#include -#include -#include -#include -#include "include/assert.h" // boost clobbers this -#include "common/Formatter.h" -#include "common/BackTrace.h" - -class CephContext; - -/* this is handy; can't believe it's not standard */ -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a)) - -typedef boost::variant, - std::vector, - std::vector> cmd_vartype; -typedef std::map cmdmap_t; - -std::string cmddesc_get_prefix(const std::string &cmddesc); -void dump_cmd_to_json(ceph::Formatter *f, const std::string& cmd); -void dump_cmd_and_help_to_json(ceph::Formatter *f, - const std::string& secname, - const std::string& cmd, - const std::string& helptext); -void dump_cmddesc_to_json(ceph::Formatter *jf, - const std::string& secname, - const std::string& cmdsig, - const std::string& helptext, - const std::string& module, - const std::string& perm, - const std::string& avail, - uint64_t flags); -bool cmdmap_from_json(std::vector cmd, cmdmap_t *mapp, - std::stringstream &ss); -void cmdmap_dump(const cmdmap_t &cmdmap, ceph::Formatter *f); -void handle_bad_get(CephContext *cct, const std::string& k, const char *name); - -std::string cmd_vartype_stringify(const cmd_vartype& v); - -template -bool -cmd_getval(CephContext *cct, const cmdmap_t& cmdmap, const std::string& k, T& val) -{ - if (cmdmap.count(k)) { - try { - val = boost::get(cmdmap.find(k)->second); - return true; - } catch (boost::bad_get) { - handle_bad_get(cct, k, typeid(T).name()); - } - } - return false; -} - -// with default - -template -void -cmd_getval(CephContext *cct, const cmdmap_t& cmdmap, const std::string& k, T& val, const T& defval) -{ - if (!cmd_getval(cct, cmdmap, k, val)) - val = defval; -} - -template -void -cmd_putval(CephContext *cct, cmdmap_t& cmdmap, const std::string& k, const T& val) -{ - cmdmap[k] = val; -} - -extern int parse_osd_id(const char *s, std::ostream *pss); -extern long parse_pos_long(const char *s, std::ostream *pss = NULL); - -#endif