diff Framework/Oracle/ParseDicomFileCommand.cpp @ 1124:a8bf81756839 broker

unsuccessful attempt to cache ParseDicomFileCommand
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Nov 2019 18:49:06 +0100
parents a08699daf78b
children 87fbeb823375
line wrap: on
line diff
--- a/Framework/Oracle/ParseDicomFileCommand.cpp	Mon Nov 04 15:54:57 2019 +0100
+++ b/Framework/Oracle/ParseDicomFileCommand.cpp	Tue Nov 05 18:49:06 2019 +0100
@@ -27,14 +27,8 @@
 
 namespace OrthancStone
 {
-  ParseDicomFileCommand::SuccessMessage::SuccessMessage(const ParseDicomFileCommand& command,
-                                                        DcmFileFormat& content,
-                                                        size_t fileSize) :
-    OriginMessage(command),
-    fileSize_(fileSize)
+  void ParseDicomFileCommand::SuccessMessage::Setup()
   {
-    dicom_.reset(new Orthanc::ParsedDicomFile(content));
-
     if (!dicom_->GetTagValue(sopInstanceUid_, Orthanc::DICOM_TAG_SOP_INSTANCE_UID))
     {
       throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
@@ -43,10 +37,29 @@
   }
 
 
-  boost::shared_ptr<Orthanc::ParsedDicomFile> ParseDicomFileCommand::SuccessMessage::GetDicom() const
+  ParseDicomFileCommand::SuccessMessage::SuccessMessage(const ParseDicomFileCommand& command,
+                                                        DcmFileFormat& dicom,
+                                                        size_t fileSize,
+                                                        bool hasPixelData) :
+    OriginMessage(command),
+    fileSize_(fileSize),
+    hasPixelData_(hasPixelData)
   {
-    assert(dicom_.get() != NULL);
-    return dicom_;
+    dicom_.reset(new Orthanc::ParsedDicomFile(dicom));
+    Setup();
+  }
+
+
+  ParseDicomFileCommand::SuccessMessage::SuccessMessage(const ParseDicomFileCommand& command,
+                                                        boost::shared_ptr<Orthanc::ParsedDicomFile> dicom,
+                                                        size_t fileSize,
+                                                        bool hasPixelData) :
+    OriginMessage(command),
+    dicom_(dicom),
+    fileSize_(fileSize),
+    hasPixelData_(hasPixelData)
+  {
+    Setup();
   }