# HG changeset patch # User Sebastien Jodogne # Date 1447172322 -3600 # Node ID 8790488ae98b9b9ab3f55cb5671e8b25d75e3af8 # Parent 6473e4e22d44c3d248d4f0c1cb61aadc42c77734 refactoring diff -r 6473e4e22d44 -r 8790488ae98b Plugins/Engine/OrthancPlugins.cpp --- 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(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(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; } diff -r 6473e4e22d44 -r 8790488ae98b Plugins/Engine/OrthancPlugins.h --- 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);