Mercurial > hg > orthanc
changeset 1771:8790488ae98b
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Nov 2015 17:18:42 +0100 |
parents | 6473e4e22d44 |
children | 53e045b5a8ec |
files | Plugins/Engine/OrthancPlugins.cpp Plugins/Engine/OrthancPlugins.h |
diffstat | 2 files changed, 21 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp Tue Nov 10 16:59:17 2015 +0100 +++ b/Plugins/Engine/OrthancPlugins.cpp Tue Nov 10 17:18:42 2015 +0100 @@ -1281,6 +1281,23 @@ } + void OrthancPlugins::DatabaseAnswer(const void* parameters) + { + const _OrthancPluginDatabaseAnswer& p = + *reinterpret_cast<const _OrthancPluginDatabaseAnswer*>(parameters); + + if (pimpl_->database_.get() != NULL) + { + pimpl_->database_->AnswerReceived(p); + } + else + { + LOG(ERROR) << "Cannot invoke this service without a custom database back-end"; + throw OrthancException(ErrorCode_BadRequest); + } + } + + bool OrthancPlugins::InvokeService(SharedLibrary& plugin, _OrthancPluginService service, const void* parameters) @@ -1295,20 +1312,8 @@ // index. The problem was that locking the database is already // ensured by the "ServerIndex" class if the invoked service is // "DatabaseAnswer". - - const _OrthancPluginDatabaseAnswer& p = - *reinterpret_cast<const _OrthancPluginDatabaseAnswer*>(parameters); - - if (pimpl_->database_.get() != NULL) - { - pimpl_->database_->AnswerReceived(p); - return true; - } - else - { - LOG(ERROR) << "Cannot invoke this service without a custom database back-end"; - throw OrthancException(ErrorCode_BadRequest); - } + DatabaseAnswer(parameters); + return true; }
--- a/Plugins/Engine/OrthancPlugins.h Tue Nov 10 16:59:17 2015 +0100 +++ b/Plugins/Engine/OrthancPlugins.h Tue Nov 10 17:18:42 2015 +0100 @@ -127,6 +127,8 @@ void DrawText(const void* parameters); + void DatabaseAnswer(const void* parameters); + void ApplyDicomToJson(_OrthancPluginService service, const void* parameters);