Mercurial > hg > orthanc-stone
changeset 334:c34784e5f299 am-2
compatibility fixes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 18 Oct 2018 09:02:24 +0200 |
parents | 08683537a227 |
children | 3e42fc27eb91 |
files | Applications/Generic/NativeStoneApplicationContext.h Applications/Samples/SimpleViewerApplicationSingleFile.h Applications/Samples/SingleFrameApplication.h Applications/Samples/SingleFrameEditorApplication.h Framework/SmartLoader.cpp Framework/SmartLoader.h Framework/Toolbox/OrthancApiClient.cpp Framework/Toolbox/OrthancSlicesLoader.cpp Platforms/Generic/WebServiceCommandBase.h |
diffstat | 9 files changed, 86 insertions(+), 63 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/Generic/NativeStoneApplicationContext.h Wed Oct 17 19:42:56 2018 +0200 +++ b/Applications/Generic/NativeStoneApplicationContext.h Thu Oct 18 09:02:24 2018 +0200 @@ -37,11 +37,11 @@ static void UpdateThread(NativeStoneApplicationContext* that); - boost::mutex globalMutex_; - std::unique_ptr<WidgetViewport> centralViewport_; - boost::thread updateThread_; - bool stopped_; - unsigned int updateDelayInMs_; + boost::mutex globalMutex_; + std::auto_ptr<WidgetViewport> centralViewport_; + boost::thread updateThread_; + bool stopped_; + unsigned int updateDelayInMs_; public: class GlobalMutexLocker: public boost::noncopyable @@ -50,15 +50,22 @@ public: GlobalMutexLocker(NativeStoneApplicationContext& that): lock_(that.globalMutex_) - {} + { + } }; NativeStoneApplicationContext(); - virtual ~NativeStoneApplicationContext() {} + virtual ~NativeStoneApplicationContext() + { + } virtual IWidget& SetCentralWidget(IWidget* widget); // Takes ownership - IViewport& GetCentralViewport() {return *(centralViewport_.get());} + + IViewport& GetCentralViewport() + { + return *(centralViewport_.get()); + } void Start(); @@ -68,6 +75,5 @@ { updateDelayInMs_ = delayInMs; } - }; }
--- a/Applications/Samples/SimpleViewerApplicationSingleFile.h Wed Oct 17 19:42:56 2018 +0200 +++ b/Applications/Samples/SimpleViewerApplicationSingleFile.h Thu Oct 18 09:02:24 2018 +0200 @@ -212,22 +212,23 @@ Tools_CircleMeasure }; - Tools currentTool_; - std::unique_ptr<MainWidgetInteractor> mainWidgetInteractor_; - std::unique_ptr<ThumbnailInteractor> thumbnailInteractor_; - LayoutWidget* mainLayout_; - LayoutWidget* thumbnailsLayout_; - std::vector<LayerWidget*> thumbnails_; - std::map<std::string, std::vector<std::string>> instancesIdsPerSeriesId_; + Tools currentTool_; + std::auto_ptr<MainWidgetInteractor> mainWidgetInteractor_; + std::auto_ptr<ThumbnailInteractor> thumbnailInteractor_; + LayoutWidget* mainLayout_; + LayoutWidget* thumbnailsLayout_; + std::vector<LayerWidget*> thumbnails_; + + std::map<std::string, std::vector<std::string> > instancesIdsPerSeriesId_; std::map<std::string, Json::Value> seriesTags_; - unsigned int currentInstanceIndex_; - OrthancStone::WidgetViewport* wasmViewport1_; - OrthancStone::WidgetViewport* wasmViewport2_; + unsigned int currentInstanceIndex_; + OrthancStone::WidgetViewport* wasmViewport1_; + OrthancStone::WidgetViewport* wasmViewport2_; - IStatusBar* statusBar_; - std::unique_ptr<SmartLoader> smartLoader_; - std::unique_ptr<OrthancApiClient> orthancApiClient_; + IStatusBar* statusBar_; + std::auto_ptr<SmartLoader> smartLoader_; + std::auto_ptr<OrthancApiClient> orthancApiClient_; public: SimpleViewerApplication(MessageBroker& broker) :
--- a/Applications/Samples/SingleFrameApplication.h Wed Oct 17 19:42:56 2018 +0200 +++ b/Applications/Samples/SingleFrameApplication.h Thu Oct 18 09:02:24 2018 +0200 @@ -184,11 +184,10 @@ mainWidget_->FitContent(); } - std::unique_ptr<Interactor> mainWidgetInteractor_; - std::unique_ptr<OrthancApiClient> orthancApiClient_; - - const OrthancFrameLayerSource* source_; - unsigned int slice_; + std::auto_ptr<Interactor> mainWidgetInteractor_; + std::auto_ptr<OrthancApiClient> orthancApiClient_; + const OrthancFrameLayerSource* source_; + unsigned int slice_; public: SingleFrameApplication(MessageBroker& broker) :
--- a/Applications/Samples/SingleFrameEditorApplication.h Wed Oct 17 19:42:56 2018 +0200 +++ b/Applications/Samples/SingleFrameEditorApplication.h Thu Oct 18 09:02:24 2018 +0200 @@ -157,12 +157,11 @@ mainWidget_->FitContent(); } - std::unique_ptr<Interactor> mainWidgetInteractor_; - std::unique_ptr<OrthancApiClient> orthancApiClient_; - Tools currentTool_; - - const OrthancFrameLayerSource* source_; - unsigned int slice_; + std::auto_ptr<Interactor> mainWidgetInteractor_; + std::auto_ptr<OrthancApiClient> orthancApiClient_; + Tools currentTool_; + const OrthancFrameLayerSource* source_; + unsigned int slice_; public: SingleFrameEditorApplication(MessageBroker& broker) :
--- a/Framework/SmartLoader.cpp Wed Oct 17 19:42:56 2018 +0200 +++ b/Framework/SmartLoader.cpp Thu Oct 18 09:02:24 2018 +0200 @@ -30,12 +30,12 @@ namespace OrthancStone { - enum CachedSliceStatus - { - CachedSliceStatus_ScheduledToLoad, - CachedSliceStatus_GeometryLoaded, - CachedSliceStatus_ImageLoaded - }; + enum CachedSliceStatus + { + CachedSliceStatus_ScheduledToLoad, + CachedSliceStatus_GeometryLoaded, + CachedSliceStatus_ImageLoaded + }; class SmartLoader::CachedSlice : public LayerSourceBase { @@ -47,11 +47,14 @@ CachedSliceStatus status_; public: + CachedSlice(MessageBroker& broker) : + LayerSourceBase(broker) + { + } - CachedSlice(MessageBroker& broker) - : LayerSourceBase(broker) - {} - virtual ~CachedSlice() {} + virtual ~CachedSlice() + { + } virtual bool GetExtent(std::vector<Vector>& points, const CoordinateSystem3D& viewportSlice) @@ -97,7 +100,8 @@ }; - SmartLoader::SmartLoader(MessageBroker& broker, OrthancApiClient& orthancApiClient) : + SmartLoader::SmartLoader(MessageBroker& broker, + OrthancApiClient& orthancApiClient) : IObservable(broker), IObserver(broker), imageQuality_(SliceImageQuality_FullPam), @@ -105,7 +109,10 @@ { } - void SmartLoader::SetFrameInWidget(LayerWidget& layerWidget, size_t layerIndex, const std::string& instanceId, unsigned int frame) + void SmartLoader::SetFrameInWidget(LayerWidget& layerWidget, + size_t layerIndex, + const std::string& instanceId, + unsigned int frame) { // TODO: check if this frame has already been loaded or is already being loaded. // - if already loaded: create a "clone" that will emit the GeometryReady/ImageReady messages "immediately" @@ -115,7 +122,7 @@ // in both cases, we must be carefull about objects lifecycle !!! std::auto_ptr<ILayerSource> layerSource; - std::string sliceKeyId = instanceId + ":" + std::to_string(frame); + std::string sliceKeyId = instanceId + ":" + boost::lexical_cast<std::string>(frame); SmartLoader::CachedSlice* cachedSlice = NULL; if (cachedSlices_.find(sliceKeyId) != cachedSlices_.end()) // && cachedSlices_[sliceKeyId]->status_ == CachedSliceStatus_Loaded) @@ -154,7 +161,8 @@ } - void SmartLoader::PreloadSlice(const std::string instanceId, unsigned int frame) + void SmartLoader::PreloadSlice(const std::string instanceId, + unsigned int frame) { // TODO: reactivate -> need to be able to ScheduleLayerLoading in ILayerSource without calling ScheduleLayerCreation return; @@ -166,7 +174,7 @@ boost::shared_ptr<CachedSlice> cachedSlice(new CachedSlice(IObserver::broker_)); cachedSlice->slice_.reset(new Slice(instanceId, frame)); cachedSlice->status_ = CachedSliceStatus_ScheduledToLoad; - std::string sliceKeyId = instanceId + ":" + std::to_string(frame); + std::string sliceKeyId = instanceId + ":" + boost::lexical_cast<std::string>(frame); LOG(WARNING) << "Will preload: " << sliceKeyId; @@ -202,7 +210,8 @@ // save/replace the slice in cache const Slice& slice = source.GetSlice(0); // TODO handle GetSliceCount() - std::string sliceKeyId = slice.GetOrthancInstanceId() + ":" + std::to_string(slice.GetFrame()); + std::string sliceKeyId = (slice.GetOrthancInstanceId() + ":" + + boost::lexical_cast<std::string>(slice.GetFrame())); LOG(WARNING) << "Geometry ready: " << sliceKeyId; @@ -217,13 +226,15 @@ EmitMessage(message); } + void SmartLoader::OnImageReady(const ILayerSource::ImageReadyMessage& message) { OrthancFrameLayerSource& source = dynamic_cast<OrthancFrameLayerSource&>(message.origin_); // save/replace the slice in cache const Slice& slice = source.GetSlice(0); // TODO handle GetSliceCount() ? - std::string sliceKeyId = slice.GetOrthancInstanceId() + ":" + std::to_string(slice.GetFrame()); + std::string sliceKeyId = (slice.GetOrthancInstanceId() + ":" + + boost::lexical_cast<std::string>(slice.GetFrame())); LOG(WARNING) << "Image ready: " << sliceKeyId; @@ -239,11 +250,13 @@ EmitMessage(message); } + void SmartLoader::OnLayerReady(const ILayerSource::LayerReadyMessage& message) { OrthancFrameLayerSource& source = dynamic_cast<OrthancFrameLayerSource&>(message.origin_); const Slice& slice = source.GetSlice(0); // TODO handle GetSliceCount() ? - std::string sliceKeyId = slice.GetOrthancInstanceId() + ":" + std::to_string(slice.GetFrame()); + std::string sliceKeyId = (slice.GetOrthancInstanceId() + ":" + + boost::lexical_cast<std::string>(slice.GetFrame())); LOG(WARNING) << "Layer ready: " << sliceKeyId; @@ -256,5 +269,4 @@ // re-emit original Layer message to observers EmitMessage(message); } - }
--- a/Framework/SmartLoader.h Wed Oct 17 19:42:56 2018 +0200 +++ b/Framework/SmartLoader.h Thu Oct 18 09:02:24 2018 +0200 @@ -35,10 +35,10 @@ class CachedSlice; protected: - typedef std::map<std::string, boost::shared_ptr<SmartLoader::CachedSlice>> CachedSlices; + typedef std::map<std::string, boost::shared_ptr<SmartLoader::CachedSlice> > CachedSlices; CachedSlices cachedSlices_; - typedef std::map<std::string, boost::shared_ptr<ILayerSource>> PreloadingInstances; + typedef std::map<std::string, boost::shared_ptr<ILayerSource> > PreloadingInstances; PreloadingInstances preloadingInstances_; SliceImageQuality imageQuality_;
--- a/Framework/Toolbox/OrthancApiClient.cpp Wed Oct 17 19:42:56 2018 +0200 +++ b/Framework/Toolbox/OrthancApiClient.cpp Thu Oct 18 09:02:24 2018 +0200 @@ -36,8 +36,10 @@ // TODO: handle destruction of this object (with shared_ptr ?::delete_later ???) class HttpResponseToJsonConverter : public IObserver, IObservable { - std::auto_ptr<MessageHandler<OrthancApiClient::JsonResponseReadyMessage>> orthancApiSuccessCallback_; - std::auto_ptr<MessageHandler<OrthancApiClient::HttpErrorMessage>> orthancApiFailureCallback_; + private: + std::auto_ptr<MessageHandler<OrthancApiClient::JsonResponseReadyMessage> > orthancApiSuccessCallback_; + std::auto_ptr<MessageHandler<OrthancApiClient::HttpErrorMessage> > orthancApiFailureCallback_; + public: HttpResponseToJsonConverter(MessageBroker& broker, MessageHandler<OrthancApiClient::JsonResponseReadyMessage>* orthancApiSuccessCallback, @@ -82,8 +84,10 @@ // TODO: handle destruction of this object (with shared_ptr ?::delete_later ???) class HttpResponseToBinaryConverter : public IObserver, IObservable { - std::auto_ptr<MessageHandler<OrthancApiClient::BinaryResponseReadyMessage>> orthancApiSuccessCallback_; - std::auto_ptr<MessageHandler<OrthancApiClient::HttpErrorMessage>> orthancApiFailureCallback_; + private: + std::auto_ptr<MessageHandler<OrthancApiClient::BinaryResponseReadyMessage> > orthancApiSuccessCallback_; + std::auto_ptr<MessageHandler<OrthancApiClient::HttpErrorMessage> > orthancApiFailureCallback_; + public: HttpResponseToBinaryConverter(MessageBroker& broker, MessageHandler<OrthancApiClient::BinaryResponseReadyMessage>* orthancApiSuccessCallback, @@ -124,8 +128,10 @@ // TODO: handle destruction of this object (with shared_ptr ?::delete_later ???) class HttpResponseToEmptyConverter : public IObserver, IObservable { - std::auto_ptr<MessageHandler<OrthancApiClient::EmptyResponseReadyMessage>> orthancApiSuccessCallback_; - std::auto_ptr<MessageHandler<OrthancApiClient::HttpErrorMessage>> orthancApiFailureCallback_; + private: + std::auto_ptr<MessageHandler<OrthancApiClient::EmptyResponseReadyMessage> > orthancApiSuccessCallback_; + std::auto_ptr<MessageHandler<OrthancApiClient::HttpErrorMessage> > orthancApiFailureCallback_; + public: HttpResponseToEmptyConverter(MessageBroker& broker, MessageHandler<OrthancApiClient::EmptyResponseReadyMessage>* orthancApiSuccessCallback,
--- a/Framework/Toolbox/OrthancSlicesLoader.cpp Wed Oct 17 19:42:56 2018 +0200 +++ b/Framework/Toolbox/OrthancSlicesLoader.cpp Thu Oct 18 09:02:24 2018 +0200 @@ -552,7 +552,7 @@ (new Orthanc::Image(expectedFormat, reader->GetWidth(), reader->GetHeight(), false)); Orthanc::ImageProcessing::Convert(*image, *reader); - reader = NULL; + reader.reset(); float scaling = static_cast<float>(stretchHigh - stretchLow) / 255.0f;
--- a/Platforms/Generic/WebServiceCommandBase.h Wed Oct 17 19:42:56 2018 +0200 +++ b/Platforms/Generic/WebServiceCommandBase.h Thu Oct 18 09:02:24 2018 +0200 @@ -37,8 +37,8 @@ class WebServiceCommandBase : public IOracleCommand, IObservable { protected: - std::auto_ptr<MessageHandler<IWebService::HttpRequestSuccessMessage>> successCallback_; - std::auto_ptr<MessageHandler<IWebService::HttpRequestErrorMessage>> failureCallback_; + std::auto_ptr<MessageHandler<IWebService::HttpRequestSuccessMessage> > successCallback_; + std::auto_ptr<MessageHandler<IWebService::HttpRequestErrorMessage> > failureCallback_; Orthanc::WebServiceParameters parameters_; std::string uri_; std::map<std::string, std::string> headers_;