#ifndef MIGRAPHX_GUARD_RTGLIB_COMMAND_HPP #define MIGRAPHX_GUARD_RTGLIB_COMMAND_HPP #include "argument_parser.hpp" #include #include #include #include namespace migraphx { namespace driver { inline namespace MIGRAPHX_INLINE_NS { inline auto& get_commands() { static std::unordered_map args)>> m; return m; } template std::string command_name() { static const std::string& name = get_type_name(); return name.substr(name.rfind("::") + 2); } template int auto_register_command() { auto& m = get_commands(); m[command_name()] = [](std::vector args) { T x; argument_parser ap; x.parse(ap); ap.parse(args); x.run(); }; return 0; } template struct command { static int static_register; // This typedef ensures that the static member will be instantiated if // the class itself is instantiated using static_register_type = std::integral_constant; }; template int command::static_register = auto_register_command(); // NOLINT } // namespace MIGRAPHX_INLINE_NS } // namespace driver } // namespace migraphx #endif