changeset 1226:05d05cba0f4f broker

explicitely tagging LockingEmitter as deprecated
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 08 Dec 2019 11:57:46 +0100
parents 16738485e457
children a1c0c9c9f9af
files Applications/Generic/GuiAdapter.cpp Applications/Generic/GuiAdapter.h Framework/Deprecated/Loaders/LoaderCache.cpp Framework/Deprecated/Loaders/LoaderCache.h Framework/Deprecated/Messages/LockingEmitter.cpp Framework/Deprecated/Messages/LockingEmitter.h Framework/Messages/LockingEmitter.cpp Framework/Messages/LockingEmitter.h Resources/CMake/OrthancStoneConfiguration.cmake
diffstat 9 files changed, 147 insertions(+), 153 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Generic/GuiAdapter.cpp	Sun Dec 08 11:45:09 2019 +0100
+++ b/Applications/Generic/GuiAdapter.cpp	Sun Dec 08 11:57:46 2019 +0100
@@ -31,7 +31,7 @@
 #endif
 
 #if ORTHANC_ENABLE_THREADS == 1
-#  include "../../Framework/Messages/LockingEmitter.h"
+#  include "../../Framework/Deprecated/Messages/LockingEmitter.h"
 #endif
 
 namespace OrthancStone
--- a/Applications/Generic/GuiAdapter.h	Sun Dec 08 11:45:09 2019 +0100
+++ b/Applications/Generic/GuiAdapter.h	Sun Dec 08 11:57:46 2019 +0100
@@ -43,8 +43,8 @@
 
 #include "../../Framework/StoneException.h"
 
-#if ORTHANC_ENABLE_THREADS != 1
-# include "../../Framework/Messages/LockingEmitter.h"
+#if ORTHANC_ENABLE_THREADS == 1
+# include "../../Framework/Deprecated/Messages/LockingEmitter.h"
 #endif
 
 #include <vector>
@@ -95,11 +95,6 @@
   struct GuiAdapterWheelEvent;
   struct GuiAdapterKeyboardEvent;
 
-  namespace Deprecated
-  {
-    class LockingEmitter;
-  }
-    
 #if 1
   typedef bool (*OnMouseEventFunc)(std::string canvasId, const GuiAdapterMouseEvent* mouseEvent, void* userData);
   typedef bool (*OnMouseWheelFunc)(std::string canvasId, const GuiAdapterWheelEvent* wheelEvent, void* userData);
--- a/Framework/Deprecated/Loaders/LoaderCache.cpp	Sun Dec 08 11:45:09 2019 +0100
+++ b/Framework/Deprecated/Loaders/LoaderCache.cpp	Sun Dec 08 11:57:46 2019 +0100
@@ -64,7 +64,7 @@
   }
 #else
   LoaderCache::LoaderCache(OrthancStone::ThreadedOracle& oracle,
-                           OrthancStone::Deprecated::LockingEmitter& lockingEmitter)
+                           LockingEmitter& lockingEmitter)
     : oracle_(oracle)
     , lockingEmitter_(lockingEmitter)
   {
@@ -97,7 +97,7 @@
 #if ORTHANC_ENABLE_WASM == 1
           loader.reset(new OrthancSeriesVolumeProgressiveLoader(volumeImage, oracle_, oracle_));
 #else
-          OrthancStone::Deprecated::LockingEmitter::WriterLock lock(lockingEmitter_);
+          LockingEmitter::WriterLock lock(lockingEmitter_);
           loader.reset(new OrthancSeriesVolumeProgressiveLoader(volumeImage, oracle_, lock.GetOracleObservable()));
 #endif
 //          LOG(TRACE) << "LoaderCache::GetSeriesVolumeProgressiveLoader : loader = " << loader.get();
@@ -166,7 +166,7 @@
 #if ORTHANC_ENABLE_WASM == 1
           loader.reset(new OrthancMultiframeVolumeLoader(volumeImage, oracle_, oracle_));
 #else
-          OrthancStone::Deprecated::LockingEmitter::WriterLock lock(lockingEmitter_);
+          LockingEmitter::WriterLock lock(lockingEmitter_);
           loader.reset(new OrthancMultiframeVolumeLoader(volumeImage, oracle_, lock.GetOracleObservable()));
 #endif
           loader->LoadInstance(instanceUuid);
@@ -267,7 +267,7 @@
 #if ORTHANC_ENABLE_WASM == 1
           loader.reset(new DicomStructureSetLoader(oracle_, oracle_));
 #else
-          OrthancStone::Deprecated::LockingEmitter::WriterLock lock(lockingEmitter_);
+          LockingEmitter::WriterLock lock(lockingEmitter_);
           loader.reset(new DicomStructureSetLoader(oracle_, lock.GetOracleObservable()));
 #endif
           loader->LoadInstance(inInstanceUuid, initiallyVisibleStructures);
@@ -363,7 +363,7 @@
   void LoaderCache::ClearCache()
   {
 #if ORTHANC_ENABLE_WASM != 1
-    OrthancStone::Deprecated::LockingEmitter::WriterLock lock(lockingEmitter_);
+    LockingEmitter::WriterLock lock(lockingEmitter_);
 #endif
     
 //#ifndef NDEBUG
--- a/Framework/Deprecated/Loaders/LoaderCache.h	Sun Dec 08 11:45:09 2019 +0100
+++ b/Framework/Deprecated/Loaders/LoaderCache.h	Sun Dec 08 11:57:46 2019 +0100
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include "../../Messages/LockingEmitter.h"
+#include "../Messages/LockingEmitter.h"
 #include "../../Volumes/DicomVolumeImageMPRSlicer.h"
 #include "OrthancSeriesVolumeProgressiveLoader.h"
 #include "OrthancMultiframeVolumeLoader.h"
@@ -49,7 +49,7 @@
 #if ORTHANC_ENABLE_WASM == 1
     LoaderCache(OrthancStone::WebAssemblyOracle& oracle);
 #else
-    LoaderCache(OrthancStone::ThreadedOracle& oracle, OrthancStone::Deprecated::LockingEmitter& lockingEmitter);
+    LoaderCache(OrthancStone::ThreadedOracle& oracle, LockingEmitter& lockingEmitter);
 #endif
 
     boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader>
@@ -84,7 +84,7 @@
     OrthancStone::WebAssemblyOracle& oracle_;
 #else
     OrthancStone::ThreadedOracle& oracle_;
-    OrthancStone::Deprecated::LockingEmitter& lockingEmitter_;
+    LockingEmitter& lockingEmitter_;
 #endif
 
     std::map<std::string, boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> >
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Framework/Deprecated/Messages/LockingEmitter.cpp	Sun Dec 08 11:57:46 2019 +0100
@@ -0,0 +1,40 @@
+/**
+ * Stone of Orthanc
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2019 Osimis S.A., Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero 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
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include "LockingEmitter.h"
+
+#include <Core/OrthancException.h>
+
+namespace Deprecated
+{
+  void LockingEmitter::EmitMessage(boost::weak_ptr<OrthancStone::IObserver> observer,
+                                   const OrthancStone::IMessage& message)
+  {
+    try
+    {
+      boost::unique_lock<boost::shared_mutex>  lock(mutex_);
+      oracleObservable_.EmitMessage(observer, message);
+    }
+    catch (Orthanc::OrthancException& e)
+    {
+      LOG(ERROR) << "Exception while emitting a message: " << e.What();
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Framework/Deprecated/Messages/LockingEmitter.h	Sun Dec 08 11:57:46 2019 +0100
@@ -0,0 +1,89 @@
+/**
+ * Stone of Orthanc
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2019 Osimis S.A., Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero 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
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#pragma once
+
+#include <Core/Enumerations.h>
+#include <Core/OrthancException.h>
+
+#include "../../Messages/IMessageEmitter.h"
+#include "../../Messages/IObservable.h"
+
+#include <Core/Enumerations.h>  // For ORTHANC_OVERRIDE
+
+#include <boost/thread/shared_mutex.hpp>
+
+namespace Deprecated
+{
+  /**
+   * This class is used when using the ThreadedOracle : since messages
+   * can be sent from multiple Oracle threads, this IMessageEmitter
+   * implementation serializes the callbacks.
+   * 
+   * The internal mutex used in Oracle messaging can also be used to 
+   * protect the application data. Thus, this class can be used as a single
+   * application-wide mutex.
+   */
+  class LockingEmitter : public OrthancStone::IMessageEmitter
+  {
+  private:
+    boost::shared_mutex        mutex_;
+    OrthancStone::IObservable  oracleObservable_;
+
+  public:
+    virtual void EmitMessage(boost::weak_ptr<OrthancStone::IObserver> observer,
+                             const OrthancStone::IMessage& message) ORTHANC_OVERRIDE;
+
+
+    class ReaderLock : public boost::noncopyable
+    {
+    private:
+      LockingEmitter& that_;
+      boost::shared_lock<boost::shared_mutex>  lock_;
+
+    public:
+      ReaderLock(LockingEmitter& that) :
+        that_(that),
+        lock_(that.mutex_)
+      {
+      }
+    };
+
+
+    class WriterLock : public boost::noncopyable
+    {
+    private:
+      LockingEmitter& that_;
+      boost::unique_lock<boost::shared_mutex>  lock_;
+
+    public:
+      WriterLock(LockingEmitter& that) :
+        that_(that),
+        lock_(that.mutex_)
+      {
+      }
+
+      OrthancStone::IObservable& GetOracleObservable()
+      {
+        return that_.oracleObservable_;
+      }
+    };
+  };
+}
--- a/Framework/Messages/LockingEmitter.cpp	Sun Dec 08 11:45:09 2019 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/**
- * Stone of Orthanc
- * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
- * Department, University Hospital of Liege, Belgium
- * Copyright (C) 2017-2019 Osimis S.A., Belgium
- *
- * This program is free software: you can redistribute it and/or
- * modify it under the terms of the GNU Affero 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
- * Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#include "LockingEmitter.h"
-
-#include <Core/OrthancException.h>
-
-namespace OrthancStone
-{
-  namespace Deprecated
-  {
-    void LockingEmitter::EmitMessage(boost::weak_ptr<IObserver> observer,
-                                     const IMessage& message)
-    {
-      try
-      {
-        boost::unique_lock<boost::shared_mutex>  lock(mutex_);
-        oracleObservable_.EmitMessage(observer, message);
-      }
-      catch (Orthanc::OrthancException& e)
-      {
-        LOG(ERROR) << "Exception while emitting a message: " << e.What();
-      }
-    }
-  }
-}
--- a/Framework/Messages/LockingEmitter.h	Sun Dec 08 11:45:09 2019 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/**
- * Stone of Orthanc
- * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
- * Department, University Hospital of Liege, Belgium
- * Copyright (C) 2017-2019 Osimis S.A., Belgium
- *
- * This program is free software: you can redistribute it and/or
- * modify it under the terms of the GNU Affero 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
- * Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#pragma once
-
-#include <Core/Enumerations.h>
-#include <Core/OrthancException.h>
-
-#include "IMessageEmitter.h"
-#include "IObservable.h"
-
-#include <Core/Enumerations.h>  // For ORTHANC_OVERRIDE
-
-#include <boost/thread/shared_mutex.hpp>
-
-namespace OrthancStone
-{
-  namespace Deprecated
-  {
-    /**
-     * This class is used when using the ThreadedOracle : since messages
-     * can be sent from multiple Oracle threads, this IMessageEmitter
-     * implementation serializes the callbacks.
-     * 
-     * The internal mutex used in Oracle messaging can also be used to 
-     * protect the application data. Thus, this class can be used as a single
-     * application-wide mutex.
-     */
-    class LockingEmitter : public IMessageEmitter
-    {
-    private:
-      boost::shared_mutex  mutex_;
-      IObservable          oracleObservable_;
-
-    public:
-      virtual void EmitMessage(boost::weak_ptr<IObserver> observer,
-                               const IMessage& message) ORTHANC_OVERRIDE;
-
-
-      class ReaderLock : public boost::noncopyable
-      {
-      private:
-        LockingEmitter& that_;
-        boost::shared_lock<boost::shared_mutex>  lock_;
-
-      public:
-        ReaderLock(LockingEmitter& that) :
-        that_(that),
-        lock_(that.mutex_)
-        {
-        }
-      };
-
-
-      class WriterLock : public boost::noncopyable
-      {
-      private:
-        LockingEmitter& that_;
-        boost::unique_lock<boost::shared_mutex>  lock_;
-
-      public:
-        WriterLock(LockingEmitter& that) :
-        that_(that),
-        lock_(that.mutex_)
-        {
-        }
-
-        IObservable& GetOracleObservable()
-        {
-          return that_.oracleObservable_;
-        }
-      };
-    };
-  }
-}
--- a/Resources/CMake/OrthancStoneConfiguration.cmake	Sun Dec 08 11:45:09 2019 +0100
+++ b/Resources/CMake/OrthancStoneConfiguration.cmake	Sun Dec 08 11:57:46 2019 +0100
@@ -339,6 +339,13 @@
       )
   endif()
 
+  if (ENABLE_THREADS)
+    list(APPEND ORTHANC_STONE_SOURCES
+      ${ORTHANC_STONE_ROOT}/Framework/Deprecated/Messages/LockingEmitter.cpp
+      ${ORTHANC_STONE_ROOT}/Framework/Deprecated/Messages/LockingEmitter.h
+      )
+  endif()
+
   list(APPEND ORTHANC_STONE_SOURCES
     ${ORTHANC_STONE_ROOT}/Applications/IStoneApplication.h
     ${ORTHANC_STONE_ROOT}/Applications/StoneApplicationContext.cpp
@@ -428,8 +435,6 @@
 
 if (ENABLE_THREADS)
   list(APPEND ORTHANC_STONE_SOURCES
-    ${ORTHANC_STONE_ROOT}/Framework/Messages/LockingEmitter.cpp
-    ${ORTHANC_STONE_ROOT}/Framework/Messages/LockingEmitter.h
     ${ORTHANC_STONE_ROOT}/Framework/Oracle/ThreadedOracle.cpp
     ${ORTHANC_STONE_ROOT}/Framework/Oracle/GenericOracleRunner.cpp
     )