diff Core/Images/PamReader.h @ 3837:963ea9fab402

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 15 Apr 2020 17:28:27 +0200
parents 219de90c1f43
children 95083d2f6819
line wrap: on
line diff
--- a/Core/Images/PamReader.h	Wed Apr 15 17:28:15 2020 +0200
+++ b/Core/Images/PamReader.h	Wed Apr 15 17:28:27 2020 +0200
@@ -46,9 +46,45 @@
   private:
     void ParseContent();
     
+    /**
+    Whether we want to use the default malloc alignment in the image buffer,
+    at the expense of an extra copy
+    */
+    bool enforceAligned_;
+
+    /**
+    This is actually a copy of wrappedContent_, but properly aligned.
+
+    It is only used if the enforceAligned parameter is set to true in the
+    constructor.
+    */
+    void* alignedImageBuffer_;
+    
+    /**
+    Points somewhere in the content_ buffer.      
+    */
+    ImageAccessor wrappedContent_;
+
+    /**
+    Raw content (file bytes or answer from the server, for instance). 
+    */
     std::string content_;
 
   public:
+    /**
+    See doc for field enforceAligned_
+    */
+    PamReader(bool enforceAligned = false) :
+      enforceAligned_(enforceAligned),
+      alignedImageBuffer_(NULL)
+    {
+    }
+
+    virtual ~PamReader()
+    {
+      // freeing NULL is OK
+      free(alignedImageBuffer_);
+    }
 
 #if ORTHANC_SANDBOXED == 0
     void ReadFromFile(const std::string& filename);