changeset 1387:4ebf246f3919

Fixed big mistake (factoring the option parsing, which only adds noise to the people reading the code)
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 27 Apr 2020 16:49:03 +0200
parents dfb48f0794b1
children 240531afdd2d
files Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp
diffstat 1 files changed, 13 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp	Mon Apr 27 16:48:19 2020 +0200
+++ b/Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp	Mon Apr 27 16:49:03 2020 +0200
@@ -1,13 +1,7 @@
 
 #include "SdlSimpleViewerApplication.h"
-
-#include <string>
-
-#include <boost/program_options.hpp>
-
-#include <SDL.h>
-
-#include <Core/OrthancException.h>
+#include "../SdlHelpers.h"
+#include "../../Common/SampleHelpers.h"
 
 #include <Framework/Loaders/GenericLoadersContext.h>
 #include <Framework/StoneException.h>
@@ -15,20 +9,26 @@
 #include <Framework/StoneInitialization.h>
 #include <Framework/Viewport/SdlViewport.h>
 
-#include "../SdlHelpers.h"
-#include "../../Common/SampleHelpers.h"
+#include <Core/OrthancException.h>
+
+#include <boost/program_options.hpp>
+#include <SDL.h>
+
+#include <string>
+
 
 std::string orthancUrl;
 std::string instanceId;
 int frameIndex = 0;
 
+
 static void ProcessOptions(int argc, char* argv[])
 {
   namespace po = boost::program_options;
   po::options_description desc("Usage:");
 
   desc.add_options()
-    ("log_level", po::value<std::string>()->default_value("WARNING"),
+    ("loglevel", po::value<std::string>()->default_value("WARNING"),
      "You can choose WARNING, INFO or TRACE for the logging level: Errors and warnings will always be displayed. (default: WARNING)")
 
     ("orthanc", po::value<std::string>()->default_value("http://localhost:8042"),
@@ -52,9 +52,9 @@
     std::cerr << "Please check your command line options! (\"" << e.what() << "\")" << std::endl;
   }
 
-  if (vm.count("log_level") > 0)
+  if (vm.count("loglevel") > 0)
   {
-    std::string logLevel = vm["log_level"].as<std::string>();
+    std::string logLevel = vm["loglevel"].as<std::string>();
     OrthancStoneHelpers::SetLogLevel(logLevel);
   }
 
@@ -76,11 +76,6 @@
 
 }
 
-extern void f()
-{
-  std::cout << "f()" << std::endl;
-}
-
 /**
  * IMPORTANT: The full arguments to "main()" are needed for SDL on
  * Windows. Otherwise, one gets the linking error "undefined reference
@@ -88,8 +83,6 @@
  **/
 int main(int argc, char* argv[])
 {
-  f();
-
   try
   {
     OrthancStone::StoneInitialize();