annotate OrthancFramework/Sources/OrthancFramework.cpp @ 5644:343149762476

fix build with DCMTK <= 3.6.6
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 31 May 2024 18:23:44 +0200
parents f7adfb22e20e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4029
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4029
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * This program is free software: you can redistribute it and/or
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
10 * modify it under the terms of the GNU Lesser General Public License
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
11 * as published by the Free Software Foundation, either version 3 of
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
12 * the License, or (at your option) any later version.
4029
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 *
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful, but
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
17 * Lesser General Public License for more details.
4029
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
20 * License along with this program. If not, see
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
21 * <http://www.gnu.org/licenses/>.
4029
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 **/
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "PrecompiledHeaders.h"
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "OrthancFramework.h"
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #if !defined(ORTHANC_ENABLE_CURL)
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 # error Macro ORTHANC_ENABLE_CURL must be defined
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 #endif
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #if !defined(ORTHANC_ENABLE_SSL)
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 # error Macro ORTHANC_ENABLE_SSL must be defined
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #endif
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #if !defined(ORTHANC_ENABLE_DCMTK)
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 # error Macro ORTHANC_ENABLE_DCMTK must be defined
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 #endif
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 #if !defined(ORTHANC_ENABLE_DCMTK_NETWORKING)
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 # error Macro ORTHANC_ENABLE_DCMTK_NETWORKING must be defined
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 #endif
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 #if ORTHANC_ENABLE_CURL == 1
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 # include "HttpClient.h"
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 #endif
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 #if ORTHANC_ENABLE_DCMTK == 1
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 # include "DicomParsing/FromDcmtkBridge.h"
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 # if ORTHANC_ENABLE_DCMTK_NETWORKING == 1
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 # include <dcmtk/dcmnet/dul.h>
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 # endif
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 #endif
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 #include "Logging.h"
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 #include "Toolbox.h"
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 namespace Orthanc
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 {
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 void InitializeFramework(const std::string& locale,
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 bool loadPrivateDictionary)
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 {
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 Logging::Initialize();
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
4030
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4029
diff changeset
66 #if (ORTHANC_ENABLE_LOCALE == 1) && !defined(__EMSCRIPTEN__) // No global locale in wasm/asm.js
4029
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 if (locale.empty())
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 {
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 Toolbox::InitializeGlobalLocale(NULL);
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 }
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 else
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 {
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 Toolbox::InitializeGlobalLocale(locale.c_str());
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 }
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 #endif
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 Toolbox::InitializeOpenSsl();
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 #if ORTHANC_ENABLE_CURL == 1
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 HttpClient::GlobalInitialize();
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 #endif
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 #if ORTHANC_ENABLE_DCMTK == 1
4696
dd6274412ff4 new configuration option "ExternalDictionaries" to load external DICOM dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
84 FromDcmtkBridge::InitializeDictionary(loadPrivateDictionary);
4029
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 FromDcmtkBridge::InitializeCodecs();
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 #endif
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 #if (ORTHANC_ENABLE_DCMTK == 1 && \
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 ORTHANC_ENABLE_DCMTK_NETWORKING == 1)
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 /* Disable "gethostbyaddr" (which results in memory leaks) and use raw IP addresses */
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 dcmDisableGethostbyaddr.set(OFTrue);
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 #endif
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 }
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 void FinalizeFramework()
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 {
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 #if ORTHANC_ENABLE_DCMTK == 1
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 FromDcmtkBridge::FinalizeCodecs();
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 #endif
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 #if ORTHANC_ENABLE_CURL == 1
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 HttpClient::GlobalFinalize();
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 #endif
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 Toolbox::FinalizeOpenSsl();
4030
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4029
diff changeset
107
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4029
diff changeset
108 #if (ORTHANC_ENABLE_LOCALE == 1) && !defined(__EMSCRIPTEN__)
4029
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 Toolbox::FinalizeGlobalLocale();
4030
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4029
diff changeset
110 #endif
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4029
diff changeset
111
4029
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 Logging::Finalize();
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 }
156fece692e3 missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 }