Class ICommand

Inheritance Relationships

Derived Types

Class Documentation

class ICommand

Interface for actionable commands in the application.

The ICommand interface follows the Command Pattern to decouple command parsing and execution from the main application logic. Each derived class represents a specific feature or module that can be invoked via the CLI.

Subclassed by CheckerCommand, CreateInputCommand, ExtractCommand, ExtractCoordsCommand, HighLevelCommand, ThermoCommand

Public Functions

virtual ~ICommand() = default

Virtual destructor for proper cleanup of derived classes.

virtual std::string get_name() const = 0

Retrieves the name of the command.

This name corresponds to the keyword used in the CLI to invoke the command.

Returns:

std::string The command name (e.g., “thermo”, “extract”).

virtual std::string get_description() const = 0

Retrieves a short description of the command.

This description is displayed in the application’s help menu.

Returns:

std::string A brief description of what the command does.

virtual void parse_args(int argc, char *argv[], int &i, CommandContext &context) = 0

Parses command-specific arguments from the command line.

Parameters:
  • argc – The total number of command-line arguments.

  • argv – Array of command-line argument strings.

  • i – The current index in argv. Passed by reference to allow the command to consume arguments.

  • context – The CommandContext used to store application-level options and warnings.

virtual int execute(const CommandContext &context) = 0

Executes the command.

Parameters:

context – The CommandContext containing shared configuration.

Returns:

int The exit code of the execution (0 for success, non-zero for failure).