1 #ifndef GDE_COMMAND_TO_HPP
2 #define GDE_COMMAND_TO_HPP
11 typedef std::map<std::string, std::string> ParametersMap;
14 CommandTO(int method = -1,
15 const std::string& data = std::string(),
16 const ParametersMap& parameters=ParametersMap())
17 : _method(method), _data(data), _parameters(parameters) {}
18 CommandTO(const CommandTO&);
21 inline std::string getData() const { return _data; }
22 inline void setData(const std::string& data) { this->_data = data; }
24 inline int getMethod() const { return _method; }
25 inline void setMethod(int method) { this->_method = method; }
27 template <typename T> T getParameter(const std::string& name);
28 template <typename T> void setParameter(const std::string& name, const T& value, bool replaceIfExist=true);
30 static CommandTO fromJson(const std::string& json);
31 std::string toJson() const;
35 std::string _data; // JSON format
36 ParametersMap _parameters;
41 #include "CommandTO.tpp"