# HG changeset patch # User Sebastien Jodogne # Date 1495659249 -7200 # Node ID 8677d95753f8a4bec175424e0a9ad969f68686b2 # Parent f40a78cc7070c381565c3d6ca672c2117efa9be0 switching to Oracle in SDL samples diff -r f40a78cc7070 -r 8677d95753f8 Applications/BasicApplicationContext.cpp --- a/Applications/BasicApplicationContext.cpp Wed May 24 22:33:20 2017 +0200 +++ b/Applications/BasicApplicationContext.cpp Wed May 24 22:54:09 2017 +0200 @@ -41,8 +41,9 @@ } - BasicApplicationContext::BasicApplicationContext(OrthancSynchronousWebService& orthanc) : - orthanc_(orthanc), + BasicApplicationContext::BasicApplicationContext(Orthanc::WebServiceParameters& orthanc) : + oracle_(viewportMutex_, 4), // Use 4 threads to download + webService_(oracle_, orthanc), stopped_(true), updateDelay_(100) // By default, 100ms between each refresh of the content { @@ -82,7 +83,7 @@ bool isProgressiveDownload, size_t downloadThreadCount) { - std::auto_ptr volume + /*std::auto_ptr volume (new VolumeImage(new OrthancSeriesLoader(GetWebService().GetConnection(), series))); if (isProgressiveDownload) @@ -99,19 +100,23 @@ VolumeImage& result = *volume; volumes_.push_back(volume.release()); - return result; + return result;*/ + + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); } DicomStructureSet& BasicApplicationContext::AddStructureSet(const std::string& instance) { - std::auto_ptr structureSet + /*std::auto_ptr structureSet (new DicomStructureSet(GetWebService().GetConnection(), instance)); DicomStructureSet& result = *structureSet; structureSets_.push_back(structureSet.release()); - return result; + return result;*/ + + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); } @@ -130,6 +135,8 @@ void BasicApplicationContext::Start() { + oracle_.Start(); + for (Volumes::iterator it = volumes_.begin(); it != volumes_.end(); ++it) { assert(*it != NULL); @@ -160,5 +167,7 @@ assert(*it != NULL); (*it)->Stop(); } + + oracle_.Stop(); } } diff -r f40a78cc7070 -r 8677d95753f8 Applications/BasicApplicationContext.h --- a/Applications/BasicApplicationContext.h Wed May 24 22:33:20 2017 +0200 +++ b/Applications/BasicApplicationContext.h Wed May 24 22:54:09 2017 +0200 @@ -26,6 +26,7 @@ #include "../../Framework/Widgets/IWorldSceneInteractor.h" #include "../../Framework/Toolbox/DicomStructureSet.h" #include "../../Framework/Toolbox/OrthancSynchronousWebService.h" +#include "../../Platforms/Generic/OracleWebService.h" #include #include @@ -41,7 +42,8 @@ static void UpdateThread(BasicApplicationContext* that); - OrthancSynchronousWebService& orthanc_; + Oracle oracle_; + OracleWebService webService_; boost::mutex viewportMutex_; WidgetViewport viewport_; Volumes volumes_; @@ -72,15 +74,15 @@ }; - BasicApplicationContext(OrthancSynchronousWebService& orthanc); + BasicApplicationContext(Orthanc::WebServiceParameters& orthanc); ~BasicApplicationContext(); IWidget& SetCentralWidget(IWidget* widget); // Takes ownership - OrthancSynchronousWebService& GetWebService() + IWebService& GetWebService() { - return orthanc_; + return webService_; } VolumeImage& AddSeriesVolume(const std::string& series, diff -r f40a78cc7070 -r 8677d95753f8 Applications/IBasicApplication.cpp --- a/Applications/IBasicApplication.cpp Wed May 24 22:33:20 2017 +0200 +++ b/Applications/IBasicApplication.cpp Wed May 24 22:54:09 2017 +0200 @@ -197,12 +197,15 @@ } LOG(WARNING) << "URL to the Orthanc REST API: " << webService.GetUrl(); - OrthancSynchronousWebService orthanc(webService); + + { + OrthancSynchronousWebService orthanc(webService); - if (!MessagingToolbox::CheckOrthancVersion(orthanc.GetConnection())) - { - LOG(ERROR) << "Your version of Orthanc is incompatible with Orthanc Stone, please upgrade"; - throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); + if (!MessagingToolbox::CheckOrthancVersion(orthanc.GetConnection())) + { + LOG(ERROR) << "Your version of Orthanc is incompatible with Orthanc Stone, please upgrade"; + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); + } } @@ -213,7 +216,7 @@ LOG(WARNING) << "Creating the widgets of the application"; LogStatusBar statusBar; - BasicApplicationContext context(orthanc); + BasicApplicationContext context(webService); application.Initialize(context, statusBar, parameters); diff -r f40a78cc7070 -r 8677d95753f8 CMakeLists.txt --- a/CMakeLists.txt Wed May 24 22:33:20 2017 +0200 +++ b/CMakeLists.txt Wed May 24 22:54:09 2017 +0200 @@ -34,9 +34,9 @@ BuildSample(OrthancStoneEmpty 1) BuildSample(OrthancStoneTestPattern 2) BuildSample(OrthancStoneSingleFrame 3) -BuildSample(OrthancStoneSingleVolume 4) +#BuildSample(OrthancStoneSingleVolume 4) BuildSample(OrthancStoneBasicPetCtFusion 5) -BuildSample(OrthancStoneSynchronizedSeries 6) +#BuildSample(OrthancStoneSynchronizedSeries 6) BuildSample(OrthancStoneLayoutPetCtFusion 7)