Added new projects of new RPC core: MyClient and MtServivce

This commit is contained in:
Viacheslav Demydiuk
2024-01-04 18:35:15 +02:00
parent 2a13699900
commit feb0192b11
24 changed files with 2078 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
#pragma once
#include <functional>
#include "MtMessage.h"
typedef std::function<void(const MtResponse&)> TaskCallback;
class CommandTask
{
public:
CommandTask(std::unique_ptr<MtCommand> command, TaskCallback callback)
: command_(std::move(command))
, callback_(std::move(callback))
{}
MtCommand& getCommand() const { return *command_; }
void ProcessResponse(int handle, const std::string& payload)
{
MtResponse respone(handle, command_->getCommandId(), payload);
callback_(respone);
}
private:
std::unique_ptr<MtCommand> command_;
TaskCallback callback_;
};