| 51 | namespace { |
| 52 | |
| 53 | Status PackToAnyAndSerialize(const google::protobuf::Message& command, std::string* out) { |
| 54 | google::protobuf::Any any; |
| 55 | #if PROTOBUF_VERSION >= 3015000 |
| 56 | if (!any.PackFrom(command)) { |
| 57 | return Status::SerializationError("Failed to pack ", command.GetTypeName()); |
| 58 | } |
| 59 | #else |
| 60 | any.PackFrom(command); |
| 61 | #endif |
| 62 | |
| 63 | #if PROTOBUF_VERSION >= 3015000 |
| 64 | if (!any.SerializeToString(out)) { |
| 65 | return Status::SerializationError("Failed to serialize ", command.GetTypeName()); |
| 66 | } |
| 67 | #else |
| 68 | any.SerializeToString(out); |
| 69 | #endif |
| 70 | return Status::OK(); |
| 71 | } |
| 72 | |
| 73 | } // namespace |
| 74 |
no test coverage detected