diff OrthancServer/OrthancInitialization.cpp @ 2069:fabf7820d1f1

New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 13 Jul 2016 16:52:39 +0200
parents fefbe71c2272
children 27fd34970c52
line wrap: on
line diff
--- a/OrthancServer/OrthancInitialization.cpp	Wed Jul 13 16:10:25 2016 +0200
+++ b/OrthancServer/OrthancInitialization.cpp	Wed Jul 13 16:52:39 2016 +0200
@@ -577,6 +577,23 @@
   }
 
 
+  unsigned int Configuration::GetGlobalUnsignedIntegerParameter(const std::string& parameter,
+                                                                unsigned int defaultValue)
+  {
+    int v = GetGlobalIntegerParameter(parameter, defaultValue);
+
+    if (v < 0)
+    {
+      LOG(ERROR) << "The configuration option \"" << parameter << "\" must be a positive integer";
+      throw OrthancException(ErrorCode_BadParameterType);
+    }
+    else
+    {
+      return static_cast<unsigned int>(v);
+    }
+  }
+
+
   bool Configuration::GetGlobalBoolParameter(const std::string& parameter,
                                              bool defaultValue)
   {