Mercurial > hg > orthanc
diff Core/Images/PamReader.h @ 3834:219de90c1f43
Added a flag to use an extra buffer in PamReader
to ensure (malloc-like) alignment of the image
buffer. This flag is NOT turned on by default and,
in Orthanc, is only used by the Unit tests.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 15 Apr 2020 16:58:28 +0200 |
parents | 94f4a18a79cc |
children | 95083d2f6819 |
line wrap: on
line diff
--- a/Core/Images/PamReader.h Fri Apr 10 17:56:12 2020 +0200 +++ b/Core/Images/PamReader.h Wed Apr 15 16:58:28 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);