Mercurial > hg > orthanc
diff Plugins/Engine/OrthancPlugins.cpp @ 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 | a843ee8bb903 |
children | 40725595aaf0 |
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp Fri Nov 28 12:39:22 2014 +0100 +++ b/Plugins/Engine/OrthancPlugins.cpp Thu Dec 04 17:04:40 2014 +0100 @@ -172,10 +172,13 @@ struct OrthancPlugins::PImpl { + typedef std::pair<std::string, _OrthancPluginProperty> Property; + typedef std::pair<boost::regex*, OrthancPluginRestCallback> RestCallback; typedef std::list<RestCallback> RestCallbacks; typedef std::list<OrthancPluginOnStoredInstanceCallback> OnStoredCallbacks; typedef std::list<OrthancPluginOnChangeCallback> OnChangeCallbacks; + typedef std::map<Property, std::string> Properties; ServerContext& context_; RestCallbacks restCallbacks_; @@ -188,6 +191,7 @@ SharedMessageQueue pendingChanges_; boost::thread changeThread_; bool done_; + Properties properties_; PImpl(ServerContext& context) : context_(context), @@ -1022,6 +1026,14 @@ return true; } + case _OrthancPluginService_SetProperty: + { + const _OrthancPluginSetProperty& p = + *reinterpret_cast<const _OrthancPluginSetProperty*>(parameters); + pimpl_->properties_[std::make_pair(p.plugin, p.property)] = p.value; + return true; + } + default: return false; } @@ -1137,4 +1149,22 @@ return new PluginStorageArea(pimpl_->storageArea_);; } + + + + const char* OrthancPlugins::GetProperty(const char* plugin, + _OrthancPluginProperty property) const + { + PImpl::Property p = std::make_pair(plugin, property); + PImpl::Properties::const_iterator it = pimpl_->properties_.find(p); + + if (it == pimpl_->properties_.end()) + { + return NULL; + } + else + { + return it->second.c_str(); + } + } }