Mercurial > hg > orthanc
comparison Plugins/Engine/PluginsManager.h @ 898:7000fc86fe62 plugins
improved plugin api
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 18 Jun 2014 09:18:28 +0200 |
parents | bafc9d592632 |
children | bb0a51561016 |
comparison
equal
deleted
inserted
replaced
897:bafc9d592632 | 898:7000fc86fe62 |
---|---|
31 | 31 |
32 | 32 |
33 #pragma once | 33 #pragma once |
34 | 34 |
35 #include "SharedLibrary.h" | 35 #include "SharedLibrary.h" |
36 #include "../OrthancCPlugin/OrthancCPlugin.h" | 36 #include "IPluginServiceProvider.h" |
37 | 37 |
38 #include <map> | 38 #include <map> |
39 #include <list> | 39 #include <list> |
40 | 40 |
41 namespace Orthanc | 41 namespace Orthanc |
45 public: | 45 public: |
46 typedef std::list< std::pair<std::string, OrthancPluginRestCallback> > RestCallbacks; | 46 typedef std::list< std::pair<std::string, OrthancPluginRestCallback> > RestCallbacks; |
47 | 47 |
48 private: | 48 private: |
49 typedef std::map<std::string, SharedLibrary*> Plugins; | 49 typedef std::map<std::string, SharedLibrary*> Plugins; |
50 | |
50 OrthancPluginContext context_; | 51 OrthancPluginContext context_; |
51 Plugins plugins_; | 52 Plugins plugins_; |
52 RestCallbacks restCallbacks_; | 53 RestCallbacks restCallbacks_; |
54 IPluginServiceProvider *serviceProvider_; | |
55 | |
56 static int32_t InvokeService(OrthancPluginContext* context, | |
57 OrthancPluginService service, | |
58 const void* parameters); | |
53 | 59 |
54 static void RegisterRestCallback(const OrthancPluginContext* context, | 60 static void RegisterRestCallback(const OrthancPluginContext* context, |
55 const char* path, | 61 const char* path, |
56 OrthancPluginRestCallback callback); | 62 OrthancPluginRestCallback callback); |
57 | 63 |
63 void RegisterPlugin(const std::string& path); | 69 void RegisterPlugin(const std::string& path); |
64 | 70 |
65 void ScanFolderForPlugins(const std::string& path, | 71 void ScanFolderForPlugins(const std::string& path, |
66 bool isRecursive); | 72 bool isRecursive); |
67 | 73 |
74 void SetServiceProvider(IPluginServiceProvider& provider) | |
75 { | |
76 serviceProvider_ = &provider; | |
77 } | |
78 | |
79 bool HasServiceProvider() const | |
80 { | |
81 return serviceProvider_ != NULL; | |
82 } | |
83 | |
84 IPluginServiceProvider& GetServiceProvider() const; | |
85 | |
68 const RestCallbacks& GetRestCallbacks() const | 86 const RestCallbacks& GetRestCallbacks() const |
69 { | 87 { |
70 return restCallbacks_; | 88 return restCallbacks_; |
71 } | 89 } |
72 }; | 90 }; |