#include #include #include #include namespace td { namespace protocol { namespace CommandFactory { using CommandCreator = std::function()>; #define DeclareCommand(CommandName, ...) std::make_shared(), static std::array, static_cast(CommandType::COMMAND_COUNT)> Commands = {DeclareAllCommand()}; const std::shared_ptr& CreateReadOnlyCommand(CommandType a_Type) { assert(a_Type < CommandType::COMMAND_COUNT); return Commands[static_cast(a_Type)]; } } // namespace CommandFactory } // namespace protocol } // namespace td