Mercurial > hg > orthanc
annotate Core/JobsEngine/Operations/SequenceOfOperationsJob.cpp @ 2640:c691fcf66071 jobs
ResourceModificationJob
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 28 May 2018 16:30:17 +0200 |
parents | 83ac5a05ce84 |
children | e1893d31652a |
rev | line source |
---|---|
2603 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
34 #include "../../PrecompiledHeaders.h" | |
35 #include "SequenceOfOperationsJob.h" | |
36 | |
37 #include "../../Logging.h" | |
38 #include "../../OrthancException.h" | |
39 | |
40 namespace Orthanc | |
41 { | |
42 class SequenceOfOperationsJob::Operation : public boost::noncopyable | |
43 { | |
44 private: | |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
45 size_t index_; |
2603 | 46 JobOperationValues originalInputs_; |
47 JobOperationValues workInputs_; | |
48 std::auto_ptr<IJobOperation> operation_; | |
49 std::list<Operation*> nextOperations_; | |
50 size_t currentInput_; | |
51 | |
52 public: | |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
53 Operation(size_t index, |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
54 IJobOperation* operation) : |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
55 index_(index), |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
56 operation_(operation), |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
57 currentInput_(0) |
2603 | 58 { |
59 if (operation == NULL) | |
60 { | |
61 throw OrthancException(ErrorCode_NullPointer); | |
62 } | |
63 } | |
64 | |
65 void AddOriginalInput(const JobOperationValue& value) | |
66 { | |
67 if (currentInput_ != 0) | |
68 { | |
69 // Cannot add input after processing has started | |
70 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
71 } | |
72 else | |
73 { | |
74 originalInputs_.Append(value.Clone()); | |
75 } | |
76 } | |
77 | |
78 const JobOperationValues& GetOriginalInputs() const | |
79 { | |
80 return originalInputs_; | |
81 } | |
82 | |
83 void Reset() | |
84 { | |
85 workInputs_.Clear(); | |
86 currentInput_ = 0; | |
87 } | |
88 | |
89 void AddNextOperation(Operation& other) | |
90 { | |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
91 if (other.index_ <= index_) |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
92 { |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
93 throw OrthancException(ErrorCode_InternalError); |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
94 } |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
95 |
2603 | 96 if (currentInput_ != 0) |
97 { | |
98 // Cannot add input after processing has started | |
99 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
100 } | |
101 else | |
102 { | |
103 nextOperations_.push_back(&other); | |
104 } | |
105 } | |
106 | |
107 bool IsDone() const | |
108 { | |
109 return currentInput_ >= originalInputs_.GetSize() + workInputs_.GetSize(); | |
110 } | |
111 | |
2608
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
112 void Step(IDicomConnectionManager& connectionManager) |
2603 | 113 { |
114 if (IsDone()) | |
115 { | |
116 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
117 } | |
118 | |
119 const JobOperationValue* input; | |
120 | |
121 if (currentInput_ < originalInputs_.GetSize()) | |
122 { | |
123 input = &originalInputs_.GetValue(currentInput_); | |
124 } | |
125 else | |
126 { | |
127 input = &workInputs_.GetValue(currentInput_ - originalInputs_.GetSize()); | |
128 } | |
129 | |
130 JobOperationValues outputs; | |
2608
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
131 operation_->Apply(outputs, *input, connectionManager); |
2603 | 132 |
133 if (!nextOperations_.empty()) | |
134 { | |
135 std::list<Operation*>::iterator first = nextOperations_.begin(); | |
136 outputs.Move((*first)->workInputs_); | |
137 | |
138 std::list<Operation*>::iterator current = first; | |
139 ++current; | |
140 | |
141 while (current != nextOperations_.end()) | |
142 { | |
143 (*first)->workInputs_.Copy((*current)->workInputs_); | |
144 ++current; | |
145 } | |
146 } | |
147 | |
148 currentInput_ += 1; | |
149 } | |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
150 |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
151 void Serialize(Json::Value& target) const |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
152 { |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
153 target = Json::objectValue; |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
154 operation_->Serialize(target["Operation"]); |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
155 originalInputs_.Serialize(target["OriginalInputs"]); |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
156 workInputs_.Serialize(target["WorkInputs"]); |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
157 |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
158 Json::Value tmp = Json::arrayValue; |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
159 for (std::list<Operation*>::const_iterator it = nextOperations_.begin(); |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
160 it != nextOperations_.end(); ++it) |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
161 { |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
162 tmp.append(static_cast<int>((*it)->index_)); |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
163 } |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
164 |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
165 target["NextOperations"] = tmp; |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
166 } |
2603 | 167 }; |
168 | |
169 | |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
170 SequenceOfOperationsJob::SequenceOfOperationsJob() : |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
171 done_(false), |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
172 current_(0), |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
173 trailingTimeout_(boost::posix_time::milliseconds(1000)) |
2603 | 174 { |
175 } | |
176 | |
177 | |
178 SequenceOfOperationsJob::~SequenceOfOperationsJob() | |
179 { | |
180 for (size_t i = 0; i < operations_.size(); i++) | |
181 { | |
182 if (operations_[i] != NULL) | |
183 { | |
184 delete operations_[i]; | |
185 } | |
186 } | |
187 } | |
188 | |
189 | |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
190 void SequenceOfOperationsJob::SetDescription(const std::string& description) |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
191 { |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
192 boost::mutex::scoped_lock lock(mutex_); |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
193 description_ = description; |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
194 } |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
195 |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
196 |
2603 | 197 void SequenceOfOperationsJob::Register(IObserver& observer) |
198 { | |
199 boost::mutex::scoped_lock lock(mutex_); | |
200 observers_.push_back(&observer); | |
201 } | |
202 | |
203 | |
204 void SequenceOfOperationsJob::Lock::SetTrailingOperationTimeout(unsigned int timeout) | |
205 { | |
206 that_.trailingTimeout_ = boost::posix_time::milliseconds(timeout); | |
207 } | |
208 | |
2608
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
209 |
2620
1232922c8793
speeding up shutdown if Lua script is in trailing phase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2616
diff
changeset
|
210 void SequenceOfOperationsJob::Lock::SetDicomAssociationTimeout(unsigned int timeout) |
2608
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
211 { |
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
212 that_.connectionManager_.SetTimeout(timeout); |
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
213 } |
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
214 |
2603 | 215 |
216 size_t SequenceOfOperationsJob::Lock::AddOperation(IJobOperation* operation) | |
217 { | |
218 if (IsDone()) | |
219 { | |
220 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
221 } | |
222 | |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
223 size_t index = that_.operations_.size(); |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
224 |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
225 that_.operations_.push_back(new Operation(index, operation)); |
2603 | 226 that_.operationAdded_.notify_one(); |
227 | |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
228 return index; |
2603 | 229 } |
230 | |
231 | |
232 void SequenceOfOperationsJob::Lock::AddInput(size_t index, | |
233 const JobOperationValue& value) | |
234 { | |
235 if (IsDone()) | |
236 { | |
237 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
238 } | |
239 else if (index >= that_.operations_.size() || | |
240 index < that_.current_) | |
241 { | |
242 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
243 } | |
244 else | |
245 { | |
246 that_.operations_[index]->AddOriginalInput(value); | |
247 } | |
248 } | |
249 | |
250 | |
251 void SequenceOfOperationsJob::Lock::Connect(size_t input, | |
252 size_t output) | |
253 { | |
254 if (IsDone()) | |
255 { | |
256 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
257 } | |
258 else if (input >= output || | |
259 input >= that_.operations_.size() || | |
260 output >= that_.operations_.size() || | |
261 input < that_.current_ || | |
262 output < that_.current_) | |
263 { | |
264 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
265 } | |
266 else | |
267 { | |
268 Operation& a = *that_.operations_[input]; | |
269 Operation& b = *that_.operations_[output]; | |
270 a.AddNextOperation(b); | |
271 } | |
272 } | |
273 | |
274 | |
275 JobStepResult SequenceOfOperationsJob::ExecuteStep() | |
276 { | |
277 boost::mutex::scoped_lock lock(mutex_); | |
278 | |
279 if (current_ == operations_.size()) | |
280 { | |
281 LOG(INFO) << "Executing the trailing timeout in the sequence of operations"; | |
282 operationAdded_.timed_wait(lock, trailingTimeout_); | |
283 | |
284 if (current_ == operations_.size()) | |
285 { | |
286 // No operation was added during the trailing timeout: The | |
287 // job is over | |
288 LOG(INFO) << "The sequence of operations is over"; | |
289 done_ = true; | |
290 | |
291 for (std::list<IObserver*>::iterator it = observers_.begin(); | |
292 it != observers_.end(); ++it) | |
293 { | |
294 (*it)->SignalDone(*this); | |
295 } | |
296 | |
2608
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
297 connectionManager_.Close(); |
2603 | 298 return JobStepResult::Success(); |
299 } | |
300 else | |
301 { | |
302 LOG(INFO) << "New operation added to the sequence of operations"; | |
303 } | |
304 } | |
305 | |
306 assert(current_ < operations_.size()); | |
307 | |
308 while (current_ < operations_.size() && | |
309 operations_[current_]->IsDone()) | |
310 { | |
311 current_++; | |
312 } | |
313 | |
314 if (current_ < operations_.size()) | |
315 { | |
2608
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
316 operations_[current_]->Step(connectionManager_); |
2603 | 317 } |
318 | |
2608
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
319 connectionManager_.CheckTimeout(); |
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
320 |
2603 | 321 return JobStepResult::Continue(); |
322 } | |
323 | |
324 | |
325 void SequenceOfOperationsJob::SignalResubmit() | |
326 { | |
327 boost::mutex::scoped_lock lock(mutex_); | |
328 | |
329 current_ = 0; | |
330 done_ = false; | |
331 | |
332 for (size_t i = 0; i < operations_.size(); i++) | |
333 { | |
334 operations_[i]->Reset(); | |
335 } | |
336 } | |
337 | |
338 | |
2608
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
339 void SequenceOfOperationsJob::ReleaseResources() |
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
340 { |
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
341 boost::mutex::scoped_lock lock(mutex_); |
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
342 connectionManager_.Close(); |
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
343 } |
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
344 |
25225f0b4f33
simplification wrt. dicom connection manager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
345 |
2603 | 346 float SequenceOfOperationsJob::GetProgress() |
347 { | |
348 boost::mutex::scoped_lock lock(mutex_); | |
349 | |
350 return (static_cast<float>(current_) / | |
351 static_cast<float>(operations_.size() + 1)); | |
352 } | |
353 | |
354 | |
355 void SequenceOfOperationsJob::GetPublicContent(Json::Value& value) | |
356 { | |
357 boost::mutex::scoped_lock lock(mutex_); | |
358 | |
359 value["CountOperations"] = static_cast<unsigned int>(operations_.size()); | |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
360 value["Description"] = description_; |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
361 } |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
362 |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
363 |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
364 void SequenceOfOperationsJob::GetInternalContent(Json::Value& value) |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
365 { |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
366 boost::mutex::scoped_lock lock(mutex_); |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
367 |
2621
83ac5a05ce84
primitives for unserializing jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2620
diff
changeset
|
368 Json::Value tmp = Json::arrayValue; |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
369 for (size_t i = 0; i < operations_.size(); i++) |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
370 { |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
371 Json::Value operation = Json::objectValue; |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
372 operations_[i]->Serialize(operation); |
2621
83ac5a05ce84
primitives for unserializing jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2620
diff
changeset
|
373 tmp.append(operation); |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2608
diff
changeset
|
374 } |
2621
83ac5a05ce84
primitives for unserializing jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2620
diff
changeset
|
375 |
83ac5a05ce84
primitives for unserializing jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2620
diff
changeset
|
376 value["Operations"] = tmp; |
83ac5a05ce84
primitives for unserializing jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2620
diff
changeset
|
377 value["TrailingTimeout"] = static_cast<unsigned int>(trailingTimeout_.total_milliseconds()); |
83ac5a05ce84
primitives for unserializing jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2620
diff
changeset
|
378 value["DicomTimeout"] = connectionManager_.GetTimeout(); |
83ac5a05ce84
primitives for unserializing jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2620
diff
changeset
|
379 value["Current"] = static_cast<unsigned int>(current_); |
2603 | 380 } |
381 } |