changeset 2318:13e46944d430 refactoring

removed interface ILoaderFactory
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Sep 2026 14:25:54 +0200
parents 65b74046974c
children 1bb0f5f65063
files Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h OrthancStone/Sources/Loaders/DicomResourcesLoader.h OrthancStone/Sources/Loaders/DicomVolumeLoader.h OrthancStone/Sources/Loaders/ILoaderFactory.h OrthancStone/Sources/Loaders/SeriesFramesLoader.h OrthancStone/Sources/Loaders/SeriesMetadataLoader.h OrthancStone/Sources/Loaders/SeriesThumbnailsLoader.h
diffstat 7 files changed, 5 insertions(+), 100 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h	Wed Sep 30 14:09:18 2026 +0200
+++ b/Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h	Wed Sep 30 14:25:54 2026 +0200
@@ -309,12 +309,7 @@
       application->loadThumbnails_ = loadThumbnails;
 
       application->resourcesLoader_ = DicomResourcesLoader::Create(context);
-
-      {
-        SeriesThumbnailsLoader::Factory f;
-        f.SetPriority(PRIORITY_THUMBNAILS);
-        application->thumbnailsLoader_ = boost::dynamic_pointer_cast<SeriesThumbnailsLoader>(f.Create(context));
-      }
+      application->thumbnailsLoader_ = SeriesThumbnailsLoader::Create(context, PRIORITY_THUMBNAILS);
 
       application->Register<OrthancRestApiCommand::SuccessMessage>(
         context.GetOracleObservable(), &WebViewerLoaders::HandleOrthancRestApi);
--- a/OrthancStone/Sources/Loaders/DicomResourcesLoader.h	Wed Sep 30 14:09:18 2026 +0200
+++ b/OrthancStone/Sources/Loaders/DicomResourcesLoader.h	Wed Sep 30 14:25:54 2026 +0200
@@ -34,7 +34,6 @@
 #include "../Oracle/OrthancRestApiCommand.h"
 #include "../Oracle/ReadFileCommand.h"
 #include "DicomSource.h"
-#include "ILoaderFactory.h"
 #include "LoadedDicomResources.h"
 #include "OracleScheduler.h"
 
@@ -152,16 +151,6 @@
     };
 
 
-    class Factory : public ILoaderFactory
-    {
-    public:
-      virtual boost::shared_ptr<IObserver> Create(StoneApplication::Context& stone) ORTHANC_OVERRIDE
-      {
-        return DicomResourcesLoader::Create(stone);
-      }
-    };
-
-
     static boost::shared_ptr<DicomResourcesLoader> Create(StoneApplication::Context& stone);
 
     void ScheduleGetDicomWeb(boost::shared_ptr<LoadedDicomResources> target,
--- a/OrthancStone/Sources/Loaders/DicomVolumeLoader.h	Wed Sep 30 14:09:18 2026 +0200
+++ b/OrthancStone/Sources/Loaders/DicomVolumeLoader.h	Wed Sep 30 14:25:54 2026 +0200
@@ -92,7 +92,7 @@
     };
 
 
-    class Factory : public ILoaderFactory
+    class Factory : public boost::noncopyable  // TODO Refactoring - Remove this?
     {
     private:
       SeriesFramesLoader::Factory  framesFactory_;
@@ -114,7 +114,7 @@
         framesFactory_.SetDicomDir(dicomDirPath, dicomDir);
       }
 
-      virtual boost::shared_ptr<IObserver> Create(StoneApplication::Context& context) ORTHANC_OVERRIDE;
+      boost::shared_ptr<IObserver> Create(StoneApplication::Context& context);
     };
 
     bool IsValid() const
--- a/OrthancStone/Sources/Loaders/ILoaderFactory.h	Wed Sep 30 14:09:18 2026 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +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 "../StoneApplication.h"
-
-namespace OrthancStone
-{
-  // TODO Refactoring - class to remove
-  class ILoaderFactory : public boost::noncopyable
-  {
-  public:
-    virtual ~ILoaderFactory()
-    {
-    }
-
-    /**
-     * Factory function that creates a new loader, to be used by the
-     * Stone loaders context.
-     **/
-    virtual boost::shared_ptr<IObserver> Create(StoneApplication::Context& context) = 0;
-  };
-}
--- a/OrthancStone/Sources/Loaders/SeriesFramesLoader.h	Wed Sep 30 14:09:18 2026 +0200
+++ b/OrthancStone/Sources/Loaders/SeriesFramesLoader.h	Wed Sep 30 14:25:54 2026 +0200
@@ -32,7 +32,6 @@
 #include "OracleScheduler.h"
 #include "DicomSource.h"
 #include "SeriesOrderedFrames.h"
-#include "ILoaderFactory.h"
 
 namespace OrthancStone
 {  
@@ -142,7 +141,7 @@
     };
 
 
-    class Factory : public ILoaderFactory
+    class Factory : public boost::noncopyable  // TODO Refactoring - remove this?
     {
     private:
       LoadedDicomResources&                    instances_;
@@ -159,7 +158,7 @@
       void SetDicomDir(const std::string& dicomDirPath,
                        boost::shared_ptr<LoadedDicomResources> dicomDir);
 
-      virtual boost::shared_ptr<IObserver> Create(StoneApplication::Context& context) ORTHANC_OVERRIDE;
+      boost::shared_ptr<IObserver> Create(StoneApplication::Context& context);
     };
 
     const SeriesOrderedFrames& GetOrderedFrames() const
--- a/OrthancStone/Sources/Loaders/SeriesMetadataLoader.h	Wed Sep 30 14:09:18 2026 +0200
+++ b/OrthancStone/Sources/Loaders/SeriesMetadataLoader.h	Wed Sep 30 14:25:54 2026 +0200
@@ -127,16 +127,6 @@
     };
 
   
-    class Factory : public ILoaderFactory
-    {
-    public:
-      virtual boost::shared_ptr<IObserver> Create(StoneApplication::Context& context) ORTHANC_OVERRIDE
-      {
-        return SeriesMetadataLoader::Create(context);
-      }
-    };
-
-
     static boost::shared_ptr<SeriesMetadataLoader> Create(StoneApplication::Context& context);
 
   
--- a/OrthancStone/Sources/Loaders/SeriesThumbnailsLoader.h	Wed Sep 30 14:09:18 2026 +0200
+++ b/OrthancStone/Sources/Loaders/SeriesThumbnailsLoader.h	Wed Sep 30 14:25:54 2026 +0200
@@ -35,7 +35,6 @@
 #include "../Oracle/OracleCommandExceptionMessage.h"
 #include "../Oracle/OrthancRestApiCommand.h"
 #include "DicomSource.h"
-#include "ILoaderFactory.h"
 #include "OracleScheduler.h"
 
 
@@ -178,29 +177,6 @@
                            int priority);
     
   public:
-    class Factory : public ILoaderFactory
-    {
-    private:
-      int priority_;
-
-    public:
-      Factory() :
-        priority_(0)
-      {
-      }
-
-      void SetPriority(int priority)
-      {
-        priority_ = priority;
-      }
-
-      virtual boost::shared_ptr<IObserver> Create(StoneApplication::Context& context)
-      {
-        return SeriesThumbnailsLoader::Create(context, priority_);
-      }
-    };
-
-
     virtual ~SeriesThumbnailsLoader()
     {
       Clear();