# HG changeset patch # User Sebastien Jodogne # Date 1495798970 -7200 # Node ID 02c3a7a4938f00c4b89ec338dceee9b8f4b0ea86 # Parent bd48431ac285a0f161425b513c83415af995337a removing of the Start() mechanism diff -r bd48431ac285 -r 02c3a7a4938f Applications/BasicApplicationContext.cpp --- a/Applications/BasicApplicationContext.cpp Fri May 26 12:20:26 2017 +0200 +++ b/Applications/BasicApplicationContext.cpp Fri May 26 13:42:50 2017 +0200 @@ -137,6 +137,7 @@ { oracle_.Start(); + // TODO REMOVE THIS for (Volumes::iterator it = volumes_.begin(); it != volumes_.end(); ++it) { assert(*it != NULL); @@ -148,8 +149,6 @@ stopped_ = false; updateThread_ = boost::thread(UpdateThread, this); } - - viewport_.Start(); } @@ -162,6 +161,7 @@ updateThread_.join(); } + // TODO REMOVE THIS for (Volumes::iterator it = volumes_.begin(); it != volumes_.end(); ++it) { assert(*it != NULL); diff -r bd48431ac285 -r 02c3a7a4938f Framework/Layers/ILayerSource.h --- a/Framework/Layers/ILayerSource.h Fri May 26 12:20:26 2017 +0200 +++ b/Framework/Layers/ILayerSource.h Fri May 26 13:42:50 2017 +0200 @@ -73,7 +73,5 @@ const SliceGeometry& viewportSlice) = 0; virtual void ScheduleLayerCreation(const SliceGeometry& viewportSlice) = 0; - - virtual void Start() = 0; }; } diff -r bd48431ac285 -r 02c3a7a4938f Framework/Layers/LayerSourceBase.cpp --- a/Framework/Layers/LayerSourceBase.cpp Fri May 26 12:20:26 2017 +0200 +++ b/Framework/Layers/LayerSourceBase.cpp Fri May 26 13:42:50 2017 +0200 @@ -27,11 +27,6 @@ { void LayerSourceBase::NotifyGeometryReady() { - if (!started_) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); - } - if (observer_ != NULL) { observer_->NotifyGeometryReady(*this); @@ -40,11 +35,6 @@ void LayerSourceBase::NotifyGeometryError() { - if (!started_) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); - } - if (observer_ != NULL) { observer_->NotifyGeometryError(*this); @@ -53,11 +43,6 @@ void LayerSourceBase::NotifySourceChange() { - if (!started_) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); - } - if (observer_ != NULL) { observer_->NotifySourceChange(*this); @@ -66,11 +51,6 @@ void LayerSourceBase::NotifySliceChange(const Slice& slice) { - if (!started_) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); - } - if (observer_ != NULL) { observer_->NotifySliceChange(*this, slice); @@ -82,11 +62,6 @@ { std::auto_ptr tmp(layer); - if (!started_) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); - } - if (layer == NULL) { throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); @@ -100,11 +75,6 @@ void LayerSourceBase::NotifyLayerError(const SliceGeometry& slice) { - if (!started_) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); - } - if (observer_ != NULL) { observer_->NotifyLayerError(*this, slice); @@ -113,11 +83,6 @@ void LayerSourceBase::SetObserver(IObserver& observer) { - if (started_) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); - } - if (observer_ == NULL) { observer_ = &observer; @@ -128,17 +93,4 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); } } - - void LayerSourceBase::Start() - { - if (started_) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); - } - else - { - started_ = true; - StartInternal(); - } - } } diff -r bd48431ac285 -r 02c3a7a4938f Framework/Layers/LayerSourceBase.h --- a/Framework/Layers/LayerSourceBase.h Fri May 26 12:20:26 2017 +0200 +++ b/Framework/Layers/LayerSourceBase.h Fri May 26 13:42:50 2017 +0200 @@ -29,14 +29,8 @@ { private: IObserver* observer_; - bool started_; protected: - bool IsStarted() - { - return started_; - } - void NotifyGeometryReady(); void NotifyGeometryError(); @@ -51,17 +45,12 @@ void NotifyLayerError(const SliceGeometry& slice); - virtual void StartInternal() = 0; - public: LayerSourceBase() : - observer_(NULL), - started_(false) + observer_(NULL) { } virtual void SetObserver(IObserver& observer); - - virtual void Start(); }; } diff -r bd48431ac285 -r 02c3a7a4938f Framework/Layers/OrthancFrameLayerSource.cpp --- a/Framework/Layers/OrthancFrameLayerSource.cpp Fri May 26 12:20:26 2017 +0200 +++ b/Framework/Layers/OrthancFrameLayerSource.cpp Fri May 26 13:42:50 2017 +0200 @@ -91,22 +91,12 @@ loader_(*this, orthanc), observer2_(NULL) { + loader_.ScheduleLoadInstance(instanceId_, frame_); } - void OrthancFrameLayerSource::StartInternal() - { - loader_.ScheduleLoadInstance(instanceId_, frame_); - } - - void OrthancFrameLayerSource::SetObserver(IVolumeSlicesObserver& observer) { - if (IsStarted()) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); - } - if (observer2_ == NULL) { observer2_ = &observer; @@ -163,14 +153,16 @@ { size_t index; - if (loader_.IsGeometryReady() && - loader_.LookupSlice(index, viewportSlice)) + if (loader_.IsGeometryReady()) { - loader_.ScheduleLoadSliceImage(index); - } - else - { - LayerSourceBase::NotifyLayerError(viewportSlice); + if (loader_.LookupSlice(index, viewportSlice)) + { + loader_.ScheduleLoadSliceImage(index); + } + else + { + LayerSourceBase::NotifyLayerError(viewportSlice); + } } } } diff -r bd48431ac285 -r 02c3a7a4938f Framework/Layers/OrthancFrameLayerSource.h --- a/Framework/Layers/OrthancFrameLayerSource.h Fri May 26 12:20:26 2017 +0200 +++ b/Framework/Layers/OrthancFrameLayerSource.h Fri May 26 13:42:50 2017 +0200 @@ -51,9 +51,6 @@ unsigned int sliceIndex, const Slice& slice); - protected: - virtual void StartInternal(); - public: using LayerSourceBase::SetObserver; diff -r bd48431ac285 -r 02c3a7a4938f Framework/Viewport/IViewport.h --- a/Framework/Viewport/IViewport.h Fri May 26 12:20:26 2017 +0200 +++ b/Framework/Viewport/IViewport.h Fri May 26 13:42:50 2017 +0200 @@ -87,7 +87,5 @@ // Should only be called from IWidget virtual void NotifyChange(const IWidget& widget) = 0; - - virtual void Start() = 0; }; } diff -r bd48431ac285 -r 02c3a7a4938f Framework/Viewport/WidgetViewport.cpp --- a/Framework/Viewport/WidgetViewport.cpp Fri May 26 12:20:26 2017 +0200 +++ b/Framework/Viewport/WidgetViewport.cpp Fri May 26 13:42:50 2017 +0200 @@ -265,13 +265,4 @@ centralWidget_->UpdateContent(); } } - - - void WidgetViewport::Start() - { - if (centralWidget_.get() != NULL) - { - centralWidget_->Start(); - } - } } diff -r bd48431ac285 -r 02c3a7a4938f Framework/Viewport/WidgetViewport.h --- a/Framework/Viewport/WidgetViewport.h Fri May 26 12:20:26 2017 +0200 +++ b/Framework/Viewport/WidgetViewport.h Fri May 26 13:42:50 2017 +0200 @@ -88,7 +88,5 @@ virtual bool HasUpdateContent(); virtual void UpdateContent(); - - virtual void Start(); }; } diff -r bd48431ac285 -r 02c3a7a4938f Framework/Widgets/EmptyWidget.h --- a/Framework/Widgets/EmptyWidget.h Fri May 26 12:20:26 2017 +0200 +++ b/Framework/Widgets/EmptyWidget.h Fri May 26 13:42:50 2017 +0200 @@ -112,10 +112,6 @@ { return false; } - - virtual void Start() - { - } }; } } diff -r bd48431ac285 -r 02c3a7a4938f Framework/Widgets/IWidget.h --- a/Framework/Widgets/IWidget.h Fri May 26 12:20:26 2017 +0200 +++ b/Framework/Widgets/IWidget.h Fri May 26 13:42:50 2017 +0200 @@ -74,7 +74,5 @@ // Subclasses can call this method to signal the display of the // widget must be refreshed virtual void NotifyChange() = 0; - - virtual void Start() = 0; }; } diff -r bd48431ac285 -r 02c3a7a4938f Framework/Widgets/LayerWidget.cpp --- a/Framework/Widgets/LayerWidget.cpp Fri May 26 12:20:26 2017 +0200 +++ b/Framework/Widgets/LayerWidget.cpp Fri May 26 13:42:50 2017 +0200 @@ -451,7 +451,7 @@ if (LookupLayer(index, source) && slice.IsSamePlane(slice_, THIN_SLICE_THICKNESS)) // Whether the slice comes from an older request { - LOG(ERROR) << "Error on layer " << index; + LOG(INFO) << "Unable to load a slice from layer " << index; double x1, y1, x2, y2; if (GetAndFixExtent(x1, y1, x2, y2, source)) @@ -460,19 +460,4 @@ } } } - - - void LayerWidget::Start() - { - if (started_) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); - } - - for (size_t i = 0; i < layers_.size(); i++) - { - assert(layers_[i] != NULL); - layers_[i]->Start(); - } - } } diff -r bd48431ac285 -r 02c3a7a4938f Framework/Widgets/LayerWidget.h --- a/Framework/Widgets/LayerWidget.h Fri May 26 12:20:26 2017 +0200 +++ b/Framework/Widgets/LayerWidget.h Fri May 26 13:42:50 2017 +0200 @@ -103,7 +103,5 @@ { return slice_; } - - virtual void Start(); }; } diff -r bd48431ac285 -r 02c3a7a4938f Framework/Widgets/WidgetBase.h --- a/Framework/Widgets/WidgetBase.h Fri May 26 12:20:26 2017 +0200 +++ b/Framework/Widgets/WidgetBase.h Fri May 26 13:42:50 2017 +0200 @@ -105,9 +105,5 @@ } virtual void NotifyChange(); - - virtual void Start() - { - } }; } diff -r bd48431ac285 -r 02c3a7a4938f Platforms/Generic/Oracle.cpp --- a/Platforms/Generic/Oracle.cpp Fri May 26 12:20:26 2017 +0200 +++ b/Platforms/Generic/Oracle.cpp Fri May 26 13:42:50 2017 +0200 @@ -112,9 +112,6 @@ switch (state_) { case State_Init: - LOG(ERROR) << "You must call Oracle::Start()"; - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); - case State_Started: queue_.Enqueue(protection.release()); break;