diff Framework/Layers/LayerSourceBase.h @ 90:64e60018943f wasm

fix and observer refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 May 2017 11:04:18 +0200
parents f244018a4e4b
children f8bce1bebe01
line wrap: on
line diff
--- a/Framework/Layers/LayerSourceBase.h	Fri May 26 18:27:59 2017 +0200
+++ b/Framework/Layers/LayerSourceBase.h	Mon May 29 11:04:18 2017 +0200
@@ -22,36 +22,32 @@
 #pragma once
 
 #include "ILayerSource.h"
+#include "../Toolbox/ObserversRegistry.h"
 
 namespace OrthancStone
 {
   class LayerSourceBase : public ILayerSource
   {
   private:
-    IObserver*  observer_;
+    typedef ObserversRegistry<ILayerSource, IObserver>  Observers;
+
+    Observers  observers_;
 
   protected:
-    IObserver* GetObserver() const
-    {
-      return observer_;  // TODO REMOVE THIS, FOR TEST
-    }
+    void NotifyGeometryReady();
+    
+    void NotifyGeometryError();
 
     void NotifyContentChange();
 
     void NotifySliceChange(const Slice& slice);
 
-    // Takes ownership of "layer" (that cannot be "NULL")
     void NotifyLayerReady(ILayerRenderer* layer,
                           const Slice& slice);
     
     void NotifyLayerError(const SliceGeometry& slice);
 
   public:
-    LayerSourceBase() :
-      observer_(NULL)
-    {
-    }
-    
-    virtual void SetObserver(IObserver& observer);
+    virtual void Register(IObserver& observer);
   };
 }