Protobuf prototype

This commit is contained in:
Konstantin Lampalzer 2022-03-18 18:11:16 +01:00
parent e277a83c5f
commit 9b567b8c6c
119 changed files with 8599 additions and 0 deletions

View file

@ -0,0 +1,28 @@
#ifndef COMPLIB_SERVER_MESSAGECREATION_HPP
#define COMPLIB_SERVER_MESSAGECREATION_HPP
#include <CompLib.pb.h>
namespace MessageBuilder {
CompLib::Header *header(const std::string &message_type) {
auto header = new CompLib::Header();
header->set_message_type(message_type);
return header;
}
CompLib::Status *status(bool successful, const std::string &error_message) {
auto status = new CompLib::Status();
status->set_successful(successful);
status->set_error_message(error_message);
return status;
}
CompLib::GenericResponse *genericResponse(bool successful, const std::string &error_message) {
auto genericResponse = new CompLib::GenericResponse();
genericResponse->set_allocated_header(header(CompLib::GenericResponse::descriptor()->full_name()));
genericResponse->set_allocated_status(status(successful, error_message));
return genericResponse;
}
}
#endif //COMPLIB_SERVER_MESSAGECREATION_HPP