Class CommandRegistry¶
Defined in File command_registry.h
Class Documentation¶
-
class CommandRegistry¶
A singleton registry that maintains all available commands in the application.
This class applies the Singleton design pattern to provide a centralized repository for ICommand instances. It maps command names (strings) to their respective ICommand implementations, allowing the application to dynamically resolve and dispatch command execution.
Public Functions
-
void register_command(std::unique_ptr<ICommand> command)¶
Registers a new command with the registry.
- Parameters:
command – A unique pointer to the command being registered. The registry takes ownership.
Public Static Functions
-
static CommandRegistry &get_instance()¶
Retrieves the singleton instance of the CommandRegistry.
- Returns:
CommandRegistry& Reference to the single target instance.
-
void register_command(std::unique_ptr<ICommand> command)¶