comparison Plugins/Engine/PluginsManager.h @ 1232:f1c01451a8ee

Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Dec 2014 17:04:40 +0100
parents 9b8298234254
children 6e7e5ed91c2d
comparison
equal deleted inserted replaced
1231:703fcd797186 1232:f1c01451a8ee
41 namespace Orthanc 41 namespace Orthanc
42 { 42 {
43 class PluginsManager : boost::noncopyable 43 class PluginsManager : boost::noncopyable
44 { 44 {
45 private: 45 private:
46 typedef std::map<std::string, SharedLibrary*> Plugins; 46 class Plugin
47 {
48 private:
49 SharedLibrary library_;
50 std::string version_;
51
52 public:
53 Plugin(const std::string& path) : library_(path)
54 {
55 }
56
57 SharedLibrary& GetLibrary()
58 {
59 return library_;
60 }
61
62 void SetVersion(const std::string& version)
63 {
64 version_ = version;
65 }
66
67 const std::string& GetVersion() const
68 {
69 return version_;
70 }
71 };
72
73 typedef std::map<std::string, Plugin*> Plugins;
47 74
48 OrthancPluginContext context_; 75 OrthancPluginContext context_;
49 Plugins plugins_; 76 Plugins plugins_;
50 std::list<IPluginServiceProvider*> serviceProviders_; 77 std::list<IPluginServiceProvider*> serviceProviders_;
51 78
65 92
66 void RegisterServiceProvider(IPluginServiceProvider& provider) 93 void RegisterServiceProvider(IPluginServiceProvider& provider)
67 { 94 {
68 serviceProviders_.push_back(&provider); 95 serviceProviders_.push_back(&provider);
69 } 96 }
97
98 void ListPlugins(std::list<std::string>& result) const;
99
100 bool HasPlugin(const std::string& name) const;
101
102 const std::string& GetPluginVersion(const std::string& name) const;
70 }; 103 };
71 } 104 }