#ifndef CEPH_COMMON_CMDPARSE_H
#define CEPH_COMMON_CMDPARSE_H
-#include <string>
-#include <sstream>
-#include <map>
-#include <boost/variant.hpp>
#include <vector>
#include <stdexcept>
+#include <ostream>
+#include <boost/variant.hpp>
+#include "include/assert.h" // boost clobbers this
#include "common/Formatter.h"
#include "common/BackTrace.h"
bool cmdmap_from_json(std::vector<std::string> cmd, cmdmap_t *mapp,
std::stringstream &ss);
void cmdmap_dump(const cmdmap_t &cmdmap, ceph::Formatter *f);
-void handle_bad_get(CephContext *cct, std::string k, const char *name);
+void handle_bad_get(CephContext *cct, const std::string& k, const char *name);
std::string cmd_vartype_stringify(const cmd_vartype& v);
template <typename T>
bool
-cmd_getval(CephContext *cct, const cmdmap_t& cmdmap, std::string k, T& val)
+cmd_getval(CephContext *cct, const cmdmap_t& cmdmap, const std::string& k, T& val)
{
if (cmdmap.count(k)) {
try {
template <typename T>
void
-cmd_getval(CephContext *cct, cmdmap_t& cmdmap, std::string k, T& val, T defval)
+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 <typename T>
void
-cmd_putval(CephContext *cct, cmdmap_t& cmdmap, std::string k, T val)
+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