diff --git a/src/cli/ace_helprun.cpp b/src/cli/ace_helprun.cpp index ee9060e..47aea87 100644 --- a/src/cli/ace_helprun.cpp +++ b/src/cli/ace_helprun.cpp @@ -599,8 +599,8 @@ void HelpRun::settingsSetHelp() { // Initialize an enumeration and string list used to determine what setting set // command was given to get help on, if any. - enum {CUDA,OpenCL,Threads,Buffer,ChunkDir,ChunkPre,ChunkExt,Logging}; - QStringList list {"cuda","opencl","threads","buffer","chunkdir","chunkpre","chunkext","logging"}; + enum {CUDA,OpenCL,Threads,Buffer,ChunkDir,ChunkPre,ChunkExt,Logging,LogPort}; + QStringList list {"cuda","opencl","threads","buffer","chunkdir","chunkpre","chunkext","logging","logport"}; // Create an empty command string, setting it to this run's next command argument // is any exists. @@ -637,6 +637,9 @@ void HelpRun::settingsSetHelp() case Logging: settingsSetLoggingHelp(); break; + case LogPort: + settingsSetLogPortHelp(); + break; default: { // If the setting set command was not recognized or was empty then print the basic @@ -645,11 +648,12 @@ void HelpRun::settingsSetHelp() stream << "Command: " << _runName << " settings set \n" << "Updates a persistent setting with the given key to the new given value.\n\n" << " key: The key of the setting that will be updated to a new value. Valid keys\n" - << " are cuda, opencl, threads, buffer, chunkdir, chunkpre, chunkext, and\n" - << " logging.\n\n" + << " are cuda, opencl, threads, buffer, chunkdir, chunkpre, chunkext,\n" + << " logging, and logport.\n\n" << "value: The new value of the given setting.\n\n" << "Help: " << _runName << " help settings set \n" - << "Get help about a specific setting to set with the given key.\n\n"; + << "Get help about a specific setting to set with the given key.\n\n" + << "Valid settings set keys:\n"; break; } } @@ -822,6 +826,20 @@ void HelpRun::settingsSetLoggingHelp() +void HelpRun::settingsSetLogPortHelp() +{ + QTextStream stream(stdout); + stream << "Command: " << _runName << " settings set logport \n" + << "Updates the logging port setting. The logging port is the port number the ACE\n" + << "logging system listens on for logging client connections.\n\n" + << "port: The new port number.\n\n"; +} + + + + + + /*! * Displays the help text for the settings list command. */ diff --git a/src/cli/ace_helprun.h b/src/cli/ace_helprun.h index e24bc9b..c2628bf 100644 --- a/src/cli/ace_helprun.h +++ b/src/cli/ace_helprun.h @@ -44,6 +44,7 @@ namespace Ace void settingsSetChunkPreHelp(); void settingsSetChunkExtHelp(); void settingsSetLoggingHelp(); + void settingsSetLogPortHelp(); void settingsListHelp(); /*! * The command arguments parsed out of the command line arguments of the main diff --git a/src/cli/ace_settingsrun.cpp b/src/cli/ace_settingsrun.cpp index 3b66236..26eeb1c 100644 --- a/src/cli/ace_settingsrun.cpp +++ b/src/cli/ace_settingsrun.cpp @@ -58,6 +58,7 @@ void SettingsRun::execute() stream << " Chunk Prefix: " << settings.chunkPrefix() << "\n"; stream << " Chunk Extension: " << settings.chunkExtension() << "\n"; stream << " Logging: " << ( settings.loggingEnabled() ? QStringLiteral("on") : QStringLiteral("off") ) << "\n"; + stream << " Logging Port: " << settings.loggingPort() << "\n"; } // Else call the setting parser method to determine which command was given. @@ -197,8 +198,8 @@ void SettingsRun::set() } // Create an enumeration and string list used to determine the command given. - enum {Unknown=-1,CUDACom,OpenCLCom,Threads,Buffer,ChunkDir,ChunkPre,ChunkExt,Logging}; - QStringList list {"cuda","opencl","threads","buffer","chunkdir","chunkpre","chunkext","logging"}; + enum {Unknown=-1,CUDACom,OpenCLCom,Threads,Buffer,ChunkDir,ChunkPre,ChunkExt,Logging,LogPort}; + QStringList list {"cuda","opencl","threads","buffer","chunkdir","chunkpre","chunkext","logging","logport"}; // Determine which setting is to be set by the command given, calling the // appropriate method and popping this object's first command argument. @@ -229,6 +230,9 @@ void SettingsRun::set() case Logging: setLogging(); break; + case LogPort: + setLogPort(); + break; case Unknown: { // The set command is not known so throw an exception informing the user. @@ -565,6 +569,38 @@ void SettingsRun::setLogging() +void SettingsRun::setLogPort() +{ + // Add the debug header. + EDEBUG_FUNC(this); + + // Make sure there is a command argument to process. + if ( _command.size() < 1 ) + { + E_MAKE_EXCEPTION(e); + e.setTitle(QObject::tr("Invalid argument")); + e.setDetails(QObject::tr("Settings set logport requires sub argument, exiting...")); + throw e; + } + + bool ok; + int port {_command.first().toInt(&ok)}; + if ( !ok || port < 0 || port > 65535 ) + { + E_MAKE_EXCEPTION(e); + e.setTitle(QObject::tr("Invalid argument")); + e.setDetails(QObject::tr("Given logging port '%1' invalid, exiting...").arg(_command.first())); + throw e; + } + + Ace::Settings::instance().setLoggingPort(port); +} + + + + + + /*! * Executes the settings list command, parsing the first argument to determine * which specific list command is to be executed and calling the appropriate diff --git a/src/cli/ace_settingsrun.h b/src/cli/ace_settingsrun.h index 0e8db36..f8d2d3d 100644 --- a/src/cli/ace_settingsrun.h +++ b/src/cli/ace_settingsrun.h @@ -36,6 +36,7 @@ namespace Ace void setChunkPre(); void setChunkExt(); void setLogging(); + void setLogPort(); void list(); void listCUDA(); void listOpenCL(); diff --git a/src/core/ace_settings.h b/src/core/ace_settings.h index d7edaaa..113f847 100644 --- a/src/core/ace_settings.h +++ b/src/core/ace_settings.h @@ -94,7 +94,7 @@ namespace Ace /*! * The default CUDA device index value. */ - constexpr static int _cudaDeviceDefault {0}; + constexpr static int _cudaDeviceDefault {-1}; /*! * The default OpenCL platform index value. */