# HG changeset patch # User am@osimis.io # Date 1538733456 -7200 # Node ID b66d13708f40582fb682d553adf3e3cce1646ff7 # Parent aad37d0b64077fcc03e32bfd09e8f772f197fac2 cleanup diff -r aad37d0b6407 -r b66d13708f40 Applications/Samples/SimpleViewerApplication.h --- a/Applications/Samples/SimpleViewerApplication.h Fri Oct 05 10:38:16 2018 +0200 +++ b/Applications/Samples/SimpleViewerApplication.h Fri Oct 05 11:57:36 2018 +0200 @@ -279,8 +279,10 @@ mainLayout_->AddWidget(thumbnailsLayout_); mainLayout_->AddWidget(mainWidget_); + orthancApiClient_.reset(new OrthancApiClient(IObserver::broker_, context_->GetWebService())); + // sources - smartLoader_.reset(new SmartLoader(IObserver::broker_, context_->GetWebService())); + smartLoader_.reset(new SmartLoader(IObserver::broker_, *orthancApiClient_)); smartLoader_->SetImageQuality(SliceImageQuality_FullPam); mainLayout_->SetTransmitMouseOver(true); @@ -292,7 +294,6 @@ statusBar.SetMessage("Use the key \"s\" to reinitialize the layout"); statusBar.SetMessage("Use the key \"n\" to go to next image in the main viewport"); - orthancApiClient_.reset(new OrthancApiClient(IObserver::broker_, context_->GetWebService())); if (parameters.count("studyId") < 1) { diff -r aad37d0b6407 -r b66d13708f40 Framework/Messages/IObservable.h --- a/Framework/Messages/IObservable.h Fri Oct 05 10:38:16 2018 +0200 +++ b/Framework/Messages/IObservable.h Fri Oct 05 11:57:36 2018 +0200 @@ -71,7 +71,8 @@ for (Forwarders::iterator it = forwarders_.begin(); it != forwarders_.end(); ++it) { - broker_.Unregister(dynamic_cast(**it)); + IMessageForwarder* fw = *it; + broker_.Unregister(dynamic_cast(*fw)); } } diff -r aad37d0b6407 -r b66d13708f40 Framework/Messages/MessageForwarder.h --- a/Framework/Messages/MessageForwarder.h Fri Oct 05 10:38:16 2018 +0200 +++ b/Framework/Messages/MessageForwarder.h Fri Oct 05 11:57:36 2018 +0200 @@ -31,12 +31,13 @@ class IObservable; - class IMessageForwarder : public boost::noncopyable + class IMessageForwarder : public IObserver { IObservable& emitter_; public: - IMessageForwarder(IObservable& emitter) - : emitter_(emitter) + IMessageForwarder(MessageBroker& broker, IObservable& emitter) + : IObserver(broker), + emitter_(emitter) {} virtual ~IMessageForwarder() {} @@ -64,14 +65,13 @@ * B.RegisterObserverCallback(new Callable(*this, &B::MyCallback)) // where this is C */ template - class MessageForwarder : public IMessageForwarder, public IObserver, public Callable, TMessage> + class MessageForwarder : public IMessageForwarder, public Callable, TMessage> { public: MessageForwarder(MessageBroker& broker, IObservable& emitter // the object that will emit the messages to forward ) - : IMessageForwarder(emitter), - IObserver(broker), + : IMessageForwarder(broker, emitter), Callable, TMessage>(*this, &MessageForwarder::ForwardMessage) { RegisterForwarderInEmitter(); diff -r aad37d0b6407 -r b66d13708f40 Framework/SmartLoader.cpp --- a/Framework/SmartLoader.cpp Fri Oct 05 10:38:16 2018 +0200 +++ b/Framework/SmartLoader.cpp Fri Oct 05 11:57:36 2018 +0200 @@ -25,12 +25,11 @@ namespace OrthancStone { - SmartLoader::SmartLoader(MessageBroker& broker, IWebService& webService) : + SmartLoader::SmartLoader(MessageBroker& broker, OrthancApiClient& orthancApiClient) : IObservable(broker), IObserver(broker), imageQuality_(SliceImageQuality_FullPam), - webService_(webService), - orthancApiClient_(broker, webService) + orthancApiClient_(orthancApiClient) { } diff -r aad37d0b6407 -r b66d13708f40 Framework/SmartLoader.h --- a/Framework/SmartLoader.h Fri Oct 05 10:38:16 2018 +0200 +++ b/Framework/SmartLoader.h Fri Oct 05 11:57:36 2018 +0200 @@ -24,7 +24,6 @@ #include "Layers/ILayerSource.h" #include "Messages/IObservable.h" -#include "../Platforms/Generic/OracleWebService.h" #include "Toolbox/OrthancApiClient.h" namespace OrthancStone @@ -32,13 +31,12 @@ class SmartLoader : public IObservable, IObserver { SliceImageQuality imageQuality_; - IWebService& webService_; - OrthancApiClient orthancApiClient_; + OrthancApiClient& orthancApiClient_; int studyListRequest_; public: - SmartLoader(MessageBroker& broker, IWebService& webService); // TODO: add maxPreloadStorageSizeInBytes + SmartLoader(MessageBroker& broker, OrthancApiClient& orthancApiClient); // TODO: add maxPreloadStorageSizeInBytes void PreloadStudy(const std::string studyId); void PreloadSeries(const std::string seriesId);