changeset 6703:f7ba463e9f9f

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 13 Apr 2026 17:45:15 +0200
parents 244b83190ca1 (diff) 7740f66ad5f8 (current diff)
children acb331209309
files
diffstat 19 files changed, 306 insertions(+), 151 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake	Mon Apr 13 17:45:15 2026 +0200
@@ -166,6 +166,7 @@
   ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomPath.cpp
   ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomTag.cpp
   ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/Window.cpp
+  ${CMAKE_CURRENT_LIST_DIR}/../../Sources/ElapsedTimer.cpp
   ${CMAKE_CURRENT_LIST_DIR}/../../Sources/EnumerationDictionary.h
   ${CMAKE_CURRENT_LIST_DIR}/../../Sources/Enumerations.cpp
   ${CMAKE_CURRENT_LIST_DIR}/../../Sources/FileStorage/FileInfo.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancFramework/Sources/CompatibilityUniquePtr.h	Mon Apr 13 17:45:15 2026 +0200
@@ -0,0 +1,64 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2023 Osimis S.A., Belgium
+ * Copyright (C) 2024-2026 Orthanc Team SRL, Belgium
+ * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+#include "Compatibility.h"
+
+#if ORTHANC_Cxx03_DETECTED == 1
+//#pragma message("C++ 11 support is not present.")
+
+/**
+ * "std::unique_ptr" was introduced in C++11, and "std::auto_ptr" was
+ * removed in C++17. We emulate "std::auto_ptr" using boost: "The
+ * smart pointer unique_ptr [is] a drop-in replacement for
+ * std::unique_ptr, usable also from C++03 compilers." This is only
+ * available if Boost >= 1.57.0 (from November 2014).
+ * https://www.boost.org/doc/libs/1_57_0/doc/html/move/reference.html#header.boost.move.unique_ptr_hpp
+ **/
+
+#include <boost/move/unique_ptr.hpp>
+
+namespace std
+{
+  template <typename T>
+  class unique_ptr : public boost::movelib::unique_ptr<T>
+  {
+  public:
+    explicit unique_ptr() :
+      boost::movelib::unique_ptr<T>()
+    {
+    }
+
+    explicit unique_ptr(T* p) :
+      boost::movelib::unique_ptr<T>(p)
+    {
+    }
+  };
+}
+
+#else
+//# pragma message("C++ 11 support is present.")
+#  include <memory>
+#endif
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -25,9 +25,10 @@
 #include "../PrecompiledHeaders.h"
 #include "DicomMap.h"
 
-#include <stdio.h>
+#include <boost/algorithm/string/join.hpp>
+#include <boost/lexical_cast.hpp>
 #include <memory>
-#include <boost/algorithm/string/join.hpp>
+#include <stdio.h>
 
 #include "../Compatibility.h"
 #include "../Endianness.h"
--- a/OrthancFramework/Sources/DicomNetworking/DicomAssociation.cpp	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/DicomAssociation.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -38,6 +38,7 @@
 #  include <winsock.h>
 #endif
 
+#include <boost/lexical_cast.hpp>
 #include <dcmtk/dcmnet/diutil.h>  // For dcmConnectionTimeout()
 #include <dcmtk/dcmdata/dcdeftag.h>
 
--- a/OrthancFramework/Sources/DicomNetworking/DicomAssociationParameters.cpp	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/DicomAssociationParameters.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -34,6 +34,7 @@
 
 #include <dcmtk/dcmnet/diutil.h>  // For ASC_DEFAULTMAXPDU
 
+#include <boost/lexical_cast.hpp>
 #include <boost/thread/mutex.hpp>
 
 // By default, the default timeout for client DICOM connections is set to 10 seconds
--- a/OrthancFramework/Sources/DicomNetworking/Internals/DicomTls.cpp	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/Internals/DicomTls.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -39,6 +39,8 @@
 #include "../../OrthancException.h"
 #include "../../SystemToolbox.h"
 #include "../../Toolbox.h"
+
+#include <boost/lexical_cast.hpp>
 #include <openssl/ssl.h>
 #include <openssl/err.h>
 
--- a/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -33,6 +33,7 @@
 #include "FromDcmtkBridge.h"
 
 #include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string/replace.hpp>
 
 
 static const char* const KEY_ALPHABETIC = "Alphabetic";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancFramework/Sources/ElapsedTimer.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -0,0 +1,109 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2023 Osimis S.A., Belgium
+ * Copyright (C) 2024-2026 Orthanc Team SRL, Belgium
+ * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ **/
+
+
+#include "PrecompiledHeaders.h"
+#include "ElapsedTimer.h"
+
+#include "Logging.h"
+#include "Toolbox.h"
+
+namespace Orthanc
+{
+  ElapsedTimer::ElapsedTimer()
+  {
+    Restart();
+  }
+
+  void ElapsedTimer::Restart()
+  {
+    start_ = boost::posix_time::microsec_clock::universal_time();
+  }
+
+  uint64_t ElapsedTimer::GetElapsedMilliseconds()
+  {
+    return GetElapsedNanoseconds() / 1000000;
+  }
+
+  uint64_t ElapsedTimer::GetElapsedMicroseconds()
+  {
+    return GetElapsedNanoseconds() / 1000;
+  }
+
+  uint64_t ElapsedTimer::GetElapsedNanoseconds()
+  {
+    boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time();
+    boost::posix_time::time_duration diff = now - start_;
+    return static_cast<uint64_t>(diff.total_nanoseconds());
+  }
+
+  std::string ElapsedTimer::GetHumanElapsedDuration()
+  {
+    return Toolbox::GetHumanDuration(GetElapsedNanoseconds());
+  }
+
+  // in "full" mode, returns " 26.45MB in 2.25s = 94.04Mbps"
+  // else, returns "94.04Mbps"
+  std::string ElapsedTimer::GetHumanTransferSpeed(bool full, uint64_t sizeInBytes)
+  {
+    return Toolbox::GetHumanTransferSpeed(full, sizeInBytes, GetElapsedNanoseconds());
+  }
+
+  DebugElapsedTimeLogger::DebugElapsedTimeLogger(const std::string& message) :
+    message_(message),
+    logged_(false)
+  {
+    Restart();
+  }
+
+  DebugElapsedTimeLogger::~DebugElapsedTimeLogger()
+  {
+    if (!logged_)
+    {
+      StopAndLog();
+    }
+  }
+
+  void DebugElapsedTimeLogger::Restart()
+  {
+    timer_.Restart();
+  }
+
+  void DebugElapsedTimeLogger::StopAndLog()
+  {
+    LOG(WARNING) << "ELAPSED TIMER: " << message_ << " (" << timer_.GetElapsedMicroseconds() << " us)";
+    logged_ = true;
+  }
+
+  ApiElapsedTimeLogger::ApiElapsedTimeLogger(const std::string& message) :
+    message_(message)
+  {
+    timer_.Restart();
+    CLOG(INFO, HTTP) << message_;
+  }
+
+  ApiElapsedTimeLogger::~ApiElapsedTimeLogger()
+  {
+    CLOG(INFO, HTTP) << message_ << " (elapsed: " << timer_.GetElapsedMicroseconds() << " us)";
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancFramework/Sources/ElapsedTimer.h	Mon Apr 13 17:45:15 2026 +0200
@@ -0,0 +1,88 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2023 Osimis S.A., Belgium
+ * Copyright (C) 2024-2026 Orthanc Team SRL, Belgium
+ * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+// The header "posix_time.hpp" of Boost is very heavy to import, don't
+// define those classes in "Toolbox.h"
+
+#include "OrthancFramework.h"
+
+#include <boost/noncopyable.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+
+namespace Orthanc
+{
+  class ORTHANC_PUBLIC ElapsedTimer : public boost::noncopyable
+  {
+  private:
+    boost::posix_time::ptime  start_;
+
+  public:
+    ElapsedTimer();
+
+    uint64_t GetElapsedMilliseconds();
+    uint64_t GetElapsedMicroseconds();
+    uint64_t GetElapsedNanoseconds();
+
+    std::string GetHumanElapsedDuration();
+    std::string GetHumanTransferSpeed(bool full, uint64_t sizeInBytes);
+
+    void Restart();
+  };
+
+  // This is a helper class to measure and log time spend e.g in a method.
+  // This should be used only during debugging and should likely not ever be used in a release.
+  // By default, you should use it as a RAII but you may force Restart/StopAndLog manually if needed.
+  class ORTHANC_PUBLIC DebugElapsedTimeLogger : public boost::noncopyable
+  {
+  private:
+    ElapsedTimer      timer_;
+    const std::string message_;
+    bool              logged_;
+
+  public:
+    explicit DebugElapsedTimeLogger(const std::string& message);
+
+    ~DebugElapsedTimeLogger();
+
+    void Restart();
+    void StopAndLog();
+  };
+
+  // This variant logs the same message when entering the method and when exiting (with the elapsed time).
+  // Logs goes to verbose-http.
+  class ORTHANC_PUBLIC ApiElapsedTimeLogger : public boost::noncopyable
+  {
+  private:
+    ElapsedTimer      timer_;
+    const std::string message_;
+
+  public:
+    explicit ApiElapsedTimeLogger(const std::string& message);
+
+    ~ApiElapsedTimeLogger();
+  };
+}
--- a/OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -29,6 +29,7 @@
 // http://stackoverflow.com/questions/1576272/storing-large-number-of-files-in-file-system
 // http://stackoverflow.com/questions/446358/storing-a-large-number-of-images
 
+#include "../ElapsedTimer.h"
 #include "../Logging.h"
 #include "../OrthancException.h"
 #include "../StringMemoryBuffer.h"
@@ -124,7 +125,7 @@
                                  size_t size,
                                  FileContentType type)
   {
-    Toolbox::ElapsedTimer timer;
+    ElapsedTimer timer;
     LOG(INFO) << "Creating attachment \"" << uuid << "\" of \"" << GetDescriptionInternal(type) 
               << "\" type";
 
@@ -190,7 +191,7 @@
   IMemoryBuffer* FilesystemStorage::ReadWhole(const std::string& uuid,
                                               FileContentType type)
   {
-    Toolbox::ElapsedTimer timer;
+    ElapsedTimer timer;
     LOG(INFO) << "Reading attachment \"" << uuid << "\" of \"" << GetDescriptionInternal(type) 
               << "\" content type";
 
@@ -208,7 +209,7 @@
                                               uint64_t start /* inclusive */,
                                               uint64_t end /* exclusive */)
   {
-    Toolbox::ElapsedTimer timer;
+    ElapsedTimer timer;
     LOG(INFO) << "Reading attachment \"" << uuid << "\" of \"" << GetDescriptionInternal(type) 
               << "\" content type (range from " << start << " to " << end << ")";
 
--- a/OrthancFramework/Sources/HttpClient.cpp	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Sources/HttpClient.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -31,10 +31,11 @@
 #include "ChunkedBuffer.h"
 #include "SystemToolbox.h"
 
-#include <string.h>
+#include <boost/algorithm/string/predicate.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/thread/mutex.hpp>
 #include <curl/curl.h>
-#include <boost/algorithm/string/predicate.hpp>
-#include <boost/thread/mutex.hpp>
+#include <string.h>
 
 // Default timeout = 60 seconds (in Orthanc <= 1.5.6, it was 10 seconds)
 static const unsigned int DEFAULT_HTTP_TIMEOUT = 60;
--- a/OrthancFramework/Sources/HttpServer/HttpServer.cpp	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Sources/HttpServer/HttpServer.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -28,15 +28,18 @@
 #include "HttpServer.h"
 
 #include "../ChunkedBuffer.h"
+#include "../ElapsedTimer.h"
 #include "../FileBuffer.h"
 #include "../Logging.h"
 #include "../OrthancException.h"
+#include "../SystemToolbox.h"
 #include "../TemporaryFile.h"
-#include "../SystemToolbox.h"
+
 #include "HttpToolbox.h"
 #include "IHttpHandler.h"
 #include "MultipartStreamReader.h"
 #include "StringHttpOutput.h"
+
 #include <algorithm>
 
 #if ORTHANC_ENABLE_PUGIXML == 1
@@ -1426,11 +1429,11 @@
     
     HttpMethod filterMethod;
 
-    std::unique_ptr<Toolbox::ApiElapsedTimeLogger> apiLogTimer; // to log the time spent in the API call
+    std::unique_ptr<ApiElapsedTimeLogger> apiLogTimer; // to log the time spent in the API call
 
     if (ExtractMethod(method, request, headers, argumentsGET))
     {
-      apiLogTimer.reset(new Toolbox::ApiElapsedTimeLogger(std::string(EnumerationToString(method)) + " " + Toolbox::FlattenUri(uri)));
+      apiLogTimer.reset(new ApiElapsedTimeLogger(std::string(EnumerationToString(method)) + " " + Toolbox::FlattenUri(uri)));
       
       filterMethod = method;
     }
@@ -1439,7 +1442,7 @@
              !strcmp(request->request_method, "PROPFIND") ||
              !strcmp(request->request_method, "HEAD"))
     {
-      apiLogTimer.reset(new Toolbox::ApiElapsedTimeLogger(std::string("Incoming read-only WebDAV request: ") + request->request_method + " " + requestUri));
+      apiLogTimer.reset(new ApiElapsedTimeLogger(std::string("Incoming read-only WebDAV request: ") + request->request_method + " " + requestUri));
       filterMethod = HttpMethod_Get;
       isWebDav = true;
     }
@@ -1448,7 +1451,7 @@
              !strcmp(request->request_method, "UNLOCK") ||
              !strcmp(request->request_method, "MKCOL"))
     {
-      apiLogTimer.reset(new Toolbox::ApiElapsedTimeLogger(std::string("Incoming read-write WebDAV request: ") + request->request_method + " " + requestUri));
+      apiLogTimer.reset(new ApiElapsedTimeLogger(std::string("Incoming read-write WebDAV request: ") + request->request_method + " " + requestUri));
       filterMethod = HttpMethod_Put;
       isWebDav = true;
     }
--- a/OrthancFramework/Sources/Logging.h	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Sources/Logging.h	Mon Apr 13 17:45:15 2026 +0200
@@ -224,7 +224,6 @@
      ORTHANC_ENABLE_LOGGING_STDIO == 1)
 // This is notably for WebAssembly
 
-#include <boost/lexical_cast.hpp>
 #include <boost/noncopyable.hpp>
 #include <sstream>
 
@@ -252,10 +251,9 @@
 
       ~InternalLogger();
       
-      template <typename T>
-        std::ostream& operator<< (const T& message)
+      std::ostream& operator<< (const std::string& message)
       {
-        return messageStream_ << boost::lexical_cast<std::string>(message);
+        return messageStream_ << message;
       }
     };
   }
@@ -268,7 +266,6 @@
 #if (ORTHANC_ENABLE_LOGGING == 1 &&             \
      ORTHANC_ENABLE_LOGGING_STDIO == 0)
 
-#include <boost/lexical_cast.hpp>
 #include <boost/noncopyable.hpp>
 #include <boost/thread/mutex.hpp>
 #include <sstream>
@@ -297,10 +294,9 @@
 
       ~InternalLogger();
       
-      template <typename T>
-        std::ostream& operator<< (const T& message)
+      std::ostream& operator<< (const std::string& message)
       {
-        return messageStream_ << boost::lexical_cast<std::string>(message);
+        return messageStream_ << message;
       }
     };
 
--- a/OrthancFramework/Sources/RestApi/RestApi.cpp	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Sources/RestApi/RestApi.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -31,6 +31,7 @@
 #include "../OrthancException.h"
 
 #include <boost/algorithm/string/replace.hpp>
+#include <boost/lexical_cast.hpp>
 #include <stdlib.h>   // To define "_exit()" under Windows
 #include <stdio.h>
 
--- a/OrthancFramework/Sources/Toolbox.cpp	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Sources/Toolbox.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -32,6 +32,7 @@
 #include <json/reader.h>
 #include <json/version.h>
 #include <json/writer.h>
+#include <iomanip>
 #include <limits>
 
 #if !defined(JSONCPP_VERSION_MAJOR) || !defined(JSONCPP_VERSION_MINOR)
@@ -238,6 +239,13 @@
   }
 
 
+  Toolbox::MD5Context::~MD5Context()
+  {
+    assert(pimpl_ != NULL);
+    delete pimpl_;
+  }
+
+
   void Toolbox::MD5Context::Append(const void* data,
                                    size_t size)
   {
@@ -3069,83 +3077,6 @@
   }
 
 
-  Toolbox::ElapsedTimer::ElapsedTimer()
-  {
-    Restart();
-  }
-
-  void Toolbox::ElapsedTimer::Restart()
-  {
-    start_ = boost::posix_time::microsec_clock::universal_time();
-  }
-
-  uint64_t Toolbox::ElapsedTimer::GetElapsedMilliseconds()
-  {
-    return GetElapsedNanoseconds() / 1000000;
-  }
-  
-  uint64_t Toolbox::ElapsedTimer::GetElapsedMicroseconds()
-  {
-    return GetElapsedNanoseconds() / 1000;
-  }
-
-  uint64_t Toolbox::ElapsedTimer::GetElapsedNanoseconds()
-  {
-    boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time();
-    boost::posix_time::time_duration diff = now - start_;
-    return static_cast<uint64_t>(diff.total_nanoseconds());
-  }
-
-  std::string Toolbox::ElapsedTimer::GetHumanElapsedDuration()
-  {
-    return Toolbox::GetHumanDuration(GetElapsedNanoseconds());
-  }
-
-  // in "full" mode, returns " 26.45MB in 2.25s = 94.04Mbps"
-  // else, returns "94.04Mbps"
-  std::string Toolbox::ElapsedTimer::GetHumanTransferSpeed(bool full, uint64_t sizeInBytes)
-  {
-    return Toolbox::GetHumanTransferSpeed(full, sizeInBytes, GetElapsedNanoseconds());
-  }
-
-  Toolbox::DebugElapsedTimeLogger::DebugElapsedTimeLogger(const std::string& message)
-  : message_(message),
-    logged_(false)
-  {
-    Restart();
-  }
-
-  Toolbox::DebugElapsedTimeLogger::~DebugElapsedTimeLogger()
-  {
-    if (!logged_)
-    {
-      StopAndLog();
-    }
-  }
-
-  void Toolbox::DebugElapsedTimeLogger::Restart()
-  {
-    timer_.Restart();
-  }
-
-  void Toolbox::DebugElapsedTimeLogger::StopAndLog()
-  {
-    LOG(WARNING) << "ELAPSED TIMER: " << message_ << " (" << timer_.GetElapsedMicroseconds() << " us)";
-    logged_ = true;
-  }
-
-  Toolbox::ApiElapsedTimeLogger::ApiElapsedTimeLogger(const std::string& message) :
-    message_(message)
-  {
-    timer_.Restart();
-    CLOG(INFO, HTTP) << message_;
-  }
-  
-  Toolbox::ApiElapsedTimeLogger::~ApiElapsedTimeLogger()
-  {
-    CLOG(INFO, HTTP) << message_ << " (elapsed: " << timer_.GetElapsedMicroseconds() << " us)";
-  }
-
   std::string Toolbox::GetHumanFileSize(uint64_t sizeInBytes)
   {
     if (sizeInBytes < 1024)
--- a/OrthancFramework/Sources/Toolbox.h	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Sources/Toolbox.h	Mon Apr 13 17:45:15 2026 +0200
@@ -68,7 +68,7 @@
 #  include <pugixml.hpp>
 #endif
 
-#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/noncopyable.hpp>
 
 
 namespace Orthanc
@@ -87,11 +87,13 @@
     {
     private:
       class PImpl;
-      boost::shared_ptr<PImpl> pimpl_;
+      PImpl* pimpl_;  // Don't use "boost::shared_ptr<PImpl>" here to speed up compilation time of this common header
 
     public:
       MD5Context();
 
+      ~MD5Context();
+
       void Append(const void* data,
                   size_t size);
 
@@ -415,57 +417,6 @@
 
     static size_t BoundMemorySizeToCurrentArchitecture(uint64_t size);
 
-    class ORTHANC_PUBLIC ElapsedTimer : public boost::noncopyable
-    {
-    private:
-      boost::posix_time::ptime  start_;
-
-    public:
-      ElapsedTimer();
-
-      uint64_t GetElapsedMilliseconds();
-      uint64_t GetElapsedMicroseconds();
-      uint64_t GetElapsedNanoseconds();
-      
-      std::string GetHumanElapsedDuration();
-      std::string GetHumanTransferSpeed(bool full, uint64_t sizeInBytes);
-      
-      void Restart();
-    };
-
-    // This is a helper class to measure and log time spend e.g in a method.
-    // This should be used only during debugging and should likely not ever be used in a release.
-    // By default, you should use it as a RAII but you may force Restart/StopAndLog manually if needed.
-    class ORTHANC_PUBLIC DebugElapsedTimeLogger : public boost::noncopyable
-    {
-    private:
-      ElapsedTimer      timer_;
-      const std::string message_;
-      bool              logged_;
-
-    public:
-      explicit DebugElapsedTimeLogger(const std::string& message);
-
-      ~DebugElapsedTimeLogger();  
-
-      void Restart();
-      void StopAndLog();
-    };
-
-    // This variant logs the same message when entering the method and when exiting (with the elapsed time).
-    // Logs goes to verbose-http.
-    class ORTHANC_PUBLIC ApiElapsedTimeLogger : public boost::noncopyable
-    {
-    private:
-      ElapsedTimer      timer_;
-      const std::string message_;
-
-    public:
-      explicit ApiElapsedTimeLogger(const std::string& message);
-
-      ~ApiElapsedTimeLogger();
-    };
-
     static std::string GetHumanFileSize(uint64_t sizeInBytes);
 
     static std::string GetHumanDuration(uint64_t durationInNanoseconds);
--- a/OrthancFramework/Sources/WebServiceParameters.cpp	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancFramework/Sources/WebServiceParameters.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -35,6 +35,7 @@
 #endif
 
 #include <boost/algorithm/string/find.hpp>
+#include <boost/lexical_cast.hpp>
 #include <cassert>
 
 namespace Orthanc
--- a/OrthancServer/Plugins/Samples/DelayedDeletion/OrthancFrameworkDependencies.cpp	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancServer/Plugins/Samples/DelayedDeletion/OrthancFrameworkDependencies.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -50,6 +50,7 @@
 #include "../../../../OrthancFramework/Sources/Compression/DeflateBaseCompressor.cpp"
 #include "../../../../OrthancFramework/Sources/Compression/GzipCompressor.cpp"
 #include "../../../../OrthancFramework/Sources/DicomFormat/DicomTag.cpp"
+#include "../../../../OrthancFramework/Sources/ElapsedTimer.cpp"
 #include "../../../../OrthancFramework/Sources/Enumerations.cpp"
 #include "../../../../OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp"
 #include "../../../../OrthancFramework/Sources/Logging.cpp"
--- a/OrthancServer/Sources/OrthancInitialization.cpp	Mon Apr 13 16:43:30 2026 +0200
+++ b/OrthancServer/Sources/OrthancInitialization.cpp	Mon Apr 13 17:45:15 2026 +0200
@@ -67,6 +67,7 @@
 
 #include <OrthancServerResources.h>
 
+#include <boost/lexical_cast.hpp>
 #include <dcmtk/dcmnet/diutil.h>  // For DCM_dcmnetLogger