changeset 204:9d269d7cfeb8

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 28 Mar 2018 11:28:27 +0200
parents 431e991af593
children 886230938339
files Resources/Orthanc/Core/Cache/MemoryCache.cpp Resources/Orthanc/Core/Cache/MemoryCache.h Resources/Orthanc/Core/Compression/DeflateBaseCompressor.h Resources/Orthanc/Core/Compression/ZipWriter.h Resources/Orthanc/Resources/CMake/OrthancFrameworkConfiguration.cmake Resources/Orthanc/Resources/CMake/OrthancFrameworkParameters.cmake
diffstat 6 files changed, 61 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/Orthanc/Core/Cache/MemoryCache.cpp	Tue Mar 27 11:12:50 2018 +0200
+++ b/Resources/Orthanc/Core/Cache/MemoryCache.cpp	Wed Mar 28 11:28:27 2018 +0200
@@ -78,6 +78,15 @@
   {
   }
 
+  void MemoryCache::Invalidate(const std::string& id)
+  {
+    if (index_.Contains(id))
+    {
+      VLOG(1) << "Invalidating a cache page";
+      index_.Invalidate(id);
+    }
+  }
+
   MemoryCache::~MemoryCache()
   {
     while (!index_.IsEmpty())
--- a/Resources/Orthanc/Core/Cache/MemoryCache.h	Tue Mar 27 11:12:50 2018 +0200
+++ b/Resources/Orthanc/Core/Cache/MemoryCache.h	Wed Mar 28 11:28:27 2018 +0200
@@ -64,5 +64,7 @@
     ~MemoryCache();
 
     IDynamicObject& Access(const std::string& id);
+
+    void Invalidate(const std::string& id);
   };
 }
--- a/Resources/Orthanc/Core/Compression/DeflateBaseCompressor.h	Tue Mar 27 11:12:50 2018 +0200
+++ b/Resources/Orthanc/Core/Compression/DeflateBaseCompressor.h	Wed Mar 28 11:28:27 2018 +0200
@@ -35,6 +35,15 @@
 
 #include "IBufferCompressor.h"
 
+#if !defined(ORTHANC_ENABLE_ZLIB)
+#  error The macro ORTHANC_ENABLE_ZLIB must be defined
+#endif
+
+#if ORTHANC_ENABLE_ZLIB != 1
+#  error ZLIB support must be enabled to include this file
+#endif
+
+
 #include <stdint.h>
 
 namespace Orthanc
--- a/Resources/Orthanc/Core/Compression/ZipWriter.h	Tue Mar 27 11:12:50 2018 +0200
+++ b/Resources/Orthanc/Core/Compression/ZipWriter.h	Wed Mar 28 11:28:27 2018 +0200
@@ -33,6 +33,15 @@
 
 #pragma once
 
+#if !defined(ORTHANC_ENABLE_ZLIB)
+#  error The macro ORTHANC_ENABLE_ZLIB must be defined
+#endif
+
+#if ORTHANC_ENABLE_ZLIB != 1
+#  error ZLIB support must be enabled to include this file
+#endif
+
+
 #include <stdint.h>
 #include <string>
 #include <boost/shared_ptr.hpp>
--- a/Resources/Orthanc/Resources/CMake/OrthancFrameworkConfiguration.cmake	Tue Mar 27 11:12:50 2018 +0200
+++ b/Resources/Orthanc/Resources/CMake/OrthancFrameworkConfiguration.cmake	Wed Mar 28 11:28:27 2018 +0200
@@ -71,6 +71,11 @@
   add_definitions(-DORTHANC_ENABLE_JPEG=0)
 endif()
 
+if (NOT ENABLE_ZLIB)
+  unset(USE_SYSTEM_ZLIB CACHE)
+  add_definitions(-DORTHANC_ENABLE_ZLIB=0)
+endif()
+
 if (NOT ENABLE_PNG)
   unset(USE_SYSTEM_LIBPNG CACHE)
   add_definitions(-DORTHANC_ENABLE_PNG=0)
@@ -117,11 +122,6 @@
 set(ORTHANC_CORE_SOURCES_INTERNAL
   ${ORTHANC_ROOT}/Core/Cache/MemoryCache.cpp
   ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp
-  ${ORTHANC_ROOT}/Core/Compression/DeflateBaseCompressor.cpp
-  ${ORTHANC_ROOT}/Core/Compression/GzipCompressor.cpp
-  ${ORTHANC_ROOT}/Core/Compression/HierarchicalZipWriter.cpp
-  ${ORTHANC_ROOT}/Core/Compression/ZipWriter.cpp
-  ${ORTHANC_ROOT}/Core/Compression/ZlibCompressor.cpp
   ${ORTHANC_ROOT}/Core/DicomFormat/DicomArray.cpp
   ${ORTHANC_ROOT}/Core/DicomFormat/DicomImageInformation.cpp
   ${ORTHANC_ROOT}/Core/DicomFormat/DicomInstanceHasher.cpp
@@ -269,10 +269,36 @@
 
 
 ##
+## zlib support
+##
+
+if (ENABLE_ZLIB)
+  include(${CMAKE_CURRENT_LIST_DIR}/ZlibConfiguration.cmake)
+  add_definitions(-DORTHANC_ENABLE_ZLIB=1)
+
+  list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
+    ${ORTHANC_ROOT}/Core/Compression/DeflateBaseCompressor.cpp
+    ${ORTHANC_ROOT}/Core/Compression/HierarchicalZipWriter.cpp
+    ${ORTHANC_ROOT}/Core/Compression/GzipCompressor.cpp
+    ${ORTHANC_ROOT}/Core/Compression/ZipWriter.cpp
+    ${ORTHANC_ROOT}/Core/Compression/ZlibCompressor.cpp
+
+    # This is the minizip distribution to create ZIP files using zlib
+    ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/ioapi.c
+    ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/zip.c
+    )
+endif()
+
+
+##
 ## PNG support: libpng (in conjunction with zlib)
 ##
 
 if (ENABLE_PNG)
+  if (NOT ENABLE_ZLIB)
+    message(FATAL_ERROR "Support for zlib must be enabled if enabling libpng support")
+  endif()
+
   include(${CMAKE_CURRENT_LIST_DIR}/LibPngConfiguration.cmake)
   add_definitions(-DORTHANC_ENABLE_PNG=1)
 
@@ -333,7 +359,6 @@
 #####################################################################
 
 include(${CMAKE_CURRENT_LIST_DIR}/JsonCppConfiguration.cmake)
-include(${CMAKE_CURRENT_LIST_DIR}/ZlibConfiguration.cmake)
 
 if (NOT ORTHANC_SANDBOXED)
   include(${CMAKE_CURRENT_LIST_DIR}/UuidConfiguration.cmake)
@@ -509,10 +534,6 @@
 
   ${ORTHANC_ROOT}/Resources/ThirdParty/md5/md5.c
   ${ORTHANC_ROOT}/Resources/ThirdParty/base64/base64.cpp
-
-  # This is the minizip distribution to create ZIP files using zlib
-  ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/ioapi.c
-  ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/zip.c
   )  
 
 set(ORTHANC_CORE_SOURCES
--- a/Resources/Orthanc/Resources/CMake/OrthancFrameworkParameters.cmake	Tue Mar 27 11:12:50 2018 +0200
+++ b/Resources/Orthanc/Resources/CMake/OrthancFrameworkParameters.cmake	Wed Mar 28 11:28:27 2018 +0200
@@ -93,6 +93,7 @@
 set(ENABLE_PNG OFF CACHE INTERNAL "Enable support of PNG")
 set(ENABLE_PUGIXML OFF CACHE INTERNAL "Enable support of XML through Pugixml")
 set(ENABLE_SQLITE OFF CACHE INTERNAL "Enable support of SQLite databases")
+set(ENABLE_ZLIB OFF CACHE INTERNAL "Enable support of zlib")
 set(ENABLE_WEB_CLIENT OFF CACHE INTERNAL "Enable Web client")
 set(ENABLE_WEB_SERVER OFF CACHE INTERNAL "Enable embedded Web server")
 set(ENABLE_DCMTK OFF CACHE INTERNAL "Enable DCMTK")