comparison OrthancServer/ServerJobs/Operations/SystemCallOperation.cpp @ 2656:a6d3e45eeff5 jobs

SerializationToolbox
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Jun 2018 18:25:23 +0200
parents c196d76cb8fa
children c27f7ecf9b54
comparison
equal deleted inserted replaced
2655:c196d76cb8fa 2656:a6d3e45eeff5
36 36
37 #include "DicomInstanceOperationValue.h" 37 #include "DicomInstanceOperationValue.h"
38 38
39 #include "../../../Core/JobsEngine/Operations/StringOperationValue.h" 39 #include "../../../Core/JobsEngine/Operations/StringOperationValue.h"
40 #include "../../../Core/Logging.h" 40 #include "../../../Core/Logging.h"
41 #include "../../../Core/SerializationToolbox.h"
41 #include "../../../Core/TemporaryFile.h" 42 #include "../../../Core/TemporaryFile.h"
42 #include "../../../Core/Toolbox.h" 43 #include "../../../Core/Toolbox.h"
43 44
44 namespace Orthanc 45 namespace Orthanc
45 { 46 {
116 void SystemCallOperation::Serialize(Json::Value& result) const 117 void SystemCallOperation::Serialize(Json::Value& result) const
117 { 118 {
118 result = Json::objectValue; 119 result = Json::objectValue;
119 result["Type"] = "SystemCall"; 120 result["Type"] = "SystemCall";
120 result["Command"] = command_; 121 result["Command"] = command_;
121 IJobUnserializer::WriteArrayOfStrings(result, preArguments_, "PreArguments"); 122 SerializationToolbox::WriteArrayOfStrings(result, preArguments_, "PreArguments");
122 IJobUnserializer::WriteArrayOfStrings(result, postArguments_, "PostArguments"); 123 SerializationToolbox::WriteArrayOfStrings(result, postArguments_, "PostArguments");
123 } 124 }
124 125
125 126
126 SystemCallOperation::SystemCallOperation(const Json::Value& serialized) 127 SystemCallOperation::SystemCallOperation(const Json::Value& serialized)
127 { 128 {
128 if (IJobUnserializer::ReadString(serialized, "Type") != "SystemCall") 129 if (SerializationToolbox::ReadString(serialized, "Type") != "SystemCall")
129 { 130 {
130 throw OrthancException(ErrorCode_BadFileFormat); 131 throw OrthancException(ErrorCode_BadFileFormat);
131 } 132 }
132 133
133 command_ = IJobUnserializer::ReadString(serialized, "Command"); 134 command_ = SerializationToolbox::ReadString(serialized, "Command");
134 IJobUnserializer::ReadArrayOfStrings(preArguments_, serialized, "PreArguments"); 135 SerializationToolbox::ReadArrayOfStrings(preArguments_, serialized, "PreArguments");
135 IJobUnserializer::ReadArrayOfStrings(postArguments_, serialized, "PostArguments"); 136 SerializationToolbox::ReadArrayOfStrings(postArguments_, serialized, "PostArguments");
136 } 137 }
137 } 138 }