annotate Plugins/Engine/PluginsManager.h @ 1055:6f923d52a46c

call Web services from Lua
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 24 Jul 2014 11:37:02 +0200
parents 9b8298234254
children f1c01451a8ee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
887
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Belgium
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #pragma once
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include "SharedLibrary.h"
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
36 #include "IPluginServiceProvider.h"
887
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
888
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 887
diff changeset
38 #include <map>
894
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
39 #include <list>
887
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 namespace Orthanc
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 class PluginsManager : boost::noncopyable
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 private:
888
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 887
diff changeset
46 typedef std::map<std::string, SharedLibrary*> Plugins;
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
47
887
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 OrthancPluginContext context_;
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 Plugins plugins_;
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
50 std::list<IPluginServiceProvider*> serviceProviders_;
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
51
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
52 static int32_t InvokeService(OrthancPluginContext* context,
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
53 _OrthancPluginService service,
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
54 const void* parameters);
894
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
55
887
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 public:
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 PluginsManager();
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 ~PluginsManager();
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 void RegisterPlugin(const std::string& path);
888
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 887
diff changeset
62
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 887
diff changeset
63 void ScanFolderForPlugins(const std::string& path,
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 887
diff changeset
64 bool isRecursive);
897
bafc9d592632 REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 896
diff changeset
65
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
66 void RegisterServiceProvider(IPluginServiceProvider& provider)
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
67 {
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
68 serviceProviders_.push_back(&provider);
897
bafc9d592632 REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 896
diff changeset
69 }
887
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 };
4066e6f2d134 PluginsManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 }