finish serialize
This commit is contained in:
@@ -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)];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user