# HG changeset patch # User Sebastien Jodogne # Date 1790774787 -7200 # Node ID c03b0c89c458369244e243741ccfdfe993fb3db7 # Parent 1bb0f5f65063dbb2fa526e92e233c0f34c98e8c1 removed class SeriesFramesLoader::Factory diff -r 1bb0f5f65063 -r c03b0c89c458 Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h --- a/Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h Wed Sep 30 15:13:50 2026 +0200 +++ b/Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h Wed Sep 30 15:26:27 2026 +0200 @@ -172,9 +172,7 @@ { std::unique_ptr lock(context_.GetEnvironment().AcquireLock()); - SeriesFramesLoader::Factory f(*message.GetResources()); - - framesLoader_ = boost::dynamic_pointer_cast(f.Create(context_)); + framesLoader_ = SeriesFramesLoader::Create(context_, *message.GetResources()); Register( *framesLoader_, &SdlSimpleViewerApplication::Handle); diff -r 1bb0f5f65063 -r c03b0c89c458 Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h --- a/Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h Wed Sep 30 15:13:50 2026 +0200 +++ b/Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h Wed Sep 30 15:26:27 2026 +0200 @@ -78,9 +78,8 @@ { std::unique_ptr lock(context_.GetEnvironment().AcquireLock()); - SeriesFramesLoader::Factory f(*message.GetResources()); - framesLoader_ = boost::dynamic_pointer_cast(f.Create(context_)); + framesLoader_ = SeriesFramesLoader::Create(context_, *message.GetResources()); Register(*framesLoader_, &SingleFrameViewerApplication::Handle); assert(message.HasUserPayload()); diff -r 1bb0f5f65063 -r c03b0c89c458 OrthancStone/Sources/Loaders/SeriesFramesLoader.cpp --- a/OrthancStone/Sources/Loaders/SeriesFramesLoader.cpp Wed Sep 30 15:13:50 2026 +0200 +++ b/OrthancStone/Sources/Loaders/SeriesFramesLoader.cpp Wed Sep 30 15:26:27 2026 +0200 @@ -304,25 +304,30 @@ } - void SeriesFramesLoader::Factory::SetDicomDir(const std::string& dicomDirPath, - boost::shared_ptr dicomDir) + boost::shared_ptr SeriesFramesLoader::Create(StoneApplication::Context& context, + LoadedDicomResources& instances) { - dicomDirPath_ = dicomDirPath; - dicomDir_ = dicomDir; + const std::string dicomDirPath; + const boost::shared_ptr dicomDir; + return Create(context, instances, dicomDirPath, dicomDir); } - boost::shared_ptr SeriesFramesLoader::Factory::Create(StoneApplication::Context& stone) + boost::shared_ptr SeriesFramesLoader::Create(StoneApplication::Context& context, + LoadedDicomResources& instances, + const std::string& dicomDirPath, + boost::shared_ptr dicomDir) { boost::shared_ptr loader( - new SeriesFramesLoader(stone, instances_, dicomDirPath_, dicomDir_)); - loader->Register(stone.GetOracleObservable(), &SeriesFramesLoader::Handle); - loader->Register(stone.GetOracleObservable(), &SeriesFramesLoader::Handle); - loader->Register(stone.GetOracleObservable(), &SeriesFramesLoader::Handle); - loader->Register(stone.GetOracleObservable(), &SeriesFramesLoader::Handle); + new SeriesFramesLoader(context, instances, dicomDirPath, dicomDir)); + + loader->Register(context.GetOracleObservable(), &SeriesFramesLoader::Handle); + loader->Register(context.GetOracleObservable(), &SeriesFramesLoader::Handle); + loader->Register(context.GetOracleObservable(), &SeriesFramesLoader::Handle); + loader->Register(context.GetOracleObservable(), &SeriesFramesLoader::Handle); #if ORTHANC_ENABLE_DCMTK == 1 - loader->Register(stone.GetOracleObservable(), &SeriesFramesLoader::Handle); + loader->Register(context.GetOracleObservable(), &SeriesFramesLoader::Handle); #endif return loader; diff -r 1bb0f5f65063 -r c03b0c89c458 OrthancStone/Sources/Loaders/SeriesFramesLoader.h --- a/OrthancStone/Sources/Loaders/SeriesFramesLoader.h Wed Sep 30 15:13:50 2026 +0200 +++ b/OrthancStone/Sources/Loaders/SeriesFramesLoader.h Wed Sep 30 15:26:27 2026 +0200 @@ -141,25 +141,13 @@ }; - class Factory : public boost::noncopyable // TODO Refactoring - remove this? - { - private: - LoadedDicomResources& instances_; - std::string dicomDirPath_; - boost::shared_ptr dicomDir_; + static boost::shared_ptr Create(StoneApplication::Context& context, + LoadedDicomResources& instances); - public: - // No "const" because "LoadedDicomResources::GetResource()" will call "Flatten()" - explicit Factory(LoadedDicomResources& instances) : - instances_(instances) - { - } - - void SetDicomDir(const std::string& dicomDirPath, - boost::shared_ptr dicomDir); - - boost::shared_ptr Create(StoneApplication::Context& context); - }; + static boost::shared_ptr Create(StoneApplication::Context& context, + LoadedDicomResources& instances, + const std::string& dicomDirPath, + boost::shared_ptr dicomDir); const SeriesOrderedFrames& GetOrderedFrames() const {