changeset 2317:65b74046974c refactoring

removed ILoadersContext
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Sep 2026 14:09:18 +0200
parents dd85e8a55b33
children 13e46944d430
files Applications/Samples/Common/RtViewerView.h Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h OrthancStone/Sources/Loaders/DicomStructureSetLoader.h OrthancStone/Sources/Loaders/ILoaderFactory.h OrthancStone/Sources/Loaders/ILoadersContext.h OrthancStone/Sources/Loaders/LoaderStateMachine.cpp OrthancStone/Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp
diffstat 8 files changed, 1 insertions(+), 142 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Samples/Common/RtViewerView.h	Wed Sep 30 14:05:07 2026 +0200
+++ b/Applications/Samples/Common/RtViewerView.h	Wed Sep 30 14:09:18 2026 +0200
@@ -23,7 +23,6 @@
 #pragma once
 
 #include "../../../OrthancStone/Sources/Loaders/DicomStructureSetLoader.h"
-#include "../../../OrthancStone/Sources/Loaders/ILoadersContext.h"
 #include "../../../OrthancStone/Sources/Loaders/OrthancMultiframeVolumeLoader.h"
 #include "../../../OrthancStone/Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.h"
 #include "../../../OrthancStone/Sources/Messages/IMessageEmitter.h"
--- a/Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h	Wed Sep 30 14:05:07 2026 +0200
+++ b/Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h	Wed Sep 30 14:09:18 2026 +0200
@@ -23,7 +23,6 @@
 #pragma once
 
 #include "../../../../OrthancStone/Sources/Loaders/DicomResourcesLoader.h"
-#include "../../../../OrthancStone/Sources/Loaders/ILoadersContext.h"
 #include "../../../../OrthancStone/Sources/Loaders/SeriesFramesLoader.h"
 #include "../../../../OrthancStone/Sources/Loaders/SeriesThumbnailsLoader.h"
 #include "../../../../OrthancStone/Sources/Scene2DViewport/ViewportController.h"
@@ -35,7 +34,6 @@
 #include <boost/make_shared.hpp>
 
 
-using OrthancStone::ILoadersContext;
 using OrthancStone::ObserverBase;
 using OrthancStone::IViewport;
 using OrthancStone::DicomResourcesLoader;
--- a/Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h	Wed Sep 30 14:05:07 2026 +0200
+++ b/Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h	Wed Sep 30 14:09:18 2026 +0200
@@ -23,7 +23,6 @@
 #pragma once
 
 #include "../../../../OrthancStone/Sources/Loaders/DicomResourcesLoader.h"
-#include "../../../../OrthancStone/Sources/Loaders/ILoadersContext.h"
 #include "../../../../OrthancStone/Sources/Loaders/SeriesFramesLoader.h"
 #include "../../../../OrthancStone/Sources/Loaders/SeriesThumbnailsLoader.h"
 #include "../../../../OrthancStone/Sources/Scene2DViewport/ViewportController.h"
--- a/OrthancStone/Sources/Loaders/DicomStructureSetLoader.h	Wed Sep 30 14:05:07 2026 +0200
+++ b/OrthancStone/Sources/Loaders/DicomStructureSetLoader.h	Wed Sep 30 14:09:18 2026 +0200
@@ -25,7 +25,6 @@
 
 #include "../Toolbox/DicomStructureSet.h"
 #include "../Volumes/IVolumeSlicer.h"
-#include "../Loaders/ILoadersContext.h"
 #include "LoaderStateMachine.h"
 
 #include <vector>
--- a/OrthancStone/Sources/Loaders/ILoaderFactory.h	Wed Sep 30 14:05:07 2026 +0200
+++ b/OrthancStone/Sources/Loaders/ILoaderFactory.h	Wed Sep 30 14:09:18 2026 +0200
@@ -24,10 +24,10 @@
 #pragma once
 
 #include "../StoneApplication.h"
-#include "ILoadersContext.h"
 
 namespace OrthancStone
 {
+  // TODO Refactoring - class to remove
   class ILoaderFactory : public boost::noncopyable
   {
   public:
--- a/OrthancStone/Sources/Loaders/ILoadersContext.h	Wed Sep 30 14:05:07 2026 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/**
- * Stone of Orthanc
- * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
- * Department, University Hospital of Liege, Belgium
- * Copyright (C) 2017-2023 Osimis S.A., 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 "../Messages/IObserver.h"
-#include "../Messages/IObservable.h"
-#include "../Oracle/IOracleCommand.h"
-
-#include <boost/shared_ptr.hpp>
-
-namespace OrthancStone
-{
-  class ILoadersContext : public boost::noncopyable
-  {
-  public:
-    class ILock : public boost::noncopyable
-    {
-    public:
-      virtual ~ILock()
-      {
-      }
-
-      /**
-       * This method is useful for loaders that must be able to
-       * re-lock the Stone loaders context in the future (for instance
-       * to schedule new commands once some command is processed).
-       **/
-      virtual ILoadersContext& GetContext() const = 0;
-
-      /**
-       * Get a reference to the observable against which a loader must
-       * listen to be informed of messages issued by the oracle once
-       * some command is processed.
-       **/
-      virtual IObservable& GetOracleObservable() const = 0;
-
-      /**
-       * Schedule a new command for further processing by the
-       * oracle. The "receiver" argument indicates to which object the
-       * notification messages are sent by the oracle upon completion
-       * of the command. The command is possibly not directly sent to
-       * the oracle: Instead, an internal "OracleScheduler" object is
-       * often used as a priority queue to rule the order in which
-       * commands are actually sent to the oracle. Hence the
-       * "priority" argument (commands with lower value are executed
-       * first).
-       **/
-      virtual void Schedule(boost::shared_ptr<IObserver> receiver,
-                            int priority,
-                            IOracleCommand* command /* Takes ownership */) = 0;
-
-    private:
-      /**
-       * Cancel all the commands that are waiting in the
-       * "OracleScheduler" queue and that are linked to the given
-       * receiver (i.e. the observer that was specified at the time
-       * method "Schedule()" was called). This is useful for real-time
-       * processing, as it allows to replace commands that were
-       * scheduled in the past by more urgent commands.
-       *
-       * Note that this call does not affect commands that would have
-       * already be sent to the oracle. As a consequence, the receiver
-       * might still receive messages that were sent to the oracle
-       * before the cancellation (be prepared to handle such
-       * messages).
-       **/
-      virtual void CancelRequests(boost::shared_ptr<IObserver> receiver) = 0;
-
-      /**
-       * Same as "CancelRequests()", but targets all the receivers.
-       **/
-      virtual void CancelAllRequests() = 0;
-
-    public:
-      // TODO Refactoring - Remove this
-
-      /**
-       * Add a reference to the given observer in the Stone loaders
-       * context. This can be used to match the lifetime of a loader
-       * with the lifetime of the Stone context: This is useful if
-       * your Stone application does not keep a reference to the
-       * loader by itself (typically in global promises), which would
-       * make the loader disappear as soon as the scope of the
-       * variable is left.
-       **/
-      virtual void AddLoader(boost::shared_ptr<IObserver> loader) = 0;
-
-    private:
-      /**
-       * Returns the number of commands that were scheduled and
-       * processed using the "Schedule()" method. By "processed"
-       * commands, we refer to the number of commands that were either
-       * executed by the oracle, or canceled by the user. So the
-       * counting sequences are monotonically increasing over time.
-       **/
-      virtual void GetStatistics(uint64_t& scheduledCommands,
-                                 uint64_t& processedCommands) = 0;
-    };
-
-    virtual ~ILoadersContext()
-    {
-    }
-
-    /**
-     * Locks the Stone loaders context, to give access to its
-     * underlying features. This is important for Stone applications
-     * running in a multi-threaded environment, for which a global
-     * mutex is locked.
-     **/
-    virtual ILock* Lock() = 0;
-  };
-}
--- a/OrthancStone/Sources/Loaders/LoaderStateMachine.cpp	Wed Sep 30 14:05:07 2026 +0200
+++ b/OrthancStone/Sources/Loaders/LoaderStateMachine.cpp	Wed Sep 30 14:09:18 2026 +0200
@@ -23,8 +23,6 @@
 
 #include "LoaderStateMachine.h"
 
-#include "../Loaders/ILoadersContext.h"
-
 #include <OrthancException.h>
 
 namespace OrthancStone
--- a/OrthancStone/Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp	Wed Sep 30 14:05:07 2026 +0200
+++ b/OrthancStone/Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp	Wed Sep 30 14:09:18 2026 +0200
@@ -24,7 +24,6 @@
 #include "OrthancSeriesVolumeProgressiveLoader.h"
 
 #include "../StoneException.h"
-#include "../Loaders/ILoadersContext.h"
 #include "../Loaders/BasicFetchingItemsSorter.h"
 #include "../Loaders/BasicFetchingStrategy.h"
 #include "../Toolbox/GeometryToolbox.h"