Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Loaders/LoaderStateMachine.cpp @ 1592:0d4b11ba86df
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 23 Oct 2020 15:15:32 +0200 |
parents | 85e117739eca |
children | 4fb8fdf03314 |
rev | line source |
---|---|
815 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1271
0ca50d275b9a
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1225
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
815 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #include "LoaderStateMachine.h" | |
23 | |
1339
556b4bc19118
The loaders have been adapter to the nobroker architecture
Benjamin Golinvaux <bgo@osimis.io>
parents:
1337
diff
changeset
|
24 #include "../Loaders/ILoadersContext.h" |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
25 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1381
diff
changeset
|
26 #include <OrthancException.h> |
815 | 27 |
1337
b1396be5aa27
Moved the fixed loaders back from the dead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1314
diff
changeset
|
28 namespace OrthancStone |
815 | 29 { |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1135
diff
changeset
|
30 void LoaderStateMachine::State::Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) |
815 | 31 { |
32 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); | |
33 } | |
34 | |
35 | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1135
diff
changeset
|
36 void LoaderStateMachine::State::Handle(const OrthancStone::GetOrthancImageCommand::SuccessMessage& message) |
815 | 37 { |
38 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); | |
39 } | |
40 | |
41 | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1135
diff
changeset
|
42 void LoaderStateMachine::State::Handle(const OrthancStone::GetOrthancWebViewerJpegCommand::SuccessMessage& message) |
815 | 43 { |
44 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); | |
45 } | |
46 | |
47 | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1135
diff
changeset
|
48 void LoaderStateMachine::Schedule(OrthancStone::OracleCommandBase* command) |
815 | 49 { |
973
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
50 LOG(TRACE) << "LoaderStateMachine(" << std::hex << this << std::dec << ")::Schedule()"; |
964
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
956
diff
changeset
|
51 |
1299
c38c89684d83
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
52 std::unique_ptr<OrthancStone::OracleCommandBase> protection(command); |
815 | 53 |
54 if (command == NULL) | |
55 { | |
56 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); | |
57 } | |
58 | |
59 if (!command->HasPayload()) | |
60 { | |
61 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange, | |
62 "The payload must contain the next state"); | |
63 } | |
64 pendingCommands_.push_back(protection.release()); | |
964
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
956
diff
changeset
|
65 |
815 | 66 Step(); |
67 } | |
68 | |
69 | |
70 void LoaderStateMachine::Start() | |
71 { | |
973
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
72 LOG(TRACE) << "LoaderStateMachine(" << std::hex << this << std::dec << ")::Start()"; |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
73 |
815 | 74 if (active_) |
75 { | |
964
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
956
diff
changeset
|
76 LOG(TRACE) << "LoaderStateMachine::Start() called while active_ is true"; |
815 | 77 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
78 } | |
79 | |
80 active_ = true; | |
81 | |
82 for (size_t i = 0; i < simultaneousDownloads_; i++) | |
83 { | |
84 Step(); | |
85 } | |
86 } | |
87 | |
88 | |
89 void LoaderStateMachine::Step() | |
90 { | |
91 if (!pendingCommands_.empty() && | |
92 activeCommands_ < simultaneousDownloads_) | |
93 { | |
964
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
956
diff
changeset
|
94 |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1135
diff
changeset
|
95 OrthancStone::IOracleCommand* nextCommand = pendingCommands_.front(); |
964
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
956
diff
changeset
|
96 |
973
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
97 LOG(TRACE) << " LoaderStateMachine(" << std::hex << this << std::dec << |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
98 ")::Step(): activeCommands_ (" << activeCommands_ << |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
99 ") < simultaneousDownloads_ (" << simultaneousDownloads_ << |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
100 ") --> will Schedule command addr " << std::hex << nextCommand << std::dec; |
964
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
956
diff
changeset
|
101 |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
102 { |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
103 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock()); |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
104 boost::shared_ptr<IObserver> observer(GetSharedObserver()); |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
105 lock->Schedule(observer, 0, nextCommand); // TODO: priority! |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
106 } |
815 | 107 pendingCommands_.pop_front(); |
108 | |
109 activeCommands_++; | |
110 } | |
964
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
956
diff
changeset
|
111 else |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
956
diff
changeset
|
112 { |
973
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
113 LOG(TRACE) << " LoaderStateMachine(" << std::hex << this << std::dec << |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
114 ")::Step(): activeCommands_ (" << activeCommands_ << |
1061
eb28dfe432f7
fixed typo in assert. msg. + getters for custom windowing in grayscale layer configurator.
Benjamin Golinvaux <bgo@osimis.io>
parents:
977
diff
changeset
|
115 ") >= simultaneousDownloads_ (" << simultaneousDownloads_ << |
973
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
116 ") --> will NOT Schedule command"; |
964
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
956
diff
changeset
|
117 } |
815 | 118 } |
119 | |
120 | |
121 void LoaderStateMachine::Clear() | |
122 { | |
973
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
123 LOG(TRACE) << "LoaderStateMachine(" << std::hex << this << std::dec << ")::Clear()"; |
815 | 124 for (PendingCommands::iterator it = pendingCommands_.begin(); |
125 it != pendingCommands_.end(); ++it) | |
126 { | |
127 delete *it; | |
128 } | |
129 | |
130 pendingCommands_.clear(); | |
131 } | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1135
diff
changeset
|
132 |
815 | 133 |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1135
diff
changeset
|
134 void LoaderStateMachine::HandleExceptionMessage(const OrthancStone::OracleCommandExceptionMessage& message) |
815 | 135 { |
956
a7351ad54960
Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents:
840
diff
changeset
|
136 LOG(ERROR) << "LoaderStateMachine::HandleExceptionMessage: error in the state machine, stopping all processing"; |
840
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
815
diff
changeset
|
137 LOG(ERROR) << "Error: " << message.GetException().What() << " Details: " << |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
815
diff
changeset
|
138 message.GetException().GetDetails(); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
815
diff
changeset
|
139 Clear(); |
815 | 140 } |
141 | |
142 template <typename T> | |
143 void LoaderStateMachine::HandleSuccessMessage(const T& message) | |
144 { | |
1571 | 145 if (activeCommands_ == 0) { |
973
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
146 LOG(ERROR) << "LoaderStateMachine(" << std::hex << this << std::dec << ")::HandleSuccessMessage : activeCommands_ should be > 0 but is: " << activeCommands_; |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
147 } |
975
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
148 else { |
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
149 activeCommands_--; |
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
150 try |
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
151 { |
1135
a0a33e5ea5bb
IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
152 dynamic_cast<State&>(message.GetOrigin().GetPayload()).Handle(message); |
975
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
153 Step(); |
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
154 } |
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
155 catch (Orthanc::OrthancException& e) |
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
156 { |
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
157 LOG(ERROR) << "Error in the state machine, stopping all processing: " << |
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
158 e.What() << " Details: " << e.GetDetails(); |
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
159 Clear(); |
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
160 } |
815 | 161 } |
162 } | |
163 | |
164 | |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
165 LoaderStateMachine::LoaderStateMachine( |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
166 OrthancStone::ILoadersContext& loadersContext) |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
167 : loadersContext_(loadersContext) |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
168 , active_(false) |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
169 , simultaneousDownloads_(4) |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
170 , activeCommands_(0) |
815 | 171 { |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
172 using OrthancStone::ILoadersContext; |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
173 |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
174 LOG(TRACE) |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
175 << "LoaderStateMachine(" << std::hex << this |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
176 << std::dec << ")::LoaderStateMachine()"; |
1314
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
177 } |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
178 |
1314
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
179 void LoaderStateMachine::PostConstructor() |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
180 { |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
181 std::unique_ptr<OrthancStone::ILoadersContext::ILock> |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
182 lock(loadersContext_.Lock()); |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
183 |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
184 OrthancStone::IObservable& observable = lock->GetOracleObservable(); |
973
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
185 |
1314
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
186 // TODO => Move this out of constructor |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
187 Register<OrthancStone::OrthancRestApiCommand::SuccessMessage>( |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
188 observable, &LoaderStateMachine::HandleSuccessMessage); |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
189 Register<OrthancStone::GetOrthancImageCommand::SuccessMessage>( |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
190 observable, &LoaderStateMachine::HandleSuccessMessage); |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
191 Register<OrthancStone::GetOrthancWebViewerJpegCommand::SuccessMessage>( |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
192 observable, &LoaderStateMachine::HandleSuccessMessage); |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
193 Register<OrthancStone::OracleCommandExceptionMessage>( |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
194 observable, &LoaderStateMachine::HandleExceptionMessage); |
815 | 195 } |
196 | |
973
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
197 LoaderStateMachine::~LoaderStateMachine() |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
198 { |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
199 LOG(TRACE) << "LoaderStateMachine(" << std::hex << this << std::dec << ")::~LoaderStateMachine()"; |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
200 Clear(); |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
964
diff
changeset
|
201 } |
815 | 202 |
203 void LoaderStateMachine::SetSimultaneousDownloads(unsigned int count) | |
204 { | |
205 if (active_) | |
206 { | |
956
a7351ad54960
Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents:
840
diff
changeset
|
207 LOG(ERROR) << "LoaderStateMachine::SetSimultaneousDownloads called while active_ is true"; |
815 | 208 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
209 } | |
210 else if (count == 0) | |
211 { | |
212 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | |
213 } | |
214 else | |
215 { | |
216 simultaneousDownloads_ = count; | |
217 } | |
218 } | |
219 } |