diff Applications/Samples/SingleFrameEditorApplication.h @ 377:8eb4fe74000f

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 05 Nov 2018 16:18:27 +0100
parents 70256a53ff21
children d20d75f20c5d
line wrap: on
line diff
--- a/Applications/Samples/SingleFrameEditorApplication.h	Mon Nov 05 13:25:03 2018 +0100
+++ b/Applications/Samples/SingleFrameEditorApplication.h	Mon Nov 05 16:18:27 2018 +0100
@@ -1164,17 +1164,17 @@
     
     void OnTagsReceived(const OrthancApiClient::BinaryResponseReadyMessage& message)
     {
-      size_t index = dynamic_cast<Orthanc::SingleValueObject<size_t>*>(message.Payload.get())->GetValue();
-
-      LOG(INFO) << "JSON received: " << message.Uri.c_str()
-                << " (" << message.AnswerSize << " bytes) for bitmap " << index;
+      size_t index = dynamic_cast<const Orthanc::SingleValueObject<size_t>&>(message.GetPayload()).GetValue();
+
+      LOG(INFO) << "JSON received: " << message.GetUri().c_str()
+                << " (" << message.GetAnswerSize() << " bytes) for bitmap " << index;
       
       Bitmaps::iterator bitmap = bitmaps_.find(index);
       if (bitmap != bitmaps_.end())
       {
         assert(bitmap->second != NULL);
         
-        OrthancPlugins::FullOrthancDataset dicom(message.Answer, message.AnswerSize);
+        OrthancPlugins::FullOrthancDataset dicom(message.GetAnswer(), message.GetAnswerSize());
         dynamic_cast<DicomBitmap*>(bitmap->second)->SetDicomTags(dicom);
 
         float c, w;
@@ -1193,10 +1193,10 @@
 
     void OnFrameReceived(const OrthancApiClient::BinaryResponseReadyMessage& message)
     {
-      size_t index = dynamic_cast<Orthanc::SingleValueObject<size_t>*>(message.Payload.get())->GetValue();
+      size_t index = dynamic_cast<const Orthanc::SingleValueObject<size_t>&>(message.GetPayload()).GetValue();
       
-      LOG(INFO) << "DICOM frame received: " << message.Uri.c_str()
-                << " (" << message.AnswerSize << " bytes) for bitmap " << index;
+      LOG(INFO) << "DICOM frame received: " << message.GetUri().c_str()
+                << " (" << message.GetAnswerSize() << " bytes) for bitmap " << index;
       
       Bitmaps::iterator bitmap = bitmaps_.find(index);
       if (bitmap != bitmaps_.end())
@@ -1204,9 +1204,9 @@
         assert(bitmap->second != NULL);
 
         std::string content;
-        if (message.AnswerSize > 0)
+        if (message.GetAnswerSize() > 0)
         {
-          content.assign(reinterpret_cast<const char*>(message.Answer), message.AnswerSize);
+          content.assign(reinterpret_cast<const char*>(message.GetAnswer()), message.GetAnswerSize());
         }
         
         std::auto_ptr<Orthanc::PamReader> reader(new Orthanc::PamReader);
@@ -2823,7 +2823,7 @@
     void OnDicomExported(const OrthancApiClient::JsonResponseReadyMessage& message)
     {
       LOG(WARNING) << "DICOM export was successful:"
-                   << message.Response.toStyledString();
+                   << message.GetJson().toStyledString();
     }
   };