Mercurial > hg > orthanc-stone
annotate RenderingPlugin/Sources/Plugin.cpp @ 1877:a2955abe4c2e
skeleton for the RenderingPlugin
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 12 Jan 2022 08:23:38 +0100 |
parents | |
children | 4e80b8afd0da |
rev | line source |
---|---|
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * modify it under the terms of the GNU General Public License as |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * published by the Free Software Foundation, either version 3 of the |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * License, or (at your option) any later version. |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * General Public License for more details. |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 **/ |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h" |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include <EmbeddedResources.h> |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 #include <Logging.h> |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 extern "C" |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 { |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context) |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 { |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 OrthancPlugins::SetGlobalContext(context); |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 #if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 7, 2) |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 Orthanc::Logging::InitializePluginContext(context); |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 #else |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 Orthanc::Logging::Initialize(context); |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 #endif |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 /* Check the version of the Orthanc core */ |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 if (OrthancPluginCheckVersion(context) == 0) |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 { |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 char info[1024]; |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 sprintf(info, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin", |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 context->orthancVersion, |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER, |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 OrthancPluginLogError(context, info); |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 return -1; |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 } |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 try |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 { |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 } |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 catch (...) |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 { |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 OrthancPlugins::LogError("Exception while initializing the Stone Web viewer plugin"); |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 return -1; |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 } |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 return 0; |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 } |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 ORTHANC_PLUGINS_API void OrthancPluginFinalize() |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 { |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 } |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 ORTHANC_PLUGINS_API const char* OrthancPluginGetName() |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 { |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 return PLUGIN_NAME; |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 } |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion() |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 { |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 return PLUGIN_VERSION; |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 } |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 } |