diff Framework/Volumes/StructureSetLoader.h @ 300:b4abaeb783b1 am-callable-and-promise

messaging refactoring almost complete: works fine in native
author am@osimis.io
date Tue, 18 Sep 2018 15:23:21 +0200
parents 192e6e349e69
children ba4ace20454e
line wrap: on
line diff
--- a/Framework/Volumes/StructureSetLoader.h	Fri Sep 14 16:44:01 2018 +0200
+++ b/Framework/Volumes/StructureSetLoader.h	Tue Sep 18 15:23:21 2018 +0200
@@ -22,31 +22,22 @@
 #pragma once
 
 #include "../Toolbox/DicomStructureSet.h"
-#include "../Toolbox/IWebService.h"
+#include "../Toolbox/OrthancApiClient.h"
 #include "VolumeLoaderBase.h"
 
 namespace OrthancStone
 {
   class StructureSetLoader :
     public VolumeLoaderBase,
-    private IWebService::ICallback
+    public OrthancStone::IObserver
   {
   private:
-    class Operation;
-    
-    virtual void OnHttpRequestError(const std::string& uri,
-                             Orthanc::IDynamicObject* payload);
 
-    virtual void OnHttpRequestSuccess(const std::string& uri,
-                               const void* answer,
-                               size_t answerSize,
-                               Orthanc::IDynamicObject* payload);
-
-    IWebService&                      orthanc_;
+    OrthancApiClient&                      orthanc_;
     std::auto_ptr<DicomStructureSet>  structureSet_;
 
   public:
-    StructureSetLoader(MessageBroker& broker, IWebService& orthanc);
+    StructureSetLoader(MessageBroker& broker, OrthancApiClient& orthanc);
 
     void ScheduleLoadInstance(const std::string& instance);
 
@@ -56,5 +47,12 @@
     }
 
     DicomStructureSet& GetStructureSet();
+
+  protected:
+    void OnReferencedSliceLoaded(const OrthancApiClient::JsonResponseReadyMessage& message);
+
+    void OnStructureSetLoaded(const OrthancApiClient::JsonResponseReadyMessage& message);
+
+    void OnLookupCompleted(const OrthancApiClient::JsonResponseReadyMessage& message);
   };
 }