changeset 624:573e35378999

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 May 2019 14:28:10 +0200
parents 42dadae61fa9
children 2eeb5857eb43
files Framework/dev.h UnitTestsSources/TestMessageBroker.cpp
diffstat 2 files changed, 32 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/dev.h	Tue May 07 14:16:08 2019 +0200
+++ b/Framework/dev.h	Tue May 07 14:28:10 2019 +0200
@@ -113,7 +113,7 @@
       if (loader_.GetSliceCount() == 0)
       {
         LOG(ERROR) << "Empty volume image";
-        EmitMessage(ISlicedVolume::GeometryErrorMessage(*this));
+        BroadcastMessage(ISlicedVolume::GeometryErrorMessage(*this));
         return;
       }
 
@@ -121,7 +121,7 @@
       {
         if (!IsCompatible(loader_.GetSlice(0), loader_.GetSlice(i)))
         {
-          EmitMessage(ISlicedVolume::GeometryErrorMessage(*this));
+          BroadcastMessage(ISlicedVolume::GeometryErrorMessage(*this));
           return;
         }
       }
@@ -145,7 +145,7 @@
                                    0.001 /* this is expressed in mm */))
         {
           LOG(ERROR) << "The distance between successive slices is not constant in a volume image";
-          EmitMessage(ISlicedVolume::GeometryErrorMessage(*this));
+          BroadcastMessage(ISlicedVolume::GeometryErrorMessage(*this));
           return;
         }
       }
@@ -172,7 +172,7 @@
 
       // TODO Check the DicomFrameConverter are constant
 
-      EmitMessage(ISlicedVolume::GeometryReadyMessage(*this));
+      BroadcastMessage(ISlicedVolume::GeometryReadyMessage(*this));
     }
 
 
@@ -181,7 +181,7 @@
       assert(&message.GetOrigin() == &loader_);
 
       LOG(ERROR) << "Unable to download a volume image";
-      EmitMessage(ISlicedVolume::GeometryErrorMessage(*this));
+      BroadcastMessage(ISlicedVolume::GeometryErrorMessage(*this));
     }
 
 
@@ -194,12 +194,12 @@
         Orthanc::ImageProcessing::Copy(writer.GetAccessor(), message.GetImage());
       }
 
-      EmitMessage(ISlicedVolume::SliceContentChangedMessage
+      BroadcastMessage(ISlicedVolume::SliceContentChangedMessage
                   (*this, message.GetSliceIndex(), message.GetSlice()));
 
       if (pendingSlices_ == 1)
       {
-        EmitMessage(ISlicedVolume::VolumeReadyMessage(*this));
+        BroadcastMessage(ISlicedVolume::VolumeReadyMessage(*this));
         pendingSlices_ = 0;
       }
       else if (pendingSlices_ > 1)
@@ -540,21 +540,21 @@
       coronalGeometry_.reset(new VolumeImageGeometry(volume_, VolumeProjection_Coronal));
       sagittalGeometry_.reset(new VolumeImageGeometry(volume_, VolumeProjection_Sagittal));
 
-      EmitMessage(IVolumeSlicer::GeometryReadyMessage(*this));
+      BroadcastMessage(IVolumeSlicer::GeometryReadyMessage(*this));
     }
 
     void OnGeometryError(const ISlicedVolume::GeometryErrorMessage& message)
     {
       assert(&message.GetOrigin() == &volume_);
 
-      EmitMessage(IVolumeSlicer::GeometryErrorMessage(*this));
+      BroadcastMessage(IVolumeSlicer::GeometryErrorMessage(*this));
     }
 
     void OnContentChanged(const ISlicedVolume::ContentChangedMessage& message)
     {
       assert(&message.GetOrigin() == &volume_);
 
-      EmitMessage(IVolumeSlicer::ContentChangedMessage(*this));
+      BroadcastMessage(IVolumeSlicer::ContentChangedMessage(*this));
     }
 
     void OnSliceContentChanged(const ISlicedVolume::SliceContentChangedMessage& message)
@@ -564,7 +564,7 @@
       //IVolumeSlicer::OnSliceContentChange(slice);
 
       // TODO Improve this?
-      EmitMessage(IVolumeSlicer::ContentChangedMessage(*this));
+      BroadcastMessage(IVolumeSlicer::ContentChangedMessage(*this));
     }
 
     const VolumeImageGeometry& GetProjectionGeometry(VolumeProjection projection)
@@ -697,14 +697,14 @@
 
           RendererFactory factory(*frame, *slice, isFullQuality);
 
-          EmitMessage(IVolumeSlicer::LayerReadyMessage(*this, factory, slice->GetGeometry()));
+          BroadcastMessage(IVolumeSlicer::LayerReadyMessage(*this, factory, slice->GetGeometry()));
           return;
         }
       }
 
       // Error
       CoordinateSystem3D slice;
-      EmitMessage(IVolumeSlicer::LayerErrorMessage(*this, slice));
+      BroadcastMessage(IVolumeSlicer::LayerErrorMessage(*this, slice));
     }
   };
 
@@ -906,7 +906,7 @@
       IVolumeSlicer(broker),
       otherPlane_(otherPlane)
     {
-      EmitMessage(IVolumeSlicer::GeometryReadyMessage(*this));
+      BroadcastMessage(IVolumeSlicer::GeometryReadyMessage(*this));
     }
 
     virtual bool GetExtent(std::vector<Vector>& points,
@@ -929,7 +929,7 @@
                                                viewportSlice.GetOrigin(), viewportSlice.GetNormal()))
       {
         // The two slice are parallel, don't try and display the intersection
-        EmitMessage(IVolumeSlicer::LayerErrorMessage(*this, reference.GetGeometry()));
+        BroadcastMessage(IVolumeSlicer::LayerErrorMessage(*this, reference.GetGeometry()));
       }
       else
       {
@@ -945,12 +945,12 @@
                                                  extent.GetX2(), extent.GetY2()))
         {
           RendererFactory factory(x1, y1, x2, y2, slice);
-          EmitMessage(IVolumeSlicer::LayerReadyMessage(*this, factory, reference.GetGeometry()));
+          BroadcastMessage(IVolumeSlicer::LayerReadyMessage(*this, factory, reference.GetGeometry()));
         }
         else
         {
           // Error: Parallel slices
-          EmitMessage(IVolumeSlicer::LayerErrorMessage(*this, reference.GetGeometry()));
+          BroadcastMessage(IVolumeSlicer::LayerErrorMessage(*this, reference.GetGeometry()));
         }
       }
     }
--- a/UnitTestsSources/TestMessageBroker.cpp	Tue May 07 14:16:08 2019 +0200
+++ b/UnitTestsSources/TestMessageBroker.cpp	Tue May 07 14:28:10 2019 +0200
@@ -160,18 +160,18 @@
   observable.RegisterObserverCallback(new Callable<MyObserver, MyObservable::MyCustomMessage>(observer, &MyObserver::HandleCompletedMessage));
 
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(12));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(12));
   ASSERT_EQ(12, testCounter);
 
   // the connection is permanent; if we emit the same message again, the observer will be notified again
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(20));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(20));
   ASSERT_EQ(20, testCounter);
 
   // Unregister the observer; make sure it's not called anymore
   observable.Unregister(&observer);
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(20));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(20));
   ASSERT_EQ(0, testCounter);
 }
 
@@ -186,12 +186,12 @@
   intermediate.RegisterObserverCallback(new Callable<MyObserver, MyObservable::MyCustomMessage>(observer, &MyObserver::HandleCompletedMessage));
 
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(12));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(12));
   ASSERT_EQ(12, testCounter);
 
   // the connection is permanent; if we emit the same message again, the observer will be notified again
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(20));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(20));
   ASSERT_EQ(20, testCounter);
 }
 
@@ -205,7 +205,7 @@
   observable.RegisterObserverCallback(new Callable<MyObserver, MyObservable::MyCustomMessage>(*observer, &MyObserver::HandleCompletedMessage));
 
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(12));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(12));
   ASSERT_EQ(12, testCounter);
 
   // delete the observer and check that the callback is not called anymore
@@ -213,7 +213,7 @@
 
   // the connection is permanent; if we emit the same message again, the observer will be notified again
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(20));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(20));
   ASSERT_EQ(0, testCounter);
 }
 
@@ -228,12 +228,12 @@
   intermediate->RegisterObserverCallback(new Callable<MyObserver, MyObservable::MyCustomMessage>(observer, &MyObserver::HandleCompletedMessage));
 
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(12));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(12));
   ASSERT_EQ(12, testCounter);
 
   delete intermediate;
 
-  observable.EmitMessage(MyObservable::MyCustomMessage(20));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(20));
   ASSERT_EQ(12, testCounter);
 }
 
@@ -248,12 +248,12 @@
   intermediate.RegisterObserverCallback(new Callable<MyObserver, MyObservable::MyCustomMessage>(observer, &MyObserver::HandleCompletedMessage));
 
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(12));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(12));
   ASSERT_EQ(12, testCounter);
 
   // the connection is permanent; if we emit the same message again, the observer will be notified again
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(20));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(20));
   ASSERT_EQ(20, testCounter);
 }
 
@@ -324,7 +324,7 @@
   observable.RegisterObserverCallback(new LambdaCallable<MyObservable::MyCustomMessage>(*observer, [&](const MyObservable::MyCustomMessage& message) {testCounter += 2 * message.payload_;}));
 
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(12));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(12));
   ASSERT_EQ(24, testCounter);
 
   // delete the observer and check that the callback is not called anymore
@@ -332,7 +332,7 @@
 
   // the connection is permanent; if we emit the same message again, the observer will be notified again
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(20));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(20));
   ASSERT_EQ(0, testCounter);
 }
 
@@ -362,7 +362,7 @@
   MyObserverWithLambda*   observer = new MyObserverWithLambda(broker, 3, observable);
 
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(12));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(12));
   ASSERT_EQ(36, testCounter);
 
   // delete the observer and check that the callback is not called anymore
@@ -370,7 +370,7 @@
 
   // the connection is permanent; if we emit the same message again, the observer will be notified again
   testCounter = 0;
-  observable.EmitMessage(MyObservable::MyCustomMessage(20));
+  observable.BroadcastMessage(MyObservable::MyCustomMessage(20));
   ASSERT_EQ(0, testCounter);
 }