Mercurial > hg > orthanc
comparison Plugins/Engine/PluginsManager.h @ 899:bb0a51561016 plugins
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 18 Jun 2014 13:29:09 +0200 |
parents | 7000fc86fe62 |
children | 9b8298234254 |
comparison
equal
deleted
inserted
replaced
898:7000fc86fe62 | 899:bb0a51561016 |
---|---|
40 | 40 |
41 namespace Orthanc | 41 namespace Orthanc |
42 { | 42 { |
43 class PluginsManager : boost::noncopyable | 43 class PluginsManager : boost::noncopyable |
44 { | 44 { |
45 public: | |
46 typedef std::list< std::pair<std::string, OrthancPluginRestCallback> > RestCallbacks; | |
47 | |
48 private: | 45 private: |
49 typedef std::map<std::string, SharedLibrary*> Plugins; | 46 typedef std::map<std::string, SharedLibrary*> Plugins; |
50 | 47 |
51 OrthancPluginContext context_; | 48 OrthancPluginContext context_; |
52 Plugins plugins_; | 49 Plugins plugins_; |
53 RestCallbacks restCallbacks_; | 50 std::list<IPluginServiceProvider*> serviceProviders_; |
54 IPluginServiceProvider *serviceProvider_; | |
55 | 51 |
56 static int32_t InvokeService(OrthancPluginContext* context, | 52 static int32_t InvokeService(OrthancPluginContext* context, |
57 OrthancPluginService service, | 53 OrthancPluginService service, |
58 const void* parameters); | 54 const void* parameters); |
59 | |
60 static void RegisterRestCallback(const OrthancPluginContext* context, | |
61 const char* path, | |
62 OrthancPluginRestCallback callback); | |
63 | 55 |
64 public: | 56 public: |
65 PluginsManager(); | 57 PluginsManager(); |
66 | 58 |
67 ~PluginsManager(); | 59 ~PluginsManager(); |
69 void RegisterPlugin(const std::string& path); | 61 void RegisterPlugin(const std::string& path); |
70 | 62 |
71 void ScanFolderForPlugins(const std::string& path, | 63 void ScanFolderForPlugins(const std::string& path, |
72 bool isRecursive); | 64 bool isRecursive); |
73 | 65 |
74 void SetServiceProvider(IPluginServiceProvider& provider) | 66 void RegisterServiceProvider(IPluginServiceProvider& provider) |
75 { | 67 { |
76 serviceProvider_ = &provider; | 68 serviceProviders_.push_back(&provider); |
77 } | |
78 | |
79 bool HasServiceProvider() const | |
80 { | |
81 return serviceProvider_ != NULL; | |
82 } | |
83 | |
84 IPluginServiceProvider& GetServiceProvider() const; | |
85 | |
86 const RestCallbacks& GetRestCallbacks() const | |
87 { | |
88 return restCallbacks_; | |
89 } | 69 } |
90 }; | 70 }; |
91 } | 71 } |