Mercurial > hg > orthanc
annotate OrthancServer/Plugins/Engine/PluginsManager.cpp @ 5853:4d932683049d get-scu tip
very first implementation of C-Get SCU
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 29 Oct 2024 17:25:49 +0100 |
parents | e4d9a872998f |
children |
rev | line source |
---|---|
887 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1272
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:
5627
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:
5627
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 |
887 | 8 * |
9 * This program is free software: you can redistribute it and/or | |
10 * modify it under the terms of the GNU General Public License as | |
11 * published by the Free Software Foundation, either version 3 of the | |
12 * License, or (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, but | |
15 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 * General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 **/ | |
22 | |
23 | |
4045 | 24 #include "../../Sources/PrecompiledHeadersServer.h" |
887 | 25 #include "PluginsManager.h" |
26 | |
2136
dd609a99d39a
uniformization of the macro naming
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1983
diff
changeset
|
27 #if ORTHANC_ENABLE_PLUGINS != 1 |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
28 #error The plugin support is disabled |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
29 #endif |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
30 |
4045 | 31 #include "../../../OrthancFramework/Sources/HttpServer/HttpOutput.h" |
32 #include "../../../OrthancFramework/Sources/Logging.h" | |
33 #include "../../../OrthancFramework/Sources/OrthancException.h" | |
34 #include "../../../OrthancFramework/Sources/Toolbox.h" | |
894 | 35 |
887 | 36 #include <cassert> |
37 #include <memory> | |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
38 #include <boost/filesystem.hpp> |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
39 |
5660
e4d9a872998f
replaced incorrect macro WIN32 by _WIN32
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
40 #ifdef _WIN32 |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
41 #define PLUGIN_EXTENSION ".dll" |
2364 | 42 #elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__OpenBSD__) |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
43 #define PLUGIN_EXTENSION ".so" |
1026 | 44 #elif defined(__APPLE__) && defined(__MACH__) |
45 #define PLUGIN_EXTENSION ".dylib" | |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
46 #else |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
47 #error Support your platform here |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
48 #endif |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
49 |
887 | 50 |
51 namespace Orthanc | |
52 { | |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
53 PluginsManager::Plugin::Plugin(PluginsManager& pluginManager, |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
54 const std::string& path) : |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
55 library_(path), |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
56 pluginManager_(pluginManager) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
57 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
58 memset(&context_, 0, sizeof(context_)); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
59 context_.pluginsManager = this; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
60 context_.orthancVersion = ORTHANC_VERSION; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
61 context_.Free = ::free; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
62 context_.InvokeService = InvokeService; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
63 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
64 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
65 |
887 | 66 static void CallInitialize(SharedLibrary& plugin, |
67 const OrthancPluginContext& context) | |
68 { | |
69 typedef int32_t (*Initialize) (const OrthancPluginContext*); | |
70 | |
893
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
71 #if defined(_WIN32) |
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
72 Initialize initialize = (Initialize) plugin.GetFunction("OrthancPluginInitialize"); |
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
73 #else |
887 | 74 /** |
75 * gcc would complain about "ISO C++ forbids casting between | |
76 * pointer-to-function and pointer-to-object" without the trick | |
77 * below, that is known as "the POSIX.1-2003 (Technical Corrigendum | |
78 * 1) workaround". See the man page of "dlsym()". | |
79 * http://www.trilithium.com/johan/2004/12/problem-with-dlsym/ | |
80 * http://stackoverflow.com/a/14543811/881731 | |
81 **/ | |
82 | |
83 Initialize initialize; | |
84 *(void **) (&initialize) = plugin.GetFunction("OrthancPluginInitialize"); | |
893
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
85 #endif |
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
86 |
887 | 87 assert(initialize != NULL); |
88 int32_t error = initialize(&context); | |
89 | |
90 if (error != 0) | |
91 { | |
92 LOG(ERROR) << "Error while initializing plugin " << plugin.GetPath() | |
93 << " (code " << error << ")"; | |
94 throw OrthancException(ErrorCode_SharedLibrary); | |
95 } | |
96 } | |
97 | |
98 | |
99 static void CallFinalize(SharedLibrary& plugin) | |
100 { | |
101 typedef void (*Finalize) (); | |
102 | |
893
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
103 #if defined(_WIN32) |
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
104 Finalize finalize = (Finalize) plugin.GetFunction("OrthancPluginFinalize"); |
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
105 #else |
887 | 106 Finalize finalize; |
107 *(void **) (&finalize) = plugin.GetFunction("OrthancPluginFinalize"); | |
893
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
108 #endif |
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
109 |
887 | 110 assert(finalize != NULL); |
111 finalize(); | |
112 } | |
113 | |
114 | |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
115 static const char* CallGetName(SharedLibrary& plugin) |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
116 { |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
117 typedef const char* (*GetName) (); |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
118 |
893
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
119 #if defined(_WIN32) |
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
120 GetName getName = (GetName) plugin.GetFunction("OrthancPluginGetName"); |
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
121 #else |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
122 GetName getName; |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
123 *(void **) (&getName) = plugin.GetFunction("OrthancPluginGetName"); |
893
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
124 #endif |
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
125 |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
126 assert(getName != NULL); |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
127 return getName(); |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
128 } |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
129 |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
130 |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
131 static const char* CallGetVersion(SharedLibrary& plugin) |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
132 { |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
133 typedef const char* (*GetVersion) (); |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
134 |
893
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
135 #if defined(_WIN32) |
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
136 GetVersion getVersion = (GetVersion) plugin.GetFunction("OrthancPluginGetVersion"); |
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
137 #else |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
138 GetVersion getVersion; |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
139 *(void **) (&getVersion) = plugin.GetFunction("OrthancPluginGetVersion"); |
893
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
140 #endif |
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
141 |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
142 assert(getVersion != NULL); |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
143 return getVersion(); |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
144 } |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
145 |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
146 |
1581
357c4bb15701
Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
147 OrthancPluginErrorCode PluginsManager::InvokeService(OrthancPluginContext* context, |
357c4bb15701
Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
148 _OrthancPluginService service, |
357c4bb15701
Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
149 const void* params) |
887 | 150 { |
898
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
151 switch (service) |
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
152 { |
907 | 153 case _OrthancPluginService_LogError: |
899 | 154 LOG(ERROR) << reinterpret_cast<const char*>(params); |
1581
357c4bb15701
Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
155 return OrthancPluginErrorCode_Success; |
898
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
156 |
907 | 157 case _OrthancPluginService_LogWarning: |
899 | 158 LOG(WARNING) << reinterpret_cast<const char*>(params); |
1581
357c4bb15701
Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
159 return OrthancPluginErrorCode_Success; |
898
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
160 |
907 | 161 case _OrthancPluginService_LogInfo: |
4365
3150306fb4ad
fix missing log category in _OrthancPluginService_LogInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4271
diff
changeset
|
162 CLOG(INFO, PLUGINS) << reinterpret_cast<const char*>(params); |
1581
357c4bb15701
Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
163 return OrthancPluginErrorCode_Success; |
898
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
164 |
5561
0b18690c1935
SDK: added OrthancPluginLogMessage to display plugin name + file and line from plugin
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
165 case _OrthancPluginService_LogMessage: |
5571
addccb1590d2
simplifying Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5561
diff
changeset
|
166 { |
addccb1590d2
simplifying Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5561
diff
changeset
|
167 const _OrthancPluginLogMessage& m = *reinterpret_cast<const _OrthancPluginLogMessage*>(params); |
addccb1590d2
simplifying Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5561
diff
changeset
|
168 // We can convert directly from OrthancPluginLogLevel to LogLevel (and category) because the enum values must be identical |
addccb1590d2
simplifying Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5561
diff
changeset
|
169 // for Orthanc::Logging to work both in the core and in the plugins |
addccb1590d2
simplifying Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5561
diff
changeset
|
170 Orthanc::Logging::LogLevel level = static_cast<Orthanc::Logging::LogLevel>(m.level); |
addccb1590d2
simplifying Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5561
diff
changeset
|
171 Orthanc::Logging::LogCategory category = static_cast<Orthanc::Logging::LogCategory>(m.category); |
5561
0b18690c1935
SDK: added OrthancPluginLogMessage to display plugin name + file and line from plugin
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
172 |
5571
addccb1590d2
simplifying Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5561
diff
changeset
|
173 LOG_FROM_PLUGIN(level, category, m.plugin, m.file, m.line) << m.message; |
addccb1590d2
simplifying Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5561
diff
changeset
|
174 return OrthancPluginErrorCode_Success; |
addccb1590d2
simplifying Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5561
diff
changeset
|
175 } |
5561
0b18690c1935
SDK: added OrthancPluginLogMessage to display plugin name + file and line from plugin
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
176 |
898
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
177 default: |
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
178 break; |
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
179 } |
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
180 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
181 Plugin* that = reinterpret_cast<Plugin*>(context->pluginsManager); |
898
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
182 |
899 | 183 for (std::list<IPluginServiceProvider*>::iterator |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
184 it = that->GetPluginManager().serviceProviders_.begin(); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
185 it != that->GetPluginManager().serviceProviders_.end(); ++it) |
898
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
186 { |
899 | 187 try |
188 { | |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
189 if ((*it)->InvokeService(that->GetSharedLibrary(), service, params)) |
899 | 190 { |
1581
357c4bb15701
Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
191 return OrthancPluginErrorCode_Success; |
899 | 192 } |
193 } | |
1581
357c4bb15701
Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
194 catch (OrthancException& e) |
899 | 195 { |
1581
357c4bb15701
Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
196 // This service provider has failed |
1983 | 197 if (e.GetErrorCode() != ErrorCode_UnknownResource) // This error code is valid in plugins |
198 { | |
5100
9d51c000e91a
more verbose HTTPClient errors + avoid duplicate logging of same error
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
199 if (!e.HasBeenLogged()) |
9d51c000e91a
more verbose HTTPClient errors + avoid duplicate logging of same error
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
200 { |
9d51c000e91a
more verbose HTTPClient errors + avoid duplicate logging of same error
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
201 LOG(ERROR) << "Exception while invoking plugin service " << service << ": " << e.What(); |
9d51c000e91a
more verbose HTTPClient errors + avoid duplicate logging of same error
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
202 } |
1983 | 203 } |
204 | |
1581
357c4bb15701
Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
205 return static_cast<OrthancPluginErrorCode>(e.GetErrorCode()); |
899 | 206 } |
898
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
207 } |
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
208 |
1581
357c4bb15701
Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
209 LOG(ERROR) << "Plugin invoking unknown service: " << service; |
357c4bb15701
Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
210 return OrthancPluginErrorCode_UnknownPluginService; |
887 | 211 } |
212 | |
213 | |
899 | 214 PluginsManager::PluginsManager() |
887 | 215 { |
216 } | |
217 | |
218 PluginsManager::~PluginsManager() | |
219 { | |
944
c068671d12a9
fixes thanks to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
907
diff
changeset
|
220 for (Plugins::iterator it = plugins_.begin(); it != plugins_.end(); ++it) |
887 | 221 { |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
222 if (it->second != NULL) |
887 | 223 { |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
224 LOG(WARNING) << "Unregistering plugin '" << it->first |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
225 << "' (version " << it->second->GetVersion() << ")"; |
893
f57802f8b4dc
plugins for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
889
diff
changeset
|
226 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
227 CallFinalize(it->second->GetSharedLibrary()); |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
228 delete it->second; |
887 | 229 } |
230 } | |
231 } | |
232 | |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
233 |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
234 static bool IsOrthancPlugin(SharedLibrary& library) |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
235 { |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
236 return (library.HasFunction("OrthancPluginInitialize") && |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
237 library.HasFunction("OrthancPluginFinalize") && |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
238 library.HasFunction("OrthancPluginGetName") && |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
239 library.HasFunction("OrthancPluginGetVersion")); |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
240 } |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
241 |
887 | 242 |
243 void PluginsManager::RegisterPlugin(const std::string& path) | |
244 { | |
1272
7442097b41c9
Scan of folders for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
245 if (!boost::filesystem::exists(path)) |
7442097b41c9
Scan of folders for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
246 { |
7442097b41c9
Scan of folders for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
247 LOG(ERROR) << "Inexistent path to plugins: " << path; |
7442097b41c9
Scan of folders for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
248 return; |
7442097b41c9
Scan of folders for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
249 } |
7442097b41c9
Scan of folders for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
250 |
7442097b41c9
Scan of folders for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
251 if (boost::filesystem::is_directory(path)) |
7442097b41c9
Scan of folders for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
252 { |
7442097b41c9
Scan of folders for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
253 ScanFolderForPlugins(path, false); |
7442097b41c9
Scan of folders for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
254 return; |
7442097b41c9
Scan of folders for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
255 } |
7442097b41c9
Scan of folders for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
256 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
257 std::unique_ptr<Plugin> plugin(new Plugin(*this, path)); |
887 | 258 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
259 if (!IsOrthancPlugin(plugin->GetSharedLibrary())) |
887 | 260 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
261 LOG(ERROR) << "Plugin " << plugin->GetSharedLibrary().GetPath() |
887 | 262 << " does not declare the proper entry functions"; |
263 throw OrthancException(ErrorCode_SharedLibrary); | |
264 } | |
265 | |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
266 std::string name(CallGetName(plugin->GetSharedLibrary())); |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
267 if (plugins_.find(name) != plugins_.end()) |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
268 { |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
269 LOG(ERROR) << "Plugin '" << name << "' already registered"; |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
270 throw OrthancException(ErrorCode_SharedLibrary); |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
271 } |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
272 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
273 plugin->SetVersion(CallGetVersion(plugin->GetSharedLibrary())); |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
274 LOG(WARNING) << "Registering plugin '" << name |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
275 << "' (version " << plugin->GetVersion() << ")"; |
887 | 276 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
277 CallInitialize(plugin->GetSharedLibrary(), plugin->GetContext()); |
887 | 278 |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
279 plugins_[name] = plugin.release(); |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
280 } |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
281 |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
282 |
889 | 283 void PluginsManager::ScanFolderForPlugins(const std::string& folder, |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
284 bool isRecursive) |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
285 { |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
286 using namespace boost::filesystem; |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
287 |
889 | 288 if (!exists(folder)) |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
289 { |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
290 return; |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
291 } |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
292 |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
293 CLOG(INFO, PLUGINS) << "Scanning folder " << folder << " for plugins"; |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
294 |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
295 directory_iterator end_it; // default construction yields past-the-end |
889 | 296 for (directory_iterator it(folder); |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
297 it != end_it; |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
298 ++it) |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
299 { |
889 | 300 std::string path = it->path().string(); |
301 | |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
302 if (is_directory(it->status())) |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
303 { |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
304 if (isRecursive) |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
305 { |
889 | 306 ScanFolderForPlugins(path, true); |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
307 } |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
308 } |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
309 else |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
310 { |
5627
a7c88563c8cc
fix build with boost 1.85.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5571
diff
changeset
|
311 std::string extension = it->path().extension().string(); |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
312 Toolbox::ToLowerCase(extension); |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
313 |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
314 if (extension == PLUGIN_EXTENSION) |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
315 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
316 CLOG(INFO, PLUGINS) << "Found a shared library: " << it->path(); |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
317 |
1297 | 318 SharedLibrary plugin(path); |
319 if (IsOrthancPlugin(plugin)) | |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
320 { |
1297 | 321 RegisterPlugin(path); |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
322 } |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
323 } |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
324 } |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
887
diff
changeset
|
325 } |
887 | 326 } |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
327 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
328 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
329 void PluginsManager::ListPlugins(std::list<std::string>& result) const |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
330 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
331 result.clear(); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
332 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
333 for (Plugins::const_iterator it = plugins_.begin(); |
1304 | 334 it != plugins_.end(); ++it) |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
335 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
336 result.push_back(it->first); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
337 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
338 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
339 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
340 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
341 bool PluginsManager::HasPlugin(const std::string& name) const |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
342 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
343 return plugins_.find(name) != plugins_.end(); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
344 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
345 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
346 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
347 const std::string& PluginsManager::GetPluginVersion(const std::string& name) const |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
348 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
349 Plugins::const_iterator it = plugins_.find(name); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
350 if (it == plugins_.end()) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
351 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
352 throw OrthancException(ErrorCode_ParameterOutOfRange); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
353 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
354 else |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
355 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
356 return it->second->GetVersion(); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
357 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1200
diff
changeset
|
358 } |
1644
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
359 |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
360 |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
361 std::string PluginsManager::GetPluginName(SharedLibrary& library) |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
362 { |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
363 return CallGetName(library); |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
364 } |
887 | 365 } |