浏览代码

Fix usage of ctkServiceReference instances.

Sascha Zelzer 14 年之前
父节点
当前提交
3e75f67f1b

+ 1 - 6
Plugins/org.commontk.dah.app/ctkDicomAppServerPrivate.cpp

@@ -85,12 +85,7 @@ void ctkDicomAppServerPrivate::incomingSoapMessage(
   if(appInterface == NULL)
   {
     ctkPluginContext* context = ctkDicomAppPlugin::getInstance()->getPluginContext();
-    ctkServiceReference* serviceRef = context->getServiceReference("ctkDicomAppInterface");
-    if (!serviceRef)
-    {
-      // this will change after merging changes from branch plugin_framework
-      throw std::runtime_error("No Dicom App Service found");
-    }
+    ctkServiceReference serviceRef = context->getServiceReference("ctkDicomAppInterface");
     appInterface = qobject_cast<ctkDicomAppInterface*>(context->getService(serviceRef));
     
     ctkAppSoapMessageProcessor* appProcessor = new ctkAppSoapMessageProcessor( appInterface );

+ 2 - 6
Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppLogic_p.h

@@ -24,6 +24,7 @@
 #define CTKEXAMPLEDICOMAPPLOGIC_P_H
 
 #include <ctkPluginActivator.h>
+#include <ctkServiceReference.h>
 #include <ctkDicomAppInterface.h>
 #include <ctkDicomHostInterface.h>
 #include <stdexcept>
@@ -36,12 +37,7 @@ public:
   }
   TServiceType* operator->()
   {
-    ctkServiceReference* serviceRef = context->getServiceReference(clazz);
-    if (!serviceRef)
-    {
-      // this will change after merging changes from branch plugin_framework
-      throw std::runtime_error("No Dicom Host Service found");
-    }
+    ctkServiceReference serviceRef = context->getServiceReference(clazz);
     return qobject_cast<TServiceType*>(context->getService(serviceRef));
   }
   TServiceType* operator*()