Mercurial > hg > orthanc-stone
changeset 2300:e2042d2a4c32 refactoring
cont hiding old IOracle
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Sun, 27 Sep 2026 11:01:30 +0200 |
| parents | 5e19a6760208 |
| children | 728c0fa16b3f |
| files | Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp OrthancStone/Sources/Loaders/GenericLoadersContext.cpp OrthancStone/Sources/Loaders/OracleScheduler.cpp OrthancStone/Sources/Loaders/OracleScheduler.h OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyLoadersContext.cpp OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyLoadersContext.h |
| diffstat | 6 files changed, 20 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Sun Sep 27 10:46:33 2026 +0200 +++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Sun Sep 27 11:01:30 2026 +0200 @@ -5050,7 +5050,9 @@ SetHighlightedColor(OrthancStone::Color(r, g, b)); } - context_.reset(new OrthancStone::WebAssemblyLoadersContext(configuration, 1, 4, 1)); + OrthancStone::StoneApplication::Initialize(configuration); + + context_.reset(new OrthancStone::WebAssemblyLoadersContext(1, 4, 1)); static const char* const KEY_SKIP_SERIES = "SkipSeriesFromModalities"; if (parsed.isMember(KEY_SKIP_SERIES)) @@ -5059,8 +5061,6 @@ Orthanc::SerializationToolbox::ReadArrayOfStrings(modalities, parsed, KEY_SKIP_SERIES); GetResourcesLoader().SetSkipSeriesFromModalities(modalities); } - - OrthancStone::StoneApplication::Initialize(configuration); } else {
--- a/OrthancStone/Sources/Loaders/GenericLoadersContext.cpp Sun Sep 27 10:46:33 2026 +0200 +++ b/OrthancStone/Sources/Loaders/GenericLoadersContext.cpp Sun Sep 27 11:01:30 2026 +0200 @@ -104,7 +104,7 @@ unsigned int maxLowPriority) { dynamic_cast<ThreadedOracle&>(StoneApplication::GetInstance().GetOldOracle()).SetMessageEmitter(*this); - scheduler_ = OracleScheduler::Create(StoneApplication::GetInstance().GetOldOracle(), oracleObservable_, *this, + scheduler_ = OracleScheduler::Create(StoneApplication::GetInstance(), oracleObservable_, *this, maxHighPriority, maxStandardPriority, maxLowPriority); if (!scheduler_)
--- a/OrthancStone/Sources/Loaders/OracleScheduler.cpp Sun Sep 27 10:46:33 2026 +0200 +++ b/OrthancStone/Sources/Loaders/OracleScheduler.cpp Sun Sep 27 11:01:30 2026 +0200 @@ -242,7 +242,7 @@ { ModifyNumberOfActiveCommands(priority, 1); - if (oracle_.Schedule(GetSharedObserver(), command->WrapCommand(priority))) + if (application_.GetOldOracle().Schedule(GetSharedObserver(), command->WrapCommand(priority))) { /** * Executing this code if "Schedule()" returned "false" @@ -443,12 +443,12 @@ } - OracleScheduler::OracleScheduler(IOracle& oracle, + OracleScheduler::OracleScheduler(StoneApplication& application, IMessageEmitter& emitter, unsigned int maxHighPriority, unsigned int maxStandardPriority, unsigned int maxLowPriority) : - oracle_(oracle), + application_(application), emitter_(emitter), maxHighPriorityCommands_(maxHighPriority), maxStandardPriorityCommands_(maxStandardPriority), @@ -470,7 +470,7 @@ } - boost::shared_ptr<OracleScheduler> OracleScheduler::Create(IOracle& oracle, + boost::shared_ptr<OracleScheduler> OracleScheduler::Create(StoneApplication& application, IObservable& oracleObservable, IMessageEmitter& emitter, unsigned int maxHighPriority, @@ -478,7 +478,7 @@ unsigned int maxLowPriority) { boost::shared_ptr<OracleScheduler> scheduler - (new OracleScheduler(oracle, emitter, maxHighPriority, maxStandardPriority, maxLowPriority)); + (new OracleScheduler(application, emitter, maxHighPriority, maxStandardPriority, maxLowPriority)); scheduler->Register<GetOrthancImageCommand::SuccessMessage>(oracleObservable, &OracleScheduler::Handle); scheduler->Register<GetOrthancWebViewerJpegCommand::SuccessMessage>(oracleObservable, &OracleScheduler::Handle); scheduler->Register<HttpCommand::SuccessMessage>(oracleObservable, &OracleScheduler::Handle);
--- a/OrthancStone/Sources/Loaders/OracleScheduler.h Sun Sep 27 10:46:33 2026 +0200 +++ b/OrthancStone/Sources/Loaders/OracleScheduler.h Sun Sep 27 11:01:30 2026 +0200 @@ -38,6 +38,7 @@ #include "../Oracle/OracleCommandExceptionMessage.h" #include "../Oracle/OrthancRestApiCommand.h" #include "../Oracle/ReadFileCommand.h" +#include "../StoneApplication.h" #if ORTHANC_ENABLE_DCMTK == 1 # include "../Oracle/ParseDicomSuccessMessage.h" @@ -64,7 +65,7 @@ typedef std::multimap<int, ScheduledCommand*> Queue; - IOracle& oracle_; + StoneApplication& application_; IMessageEmitter& emitter_; Queue standardPriorityQueue_; Queue highPriorityQueue_; @@ -111,21 +112,21 @@ void Handle(const OracleCommandExceptionMessage& message); - OracleScheduler(IOracle& oracle, + OracleScheduler(StoneApplication& application, IMessageEmitter& emitter, unsigned int maxHighPriority, unsigned int maxStandardPriority, unsigned int maxLowPriority); public: - static boost::shared_ptr<OracleScheduler> Create(IOracle& oracle, + static boost::shared_ptr<OracleScheduler> Create(StoneApplication& application, IObservable& oracleObservable, IMessageEmitter& emitter) { - return Create(oracle, oracleObservable, emitter, 1, 4, 1); + return Create(application, oracleObservable, emitter, 1, 4, 1); } - static boost::shared_ptr<OracleScheduler> Create(IOracle& oracle, + static boost::shared_ptr<OracleScheduler> Create(StoneApplication& application, IObservable& oracleObservable, IMessageEmitter& emitter, unsigned int maxHighPriority,
--- a/OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyLoadersContext.cpp Sun Sep 27 10:46:33 2026 +0200 +++ b/OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyLoadersContext.cpp Sun Sep 27 11:01:30 2026 +0200 @@ -77,13 +77,12 @@ }; - WebAssemblyLoadersContext::WebAssemblyLoadersContext(const StoneApplication::Configuration& configuration, - unsigned int maxHighPriority, + WebAssemblyLoadersContext::WebAssemblyLoadersContext(unsigned int maxHighPriority, unsigned int maxStandardPriority, unsigned int maxLowPriority) : - oracle_(configuration) + oracle_(dynamic_cast<WebAssemblyOracle&>(StoneApplication::GetInstance().GetOldOracle())) { - scheduler_ = OracleScheduler::Create(oracle_, oracle_.GetOracleObservable(), oracle_, + scheduler_ = OracleScheduler::Create(StoneApplication::GetInstance(), oracle_.GetOracleObservable(), oracle_, maxHighPriority, maxStandardPriority, maxLowPriority); if (!scheduler_)
--- a/OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyLoadersContext.h Sun Sep 27 10:46:33 2026 +0200 +++ b/OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyLoadersContext.h Sun Sep 27 11:01:30 2026 +0200 @@ -37,13 +37,12 @@ private: class Locker; - WebAssemblyOracle oracle_; + WebAssemblyOracle& oracle_; boost::shared_ptr<OracleScheduler> scheduler_; std::list< boost::shared_ptr<IObserver> > loaders_; public: - WebAssemblyLoadersContext(const StoneApplication::Configuration& configuration, - unsigned int maxHighPriority, + WebAssemblyLoadersContext(unsigned int maxHighPriority, unsigned int maxStandardPriority, unsigned int maxLowPriority);
