Mercurial > hg > orthanc
annotate OrthancFramework/Sources/OrthancFramework.cpp @ 4188:a2f1c97002fe
removed bad include for win32
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 14 Sep 2020 20:34:47 +0200 |
parents | bf7b9edf6b81 |
children | d9473bd5ed43 |
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 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * 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
|
8 * 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
|
9 * 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
|
10 * the License, or (at your option) any later version. |
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * 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
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * 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
|
15 * Lesser General Public License for more details. |
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
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 * 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
|
18 * 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
|
19 * <http://www.gnu.org/licenses/>. |
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 **/ |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
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 #include "PrecompiledHeaders.h" |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "OrthancFramework.h" |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #if !defined(ORTHANC_ENABLE_CURL) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 # error Macro ORTHANC_ENABLE_CURL must be defined |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 #if !defined(ORTHANC_ENABLE_SSL) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 # error Macro ORTHANC_ENABLE_SSL must be defined |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 #if !defined(ORTHANC_ENABLE_DCMTK) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 # error Macro ORTHANC_ENABLE_DCMTK must be defined |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 #if !defined(ORTHANC_ENABLE_DCMTK_NETWORKING) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 # error Macro ORTHANC_ENABLE_DCMTK_NETWORKING must be defined |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 #if ORTHANC_ENABLE_CURL == 1 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 # include "HttpClient.h" |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 #if ORTHANC_ENABLE_DCMTK == 1 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 # include "DicomParsing/FromDcmtkBridge.h" |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 # if ORTHANC_ENABLE_DCMTK_NETWORKING == 1 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 # include <dcmtk/dcmnet/dul.h> |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 # endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 #include "Logging.h" |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 #include "Toolbox.h" |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 namespace Orthanc |
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 void InitializeFramework(const std::string& locale, |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 bool loadPrivateDictionary) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 { |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 Logging::Initialize(); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 |
4030
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4029
diff
changeset
|
64 #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
|
65 if (locale.empty()) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 { |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 Toolbox::InitializeGlobalLocale(NULL); |
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 else |
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 Toolbox::InitializeGlobalLocale(locale.c_str()); |
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 #endif |
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 Toolbox::InitializeOpenSsl(); |
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 #if ORTHANC_ENABLE_CURL == 1 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 HttpClient::GlobalInitialize(); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 #if ORTHANC_ENABLE_DCMTK == 1 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 FromDcmtkBridge::InitializeDictionary(true); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 FromDcmtkBridge::InitializeCodecs(); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 #if (ORTHANC_ENABLE_DCMTK == 1 && \ |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 ORTHANC_ENABLE_DCMTK_NETWORKING == 1) |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 /* 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
|
89 dcmDisableGethostbyaddr.set(OFTrue); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 } |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 |
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 void FinalizeFramework() |
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 #if ORTHANC_ENABLE_DCMTK == 1 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 FromDcmtkBridge::FinalizeCodecs(); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 #if ORTHANC_ENABLE_CURL == 1 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 HttpClient::GlobalFinalize(); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 #endif |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 Toolbox::FinalizeOpenSsl(); |
4030
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4029
diff
changeset
|
105 |
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4029
diff
changeset
|
106 #if (ORTHANC_ENABLE_LOCALE == 1) && !defined(__EMSCRIPTEN__) |
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 Toolbox::FinalizeGlobalLocale(); |
4030
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4029
diff
changeset
|
108 #endif |
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4029
diff
changeset
|
109 |
4029
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 Logging::Finalize(); |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 } |
156fece692e3
missing OrthancFramework.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 } |