20 using CommandFunction = std::function<void(
const std::string&,
const std::string&)>;
21 static std::unordered_map<std::string, CommandFunction> commonCommands = {
22 {
"calculateSpectrum", [type](
const std::string& input,
const std::string& output) {
24 calculator->calculateSpectrum(input, output);
28 auto commandIterator = commonCommands.find(commandName);
29 if (commandIterator != commonCommands.end()) {
30 commandIterator->second(inputFilePath, outputFilePath);
32 throw std::invalid_argument(
"Calculator command '" + commandName +
"' is not recognized.");
static void executeCommand(CalculatorType type, const std::string &commandName, const std::string &inputFilePath, const std::string &outputFilePath)
Executes a named command on a chosen calculator type.