changeset 1468:323bf6040f5d

fix for boost::program_options
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 12 Jun 2020 16:53:42 +0200
parents 5ba289143598
children 390b0c30ba19
files Framework/Messages/IObservable.cpp Framework/Oracle/WebAssemblyOracle.cpp Resources/CMake/OrthancStoneConfiguration.cmake
diffstat 3 files changed, 16 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Messages/IObservable.cpp	Fri Jun 12 13:27:41 2020 +0200
+++ b/Framework/Messages/IObservable.cpp	Fri Jun 12 16:53:42 2020 +0200
@@ -112,7 +112,7 @@
   void IObservable::EmitMessage(boost::weak_ptr<IObserver> observer,
                                 const IMessage& message)
   {
-    //LOG(TRACE) << "IObservable::EmitMessage observer = " << std::hex << &observer << std::dec;
+    //LOG(TRACE) << "IObservable::EmitMessage observer = " << std::hex << observer.get() << std::dec;
 
     boost::shared_ptr<IObserver> lock(observer.lock());
     if (lock)
--- a/Framework/Oracle/WebAssemblyOracle.cpp	Fri Jun 12 13:27:41 2020 +0200
+++ b/Framework/Oracle/WebAssemblyOracle.cpp	Fri Jun 12 16:53:42 2020 +0200
@@ -105,8 +105,12 @@
       command_(command),
       expectedContentType_(expectedContentType)
     {
-      LOG(TRACE) << "WebAssemblyOracle::FetchContext::FetchContext() | "
-                 << "receiver address = " << std::hex << &receiver;
+      if (Orthanc::Logging::IsTraceLevelEnabled())
+      {
+        // Calling "receiver.lock()" is expensive, hence the quick check if TRACE is enabled
+        LOG(TRACE) << "WebAssemblyOracle::FetchContext::FetchContext() | "
+                   << "receiver address = " << std::hex << receiver.lock().get();
+      }
 
       if (command == NULL)
       {
@@ -131,8 +135,13 @@
 
     void EmitMessage(const IMessage& message)
     {
-      LOG(TRACE) << "WebAssemblyOracle::FetchContext::EmitMessage receiver_ = "
-        << std::hex << &receiver_ << std::dec;
+      if (Orthanc::Logging::IsTraceLevelEnabled())
+      {
+        // Calling "receiver_.lock()" is expensive, hence the quick check if TRACE is enabled
+        LOG(TRACE) << "WebAssemblyOracle::FetchContext::EmitMessage receiver_ = "
+                   << std::hex << receiver_.lock().get() << std::dec;
+      }
+      
       oracle_.EmitMessage(receiver_, message);
     }
 
@@ -731,7 +740,7 @@
                                    IOracleCommand* command)
   {
     LOG(TRACE) << "WebAssemblyOracle::Schedule : receiver = "
-               << std::hex << &receiver;
+               << std::hex << receiver.get();
     
     std::unique_ptr<IOracleCommand> protection(command);
 
--- a/Resources/CMake/OrthancStoneConfiguration.cmake	Fri Jun 12 13:27:41 2020 +0200
+++ b/Resources/CMake/OrthancStoneConfiguration.cmake	Fri Jun 12 16:53:42 2020 +0200
@@ -30,10 +30,6 @@
   endif()
 endif()
 
-# "BoostExtendedConfiguration.cmake" *must* be included before
-# "OrthancFrameworkConfiguration.cmake"
-include(${CMAKE_CURRENT_LIST_DIR}/BoostExtendedConfiguration.cmake)
-
 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
 include_directories(
   ${ORTHANC_ROOT}/Core
@@ -96,6 +92,7 @@
 SET(ORTHANC_STONE_ROOT ${CMAKE_CURRENT_LIST_DIR}/../..)
 
 include(FindPkgConfig)
+include(${CMAKE_CURRENT_LIST_DIR}/BoostExtendedConfiguration.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/CairoConfiguration.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/FreetypeConfiguration.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/PixmanConfiguration.cmake)