changeset 1311:3d26447ddd28 broker

warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 09 Mar 2020 14:55:22 +0100
parents 9bea7e15b519
children 4f8c9065ee52
files Framework/Deprecated/Toolbox/MessagingToolbox.cpp Framework/Loaders/DicomResourcesLoader.cpp Framework/Loaders/GenericLoadersContext.h Framework/Loaders/SeriesFramesLoader.cpp Framework/Messages/IObservable.h Framework/Scene2DViewport/LineMeasureTool.cpp Framework/Viewport/SdlViewport.cpp Framework/Volumes/VolumeSceneLayerSource.h Resources/CMake/OrthancStoneConfiguration.cmake Resources/Conventions.txt
diffstat 10 files changed, 40 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Deprecated/Toolbox/MessagingToolbox.cpp	Mon Mar 09 14:53:22 2020 +0100
+++ b/Framework/Deprecated/Toolbox/MessagingToolbox.cpp	Mon Mar 09 14:55:22 2020 +0100
@@ -18,7 +18,6 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
-
 #include "MessagingToolbox.h"
 
 #include <Core/Images/Image.h>
@@ -30,9 +29,14 @@
 #include <Core/Logging.h>
 
 #include <boost/lexical_cast.hpp>
+
+// 'Json::Reader': Use CharReader and CharReaderBuilder instead
+#pragma warning(disable:4996)
+
 #include <json/reader.h>
 #include <json/writer.h>
 
+
 namespace Deprecated
 {
   namespace MessagingToolbox
--- a/Framework/Loaders/DicomResourcesLoader.cpp	Mon Mar 09 14:53:22 2020 +0100
+++ b/Framework/Loaders/DicomResourcesLoader.cpp	Mon Mar 09 14:55:22 2020 +0100
@@ -810,6 +810,10 @@
 
       {
         std::unique_ptr<ILoadersContext::ILock> lock(context_.Lock());
+
+        // GetSharedObserver() means "this" (for use as an IObserver), as a 
+        // shared_ptr
+        // The oracle will thus call "this" 
         lock->Schedule(GetSharedObserver(), priority, command.release());
       }
     }
--- a/Framework/Loaders/GenericLoadersContext.h	Mon Mar 09 14:53:22 2020 +0100
+++ b/Framework/Loaders/GenericLoadersContext.h	Mon Mar 09 14:55:22 2020 +0100
@@ -44,7 +44,7 @@
     boost::recursive_mutex  mutex_;
 
     IObservable                         oracleObservable_;
-    std::unique_ptr<ThreadedOracle>       oracle_;
+    std::unique_ptr<ThreadedOracle>     oracle_;
     boost::shared_ptr<OracleScheduler>  scheduler_;
 
     // Necessary to keep the loaders persistent (including global
--- a/Framework/Loaders/SeriesFramesLoader.cpp	Mon Mar 09 14:53:22 2020 +0100
+++ b/Framework/Loaders/SeriesFramesLoader.cpp	Mon Mar 09 14:55:22 2020 +0100
@@ -170,7 +170,9 @@
     size_t frameIndex = frames_.GetFrameIndex(payload.GetSeriesIndex());
 
     std::unique_ptr<Orthanc::ImageAccessor> decoded;
-    decoded.reset(Orthanc::DicomImageDecoder::Decode(dicom, frameIndex));
+    decoded.reset(Orthanc::DicomImageDecoder::Decode(
+      dicom, 
+      static_cast<unsigned int>(frameIndex)));
 
     if (decoded.get() == NULL)
     {
--- a/Framework/Messages/IObservable.h	Mon Mar 09 14:53:22 2020 +0100
+++ b/Framework/Messages/IObservable.h	Mon Mar 09 14:55:22 2020 +0100
@@ -43,7 +43,7 @@
   public:
     virtual ~IObservable();
 
-    // Takes ownsership of the callable
+    // Takes ownership of the callable
     void RegisterCallable(ICallable* callable);
 
     void BroadcastMessage(const IMessage& message);
--- a/Framework/Scene2DViewport/LineMeasureTool.cpp	Mon Mar 09 14:53:22 2020 +0100
+++ b/Framework/Scene2DViewport/LineMeasureTool.cpp	Mon Mar 09 14:55:22 2020 +0100
@@ -154,13 +154,6 @@
     if (!HitTest(scenePos))
       return boost::shared_ptr<IFlexiblePointerTracker>();
 
-    /**
-      new EditLineMeasureTracker(
-        boost::shared_ptr<LineMeasureTool> measureTool;
-        MessageBroker & broker,
-        IViewport&          viewport,
-        const PointerEvent & e);
-    */
     boost::shared_ptr<EditLineMeasureTracker> editLineMeasureTracker(
       new EditLineMeasureTracker(shared_from_this(), viewport_, e));
     return editLineMeasureTracker;
--- a/Framework/Viewport/SdlViewport.cpp	Mon Mar 09 14:53:22 2020 +0100
+++ b/Framework/Viewport/SdlViewport.cpp	Mon Mar 09 14:55:22 2020 +0100
@@ -105,24 +105,21 @@
     // "OpenGLContext" it references (*)
     ClearCompositor();
   }
-
-
+  
   void SdlOpenGLViewport::Paint()
   {
     SdlLock lock(*this);
     lock.GetCompositor().Refresh(lock.GetController().GetScene());
   }
-
-
-  void SdlOpenGLViewport::UpdateSize(unsigned int width, 
+  
+  void SdlOpenGLViewport::UpdateSize(unsigned int width,
                                      unsigned int height)
   {
     // nothing to do in OpenGL, the OpenGLCompositor::UpdateSize will be called automatically
     SdlLock lock(*this);
     lock.Invalidate();
   }
-
-
+  
   void SdlOpenGLViewport::ToggleMaximize()
   {
     // No need to call "Invalidate()" here, as "UpdateSize()" will
@@ -130,9 +127,7 @@
     SdlLock lock(*this);
     context_.ToggleMaximize();
   }
-
-
-
+   
   SdlCairoViewport::SdlCairoViewport(const char* title,
                                      unsigned int width,
                                      unsigned int height,
--- a/Framework/Volumes/VolumeSceneLayerSource.h	Mon Mar 09 14:53:22 2020 +0100
+++ b/Framework/Volumes/VolumeSceneLayerSource.h	Mon Mar 09 14:55:22 2020 +0100
@@ -38,13 +38,14 @@
   class VolumeSceneLayerSource : public boost::noncopyable
   {
   private:
-    Scene2D&                                scene_;
-    int                                     layerDepth_;
-    boost::shared_ptr<IVolumeSlicer>        slicer_;
+    Scene2D&                                  scene_;
+    int                                       layerDepth_;
+    boost::shared_ptr<IVolumeSlicer>          slicer_;
     std::unique_ptr<ILayerStyleConfigurator>  configurator_;
     std::unique_ptr<CoordinateSystem3D>       lastPlane_;
-    uint64_t                                lastRevision_;
-    uint64_t                                lastConfiguratorRevision_;
+    uint64_t                                  lastRevision_;
+    uint64_t                                  lastConfiguratorRevision_;
+    bool                                      layerInScene_;
 
     void ClearLayer();
 
@@ -71,6 +72,14 @@
 
     ILayerStyleConfigurator& GetConfigurator() const;
 
+    /**
+    Make sure the Scene2D is protected from concurrent accesses before 
+    calling this method.
+
+    If the scene that has been supplied to the ctor is part of an IViewport, 
+    you can lock the whole viewport data (including scene) by means of the 
+    IViewport::Lock method.
+    */ 
     void Update(const CoordinateSystem3D& plane);  
   };
 }
--- a/Resources/CMake/OrthancStoneConfiguration.cmake	Mon Mar 09 14:53:22 2020 +0100
+++ b/Resources/CMake/OrthancStoneConfiguration.cmake	Mon Mar 09 14:55:22 2020 +0100
@@ -532,11 +532,15 @@
   ${ORTHANC_STONE_ROOT}/Framework/Loaders/SeriesMetadataLoader.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Loaders/SeriesOrderedFrames.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Loaders/SeriesThumbnailsLoader.cpp
-  
+
   ${ORTHANC_STONE_ROOT}/Framework/Messages/ICallable.h
   ${ORTHANC_STONE_ROOT}/Framework/Messages/IMessage.h
+  ${ORTHANC_STONE_ROOT}/Framework/Messages/IMessageEmitter.h
   ${ORTHANC_STONE_ROOT}/Framework/Messages/IObservable.cpp
+  ${ORTHANC_STONE_ROOT}/Framework/Messages/IObservable.h
   ${ORTHANC_STONE_ROOT}/Framework/Messages/IObserver.h
+  ${ORTHANC_STONE_ROOT}/Framework/Messages/ObserverBase.h
+
   ${ORTHANC_STONE_ROOT}/Framework/Oracle/GetOrthancImageCommand.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Oracle/GetOrthancWebViewerJpegCommand.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Oracle/HttpCommand.cpp
--- a/Resources/Conventions.txt	Mon Mar 09 14:53:22 2020 +0100
+++ b/Resources/Conventions.txt	Mon Mar 09 14:55:22 2020 +0100
@@ -63,7 +63,8 @@
 
 * As we are targeting C++03 (for VS2008 and LSB compatibility), use
   "std::unique_ptr<>" and "boost::shared_ptr<>" (*not*
-  "std::shared_ptr<>").
+  "std::shared_ptr<>"). We provide an implementation of std::unique_ptr for
+  pre-C++11 compilers.
 
 * The fact of transfering the ownership of one object to another must
   be tagged by naming the method "Acquire...()", and by providing a