Mercurial > hg > orthanc
comparison OrthancFramework/Sources/JobsEngine/Operations/SequenceOfOperationsJob.cpp @ 4304:50b0c69b653a
continued abi
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 06 Nov 2020 16:33:52 +0100 |
parents | bf7b9edf6b81 |
children | 2ae905070221 |
comparison
equal
deleted
inserted
replaced
4303:44b53a2c0a13 | 4304:50b0c69b653a |
---|---|
234 boost::mutex::scoped_lock lock(mutex_); | 234 boost::mutex::scoped_lock lock(mutex_); |
235 observers_.push_back(&observer); | 235 observers_.push_back(&observer); |
236 } | 236 } |
237 | 237 |
238 | 238 |
239 SequenceOfOperationsJob::Lock::Lock(SequenceOfOperationsJob& that) : | |
240 that_(that), | |
241 lock_(that.mutex_) | |
242 { | |
243 } | |
244 | |
245 bool SequenceOfOperationsJob::Lock::IsDone() const | |
246 { | |
247 return that_.done_; | |
248 } | |
249 | |
239 void SequenceOfOperationsJob::Lock::SetTrailingOperationTimeout(unsigned int timeout) | 250 void SequenceOfOperationsJob::Lock::SetTrailingOperationTimeout(unsigned int timeout) |
240 { | 251 { |
241 that_.trailingTimeout_ = boost::posix_time::milliseconds(timeout); | 252 that_.trailingTimeout_ = boost::posix_time::milliseconds(timeout); |
242 } | 253 } |
243 | 254 |
253 | 264 |
254 that_.operations_.push_back(new Operation(index, operation)); | 265 that_.operations_.push_back(new Operation(index, operation)); |
255 that_.operationAdded_.notify_one(); | 266 that_.operationAdded_.notify_one(); |
256 | 267 |
257 return index; | 268 return index; |
269 } | |
270 | |
271 size_t SequenceOfOperationsJob::Lock::GetOperationsCount() const | |
272 { | |
273 return that_.operations_.size(); | |
258 } | 274 } |
259 | 275 |
260 | 276 |
261 void SequenceOfOperationsJob::Lock::AddInput(size_t index, | 277 void SequenceOfOperationsJob::Lock::AddInput(size_t index, |
262 const JobOperationValue& value) | 278 const JobOperationValue& value) |
299 a.AddNextOperation(b, false /* not unserializing */); | 315 a.AddNextOperation(b, false /* not unserializing */); |
300 } | 316 } |
301 } | 317 } |
302 | 318 |
303 | 319 |
320 void SequenceOfOperationsJob::Start() | |
321 { | |
322 } | |
323 | |
324 | |
304 JobStepResult SequenceOfOperationsJob::Step(const std::string& jobId) | 325 JobStepResult SequenceOfOperationsJob::Step(const std::string& jobId) |
305 { | 326 { |
306 boost::mutex::scoped_lock lock(mutex_); | 327 boost::mutex::scoped_lock lock(mutex_); |
307 | 328 |
308 if (current_ == operations_.size()) | 329 if (current_ == operations_.size()) |
359 { | 380 { |
360 operations_[i]->Reset(); | 381 operations_[i]->Reset(); |
361 } | 382 } |
362 } | 383 } |
363 | 384 |
385 void SequenceOfOperationsJob::Stop(JobStopReason reason) | |
386 { | |
387 } | |
388 | |
364 | 389 |
365 float SequenceOfOperationsJob::GetProgress() | 390 float SequenceOfOperationsJob::GetProgress() |
366 { | 391 { |
367 boost::mutex::scoped_lock lock(mutex_); | 392 boost::mutex::scoped_lock lock(mutex_); |
368 | 393 |
369 return (static_cast<float>(current_) / | 394 return (static_cast<float>(current_) / |
370 static_cast<float>(operations_.size() + 1)); | 395 static_cast<float>(operations_.size() + 1)); |
396 } | |
397 | |
398 void SequenceOfOperationsJob::GetJobType(std::string& target) | |
399 { | |
400 target = "SequenceOfOperations"; | |
371 } | 401 } |
372 | 402 |
373 | 403 |
374 void SequenceOfOperationsJob::GetPublicContent(Json::Value& value) | 404 void SequenceOfOperationsJob::GetPublicContent(Json::Value& value) |
375 { | 405 { |
405 value[OPERATIONS] = tmp; | 435 value[OPERATIONS] = tmp; |
406 | 436 |
407 return true; | 437 return true; |
408 } | 438 } |
409 | 439 |
440 bool SequenceOfOperationsJob::GetOutput(std::string& output, | |
441 MimeType& mime, | |
442 const std::string& key) | |
443 { | |
444 return false; | |
445 } | |
446 | |
447 void SequenceOfOperationsJob::AwakeTrailingSleep() | |
448 { | |
449 operationAdded_.notify_one(); | |
450 } | |
451 | |
410 | 452 |
411 SequenceOfOperationsJob::SequenceOfOperationsJob(IJobUnserializer& unserializer, | 453 SequenceOfOperationsJob::SequenceOfOperationsJob(IJobUnserializer& unserializer, |
412 const Json::Value& serialized) : | 454 const Json::Value& serialized) : |
413 done_(false) | 455 done_(false) |
414 { | 456 { |