Mercurial > hg > orthanc
comparison Core/JobsEngine/JobStatus.cpp @ 2663:228e2783ce83 jobs
some jobs might not be serializable
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 07 Jun 2018 18:18:02 +0200 |
parents | e1893d31652a |
children | 4e43e67f8ecf |
comparison
equal
deleted
inserted
replaced
2662:47d812308d63 | 2663:228e2783ce83 |
---|---|
32 | 32 |
33 | 33 |
34 #include "../PrecompiledHeaders.h" | 34 #include "../PrecompiledHeaders.h" |
35 #include "JobStatus.h" | 35 #include "JobStatus.h" |
36 | 36 |
37 #include "../OrthancException.h" | |
38 | |
37 namespace Orthanc | 39 namespace Orthanc |
38 { | 40 { |
39 JobStatus::JobStatus() : | 41 JobStatus::JobStatus() : |
40 errorCode_(ErrorCode_InternalError), | 42 errorCode_(ErrorCode_InternalError), |
41 progress_(0), | 43 progress_(0), |
42 jobType_("Invalid"), | 44 jobType_("Invalid"), |
43 publicContent_(Json::objectValue), | 45 publicContent_(Json::objectValue), |
44 serialized_(Json::objectValue) | 46 hasSerialized_(false) |
45 { | 47 { |
46 } | 48 } |
47 | 49 |
48 | 50 |
49 JobStatus::JobStatus(ErrorCode code, | 51 JobStatus::JobStatus(ErrorCode code, |
62 progress_ = 1; | 64 progress_ = 1; |
63 } | 65 } |
64 | 66 |
65 job.GetJobType(jobType_); | 67 job.GetJobType(jobType_); |
66 job.GetPublicContent(publicContent_); | 68 job.GetPublicContent(publicContent_); |
67 job.Serialize(serialized_); | 69 |
70 hasSerialized_ = job.Serialize(serialized_); | |
71 } | |
72 | |
73 | |
74 const Json::Value& JobStatus::GetSerialized() const | |
75 { | |
76 if (!hasSerialized_) | |
77 { | |
78 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
79 } | |
80 else | |
81 { | |
82 return serialized_; | |
83 } | |
68 } | 84 } |
69 } | 85 } |