#include <boost/lexical_cast.hpp>
#include <map>
#include <string>
#include <bwi_tools/json/json.h>
Go to the source code of this file.
Defines |
#define | PARAM_DECL(type, var, key, val) type var; |
#define | PARAM_INIT(type, var, key, val) var = val; |
#define | PARAM_MAP(type, var, key, val) stringMap[#var] = boost::lexical_cast<std::string>(var); |
#define | PARAM_OUT(type, var, key, val) os << #var << ": " << p.var << " "; |
#define | PARAM_SET(type, var, key, val) setFromJson(opts,#key,var); |
#define | Params_STRUCT(params) |
#define | SET_FROM_JSON(type, jsonCmd) |
#define | SET_FROM_JSON_ENUM(ENUM) |
Define Documentation
#define PARAM_DECL |
( |
|
type, |
|
|
|
var, |
|
|
|
key, |
|
|
|
val |
|
) |
| type var; |
#define PARAM_INIT |
( |
|
type, |
|
|
|
var, |
|
|
|
key, |
|
|
|
val |
|
) |
| var = val; |
#define PARAM_MAP |
( |
|
type, |
|
|
|
var, |
|
|
|
key, |
|
|
|
val |
|
) |
| stringMap[#var] = boost::lexical_cast<std::string>(var); |
#define PARAM_OUT |
( |
|
type, |
|
|
|
var, |
|
|
|
key, |
|
|
|
val |
|
) |
| os << #var << ": " << p.var << " "; |
#define PARAM_SET |
( |
|
type, |
|
|
|
var, |
|
|
|
key, |
|
|
|
val |
|
) |
| setFromJson(opts,#key,var); |
Value:struct Params {\
params(PARAM_DECL) \
\
Params() { \
params(PARAM_INIT) \
} \
\
void fromJson(const Json::Value &opts) { \
(void)opts; \
params(PARAM_SET) \
} \
std::map<std::string, std::string> asMap() { \
std::map<std::string, std::string> stringMap; \
params(PARAM_MAP) \
return stringMap; \
} \
friend std::ostream& operator<<(std::ostream &os, const Params &p) { \
params(PARAM_OUT) \
return os; \
} \
};
Definition at line 37 of file Params.h.
Value:inline void setFromJson(const Json::Value &opts, const char *key, type &val) { \
const Json::Value &opt = opts[key]; \
if (!opt.isNull()) \
val = opt.jsonCmd(); \
}
Definition at line 10 of file Params.h.
Value:inline void setFromJson(const Json::Value &opts, const char *key, ENUM::type &val) { \
const Json::Value &opt = opts[key]; \
if (!opt.isNull()) \
val = ENUM::fromName(opt.asCString()); \
}
Definition at line 17 of file Params.h.