| 88 | } |
| 89 | |
| 90 | std::string Command::Serialize() { |
| 91 | LOG(TRACE) << "Entering Command::Serialize"; |
| 92 | Json::Value json_object; |
| 93 | json_object["name"] = this->command_type_; |
| 94 | if (this->session_id_.length() == 0) { |
| 95 | json_object["sessionId"] = Json::nullValue; |
| 96 | } else { |
| 97 | json_object["sessionId"] = this->session_id_; |
| 98 | } |
| 99 | Json::Value parameters_object(Json::objectValue); |
| 100 | ParametersMap::const_iterator it = this->command_parameters_.begin(); |
| 101 | ParametersMap::const_iterator end = this->command_parameters_.end(); |
| 102 | for (; it != end; ++it) { |
| 103 | parameters_object[it->first] = it->second; |
| 104 | } |
| 105 | json_object["parameters"] = parameters_object; |
| 106 | Json::StreamWriterBuilder writer; |
| 107 | std::string output(Json::writeString(writer, json_object)); |
| 108 | return output; |
| 109 | } |
| 110 | |
| 111 | void Command::Copy(const Command& source) { |
| 112 | this->command_type_ = source.command_type_; |
no test coverage detected