Mercurial > hg > orthanc
comparison Core/JobsEngine/GenericJobUnserializer.cpp @ 2655:c196d76cb8fa jobs
serialization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 05 Jun 2018 17:57:49 +0200 |
parents | a3f0f61a14ca |
children | a6d3e45eeff5 |
comparison
equal
deleted
inserted
replaced
2654:761031029aa9 | 2655:c196d76cb8fa |
---|---|
43 | 43 |
44 namespace Orthanc | 44 namespace Orthanc |
45 { | 45 { |
46 IJob* GenericJobUnserializer::UnserializeJob(const Json::Value& source) | 46 IJob* GenericJobUnserializer::UnserializeJob(const Json::Value& source) |
47 { | 47 { |
48 const std::string type = GetString(source, "Type"); | 48 const std::string type = ReadString(source, "Type"); |
49 | 49 |
50 LOG(ERROR) << "Cannot unserialize job of type: " << type; | 50 LOG(ERROR) << "Cannot unserialize job of type: " << type; |
51 throw OrthancException(ErrorCode_BadFileFormat); | 51 throw OrthancException(ErrorCode_BadFileFormat); |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 IJobOperation* GenericJobUnserializer::UnserializeOperation(const Json::Value& source) | 55 IJobOperation* GenericJobUnserializer::UnserializeOperation(const Json::Value& source) |
56 { | 56 { |
57 const std::string type = GetString(source, "Type"); | 57 const std::string type = ReadString(source, "Type"); |
58 | 58 |
59 if (type == "Log") | 59 if (type == "Log") |
60 { | 60 { |
61 return new LogJobOperation; | 61 return new LogJobOperation; |
62 } | 62 } |
68 } | 68 } |
69 | 69 |
70 | 70 |
71 JobOperationValue* GenericJobUnserializer::UnserializeValue(const Json::Value& source) | 71 JobOperationValue* GenericJobUnserializer::UnserializeValue(const Json::Value& source) |
72 { | 72 { |
73 const std::string type = GetString(source, "Type"); | 73 const std::string type = ReadString(source, "Type"); |
74 | 74 |
75 if (type == "String") | 75 if (type == "String") |
76 { | 76 { |
77 return new StringOperationValue(GetString(source, "Content")); | 77 return new StringOperationValue(ReadString(source, "Content")); |
78 } | 78 } |
79 else if (type == "Null") | 79 else if (type == "Null") |
80 { | 80 { |
81 return new NullOperationValue; | 81 return new NullOperationValue; |
82 } | 82 } |