comparison Applications/BasicApplicationContext.cpp @ 81:8677d95753f8 wasm

switching to Oracle in SDL samples
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 24 May 2017 22:54:09 +0200
parents 1553b67b24e5
children 02c3a7a4938f
comparison
equal deleted inserted replaced
80:f40a78cc7070 81:8677d95753f8
39 boost::this_thread::sleep(boost::posix_time::milliseconds(that->updateDelay_)); 39 boost::this_thread::sleep(boost::posix_time::milliseconds(that->updateDelay_));
40 } 40 }
41 } 41 }
42 42
43 43
44 BasicApplicationContext::BasicApplicationContext(OrthancSynchronousWebService& orthanc) : 44 BasicApplicationContext::BasicApplicationContext(Orthanc::WebServiceParameters& orthanc) :
45 orthanc_(orthanc), 45 oracle_(viewportMutex_, 4), // Use 4 threads to download
46 webService_(oracle_, orthanc),
46 stopped_(true), 47 stopped_(true),
47 updateDelay_(100) // By default, 100ms between each refresh of the content 48 updateDelay_(100) // By default, 100ms between each refresh of the content
48 { 49 {
49 } 50 }
50 51
80 81
81 VolumeImage& BasicApplicationContext::AddSeriesVolume(const std::string& series, 82 VolumeImage& BasicApplicationContext::AddSeriesVolume(const std::string& series,
82 bool isProgressiveDownload, 83 bool isProgressiveDownload,
83 size_t downloadThreadCount) 84 size_t downloadThreadCount)
84 { 85 {
85 std::auto_ptr<VolumeImage> volume 86 /*std::auto_ptr<VolumeImage> volume
86 (new VolumeImage(new OrthancSeriesLoader(GetWebService().GetConnection(), series))); 87 (new VolumeImage(new OrthancSeriesLoader(GetWebService().GetConnection(), series)));
87 88
88 if (isProgressiveDownload) 89 if (isProgressiveDownload)
89 { 90 {
90 volume->SetDownloadPolicy(new VolumeImageProgressivePolicy); 91 volume->SetDownloadPolicy(new VolumeImageProgressivePolicy);
97 volume->SetThreadCount(downloadThreadCount); 98 volume->SetThreadCount(downloadThreadCount);
98 99
99 VolumeImage& result = *volume; 100 VolumeImage& result = *volume;
100 volumes_.push_back(volume.release()); 101 volumes_.push_back(volume.release());
101 102
102 return result; 103 return result;*/
104
105 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
103 } 106 }
104 107
105 108
106 DicomStructureSet& BasicApplicationContext::AddStructureSet(const std::string& instance) 109 DicomStructureSet& BasicApplicationContext::AddStructureSet(const std::string& instance)
107 { 110 {
108 std::auto_ptr<DicomStructureSet> structureSet 111 /*std::auto_ptr<DicomStructureSet> structureSet
109 (new DicomStructureSet(GetWebService().GetConnection(), instance)); 112 (new DicomStructureSet(GetWebService().GetConnection(), instance));
110 113
111 DicomStructureSet& result = *structureSet; 114 DicomStructureSet& result = *structureSet;
112 structureSets_.push_back(structureSet.release()); 115 structureSets_.push_back(structureSet.release());
113 116
114 return result; 117 return result;*/
118
119 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
115 } 120 }
116 121
117 122
118 IWorldSceneInteractor& BasicApplicationContext::AddInteractor(IWorldSceneInteractor* interactor) 123 IWorldSceneInteractor& BasicApplicationContext::AddInteractor(IWorldSceneInteractor* interactor)
119 { 124 {
128 } 133 }
129 134
130 135
131 void BasicApplicationContext::Start() 136 void BasicApplicationContext::Start()
132 { 137 {
138 oracle_.Start();
139
133 for (Volumes::iterator it = volumes_.begin(); it != volumes_.end(); ++it) 140 for (Volumes::iterator it = volumes_.begin(); it != volumes_.end(); ++it)
134 { 141 {
135 assert(*it != NULL); 142 assert(*it != NULL);
136 (*it)->Start(); 143 (*it)->Start();
137 } 144 }
158 for (Volumes::iterator it = volumes_.begin(); it != volumes_.end(); ++it) 165 for (Volumes::iterator it = volumes_.begin(); it != volumes_.end(); ++it)
159 { 166 {
160 assert(*it != NULL); 167 assert(*it != NULL);
161 (*it)->Stop(); 168 (*it)->Stop();
162 } 169 }
170
171 oracle_.Stop();
163 } 172 }
164 } 173 }