annotate Applications/Samples/Common/SampleHelpers.h @ 1577:e8a120dd05bd

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 24 Sep 2020 16:51:14 +0200
parents d1806b4e4839
children 4fb8fdf03314
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1458
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
1 /**
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
2 * Stone of Orthanc
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
4 * Department, University Hospital of Liege, Belgium
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
6 *
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
7 * This program is free software: you can redistribute it and/or
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
10 * the License, or (at your option) any later version.
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
11 *
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
12 * This program is distributed in the hope that it will be useful, but
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
15 * Affero General Public License for more details.
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
16 *
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
19 **/
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
20
828a9b4ee1b7 added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1457
diff changeset
21
1382
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
22 #pragma once
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
23
1457
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1386
diff changeset
24 #include <Logging.h>
1386
dfb48f0794b1 Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents: 1383
diff changeset
25
dfb48f0794b1 Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents: 1383
diff changeset
26 #include <boost/algorithm/string.hpp>
dfb48f0794b1 Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents: 1383
diff changeset
27
1382
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
28 #include <string>
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
29 #include <iostream>
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
31 namespace OrthancStoneHelpers
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
32 {
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
33 inline void SetLogLevel(std::string logLevel)
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
34 {
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
35 boost::to_lower(logLevel);
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
36 if (logLevel == "warning")
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
37 {
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
38 Orthanc::Logging::EnableInfoLevel(false);
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
39 Orthanc::Logging::EnableTraceLevel(false);
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
40 }
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
41 else if (logLevel == "info")
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
42 {
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
43 Orthanc::Logging::EnableInfoLevel(true);
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
44 Orthanc::Logging::EnableTraceLevel(false);
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
45 }
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
46 else if (logLevel == "trace")
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
47 {
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
48 Orthanc::Logging::EnableInfoLevel(true);
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
49 Orthanc::Logging::EnableTraceLevel(true);
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
50 }
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
51 else
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
52 {
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
53 std::cerr << "Unknown log level \"" << logLevel << "\". Will use TRACE as default!";
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
54 Orthanc::Logging::EnableInfoLevel(true);
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
55 Orthanc::Logging::EnableTraceLevel(true);
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
56 }
9d138883be66 Proper command-line parameter management for SDL sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
57 }
1386
dfb48f0794b1 Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents: 1383
diff changeset
58 }