diff Plugins/Engine/OrthancPlugins.cpp @ 1771:8790488ae98b

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 10 Nov 2015 17:18:42 +0100
parents 70f544f9c38f
children 94990da8710e
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;
     }