changeset 1472:474360793956

DicomResourcesLoader::Create()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 15 Jun 2020 16:26:57 +0200
parents 28c64c246312
children 9cbc6d21ae89
files Framework/Loaders/DicomResourcesLoader.cpp Framework/Loaders/DicomResourcesLoader.h Framework/Loaders/DicomSource.cpp Framework/Loaders/OracleScheduler.cpp Framework/Loaders/SeriesMetadataLoader.cpp Framework/Loaders/WebAssemblyLoadersContext.cpp Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h
diffstat 8 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Loaders/DicomResourcesLoader.cpp	Mon Jun 15 12:57:54 2020 +0200
+++ b/Framework/Loaders/DicomResourcesLoader.cpp	Mon Jun 15 16:26:57 2020 +0200
@@ -602,7 +602,7 @@
   }
 
 
-  boost::shared_ptr<IObserver> DicomResourcesLoader::Factory::Create(ILoadersContext::ILock& stone)
+  boost::shared_ptr<DicomResourcesLoader> DicomResourcesLoader::Create(ILoadersContext::ILock& stone)
   {
     boost::shared_ptr<DicomResourcesLoader> result(new DicomResourcesLoader(stone.GetContext()));
     result->Register<HttpCommand::SuccessMessage>(stone.GetOracleObservable(), &DicomResourcesLoader::Handle);
@@ -614,7 +614,7 @@
     result->Register<ParseDicomSuccessMessage>(stone.GetOracleObservable(), &DicomResourcesLoader::Handle);
 #endif
     
-    return boost::shared_ptr<IObserver>(result);
+    return result;
   }
 
 
--- a/Framework/Loaders/DicomResourcesLoader.h	Mon Jun 15 12:57:54 2020 +0200
+++ b/Framework/Loaders/DicomResourcesLoader.h	Mon Jun 15 16:26:57 2020 +0200
@@ -147,9 +147,15 @@
     class Factory : public ILoaderFactory
     {
     public:
-      virtual boost::shared_ptr<IObserver> Create(ILoadersContext::ILock& stone);
+      virtual boost::shared_ptr<IObserver> Create(ILoadersContext::ILock& stone)
+      {
+        return DicomResourcesLoader::Create(stone);
+      }
     };
 
+
+    static boost::shared_ptr<DicomResourcesLoader> Create(ILoadersContext::ILock& stone);
+
     void ScheduleGetDicomWeb(boost::shared_ptr<LoadedDicomResources> target,
                              int priority,
                              const DicomSource& source,
--- a/Framework/Loaders/DicomSource.cpp	Mon Jun 15 12:57:54 2020 +0200
+++ b/Framework/Loaders/DicomSource.cpp	Mon Jun 15 16:26:57 2020 +0200
@@ -153,7 +153,7 @@
         std::unique_ptr<HttpCommand> command(new HttpCommand);
         
         command->SetMethod(Orthanc::HttpMethod_Get);
-        command->SetUrl(webService_.GetUrl() + "/" + EncodeGetArguments(uri, arguments));
+        command->SetUrl(webService_.GetUrl() + EncodeGetArguments(uri, arguments));
         command->SetHttpHeaders(webService_.GetHttpHeaders());
 
         for (std::map<std::string, std::string>::const_iterator
--- a/Framework/Loaders/OracleScheduler.cpp	Mon Jun 15 12:57:54 2020 +0200
+++ b/Framework/Loaders/OracleScheduler.cpp	Mon Jun 15 16:26:57 2020 +0200
@@ -463,7 +463,7 @@
   {
     assert(PRIORITY_HIGH < 0 &&
            PRIORITY_LOW > 0);
-    
+
     if (maxLowPriority <= 0)
     {
       // There must be at least 1 lane available to deal with low-priority commands
--- a/Framework/Loaders/SeriesMetadataLoader.cpp	Mon Jun 15 12:57:54 2020 +0200
+++ b/Framework/Loaders/SeriesMetadataLoader.cpp	Mon Jun 15 16:26:57 2020 +0200
@@ -189,9 +189,7 @@
 
   boost::shared_ptr<IObserver> SeriesMetadataLoader::Factory::Create(ILoadersContext::ILock& context)
   {
-    DicomResourcesLoader::Factory factory;
-    boost::shared_ptr<DicomResourcesLoader> loader
-      (boost::dynamic_pointer_cast<DicomResourcesLoader>(factory.Create(context)));
+    boost::shared_ptr<DicomResourcesLoader> loader(DicomResourcesLoader::Create(context));
       
     boost::shared_ptr<SeriesMetadataLoader> obj(new SeriesMetadataLoader(loader));
     obj->Register<DicomResourcesLoader::SuccessMessage>(*loader, &SeriesMetadataLoader::Handle);
--- a/Framework/Loaders/WebAssemblyLoadersContext.cpp	Mon Jun 15 12:57:54 2020 +0200
+++ b/Framework/Loaders/WebAssemblyLoadersContext.cpp	Mon Jun 15 16:26:57 2020 +0200
@@ -79,9 +79,10 @@
                                                        unsigned int maxStandardPriority,
                                                        unsigned int maxLowPriority)
   {
+    oracle_.GetOracleObservable();
     scheduler_ = OracleScheduler::Create(oracle_, oracle_.GetOracleObservable(), oracle_,
                                          maxHighPriority, maxStandardPriority, maxLowPriority);
-    
+
     if (!scheduler_)
     {
       throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
--- a/Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h	Mon Jun 15 12:57:54 2020 +0200
+++ b/Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h	Mon Jun 15 16:26:57 2020 +0200
@@ -57,8 +57,7 @@
 
     {
       std::auto_ptr<ILoadersContext::ILock> lock(context.Lock());
-      DicomResourcesLoader::Factory f;
-      application->dicomLoader_ = boost::dynamic_pointer_cast<DicomResourcesLoader>(f.Create(*lock));
+      application->dicomLoader_ = DicomResourcesLoader::Create(*lock);
     }
 
     application->Register<DicomResourcesLoader::SuccessMessage>(*application->dicomLoader_, &SdlSimpleViewerApplication::Handle);
--- a/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h	Mon Jun 15 12:57:54 2020 +0200
+++ b/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h	Mon Jun 15 16:26:57 2020 +0200
@@ -101,8 +101,7 @@
 
       {
         std::auto_ptr<ILoadersContext::ILock> lock(context.Lock());
-        DicomResourcesLoader::Factory f;
-        application->dicomLoader_ = boost::dynamic_pointer_cast<DicomResourcesLoader>(f.Create(*lock));
+        application->dicomLoader_ = DicomResourcesLoader::Create(*lock);
       }
 
       application->Register<DicomResourcesLoader::SuccessMessage>(*application->dicomLoader_, &Application::Handle);
@@ -313,10 +312,7 @@
       {
         std::auto_ptr<ILoadersContext::ILock> lock(context.Lock());
 
-        {
-          DicomResourcesLoader::Factory f;
-          application->resourcesLoader_ = boost::dynamic_pointer_cast<DicomResourcesLoader>(f.Create(*lock));
-        }
+        application->resourcesLoader_ = DicomResourcesLoader::Create(*lock);
 
         {
           SeriesThumbnailsLoader::Factory f;