diff OrthancServer/DicomInstanceToStore.h @ 1005:84b6d7bca6db lua-scripting

refactoring of ServerContext::Store
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 Jul 2014 14:34:11 +0200
parents a226e0959d8b
children 649d47854314
line wrap: on
line diff
--- a/OrthancServer/DicomInstanceToStore.h	Tue Jul 08 14:06:05 2014 +0200
+++ b/OrthancServer/DicomInstanceToStore.h	Tue Jul 08 14:34:11 2014 +0200
@@ -87,10 +87,18 @@
         Deallocate();
         content_ = content;
         toDelete_ = true;
-        isReadOnly_ = true;
+        isReadOnly_ = false;
       }
 
-      void SetReference(const T& content)   // Read-only assign, without transfering ownership
+      void SetReference(T& content)   // Read and write assign, without transfering ownership
+      {
+        Deallocate();
+        content_ = &content;
+        toDelete_ = false;
+        isReadOnly_ = false;
+      }
+
+      void SetConstReference(const T& content)   // Read-only assign, without transfering ownership
       {
         Deallocate();
         content_ = &const_cast<T&>(content);
@@ -186,7 +194,7 @@
   public:
     void SetBuffer(const std::string& dicom)
     {
-      buffer_.SetReference(dicom);
+      buffer_.SetConstReference(dicom);
     }
 
     void SetParsedDicomFile(ParsedDicomFile& parsed)
@@ -196,12 +204,12 @@
 
     void SetSummary(const DicomMap& summary)
     {
-      summary_.SetReference(summary);
+      summary_.SetConstReference(summary);
     }
 
     void SetJson(const Json::Value& json)
     {
-      json_.SetReference(json);
+      json_.SetConstReference(json);
     }
 
     const std::string GetRemoteAet() const