finish serialize

This commit is contained in:
2024-10-18 15:36:00 +02:00
parent 69d96b40ec
commit 871caf9056
9 changed files with 337 additions and 20 deletions

View File

@@ -8,15 +8,13 @@ namespace td {
namespace protocol {
namespace CommandFactory {
using CommandCreator = std::function<std::unique_ptr<Command>()>;
using CommandCreator = std::function<std::shared_ptr<Command>()>;
#define DeclareCommand(CommandName, ...) std::make_unique<commands::CommandName>(),
#define DeclareCommand(CommandName, ...) std::make_shared<commands::CommandName>(),
static std::array<std::unique_ptr<Command>, static_cast<std::size_t>(CommandType::COMMAND_COUNT)> Commands = {
DeclareAllCommand()
};
static std::array<std::shared_ptr<Command>, static_cast<std::size_t>(CommandType::COMMAND_COUNT)> Commands = {DeclareAllCommand()};
const std::unique_ptr<Command>& CreateReadOnlyCommand(CommandType a_Type) {
const std::shared_ptr<Command>& CreateReadOnlyCommand(CommandType a_Type) {
assert(a_Type < CommandType::COMMAND_COUNT);
return Commands[static_cast<std::size_t>(a_Type)];
}