comparison Plugins/Samples/Common/OrthancPluginCppWrapper.cpp @ 2059:8e67325eaa3f

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 Jun 2016 20:02:21 +0200
parents 43cd2ab060c7
children 40ffd0e8676a
comparison
equal deleted inserted replaced
2058:43cd2ab060c7 2059:8e67325eaa3f
49 { 49 {
50 return "No description available"; 50 return "No description available";
51 } 51 }
52 } 52 }
53 53
54
55 void PluginException::Check(OrthancPluginErrorCode code)
56 {
57 if (code != OrthancPluginErrorCode_Success)
58 {
59 throw PluginException(code);
60 }
61 }
62
54 63
55 MemoryBuffer::MemoryBuffer(OrthancPluginContext* context) : 64 MemoryBuffer::MemoryBuffer(OrthancPluginContext* context) :
56 context_(context) 65 context_(context)
57 { 66 {
58 buffer_.data = NULL; 67 buffer_.data = NULL;
228 const Json::Value& body, 237 const Json::Value& body,
229 bool applyPlugins) 238 bool applyPlugins)
230 { 239 {
231 Json::FastWriter writer; 240 Json::FastWriter writer;
232 return RestApiPut(uri, writer.write(body), applyPlugins); 241 return RestApiPut(uri, writer.write(body), applyPlugins);
242 }
243
244
245 void MemoryBuffer::CreateDicom(const Json::Value& tags,
246 OrthancPluginCreateDicomFlags flags)
247 {
248 Clear();
249
250 Json::FastWriter writer;
251 std::string s = writer.write(tags);
252
253 PluginException::Check(OrthancPluginCreateDicom(context_, &buffer_, s.c_str(), NULL, flags));
233 } 254 }
234 255
235 256
236 OrthancString::OrthancString(OrthancPluginContext* context, 257 OrthancString::OrthancString(OrthancPluginContext* context,
237 char* str) : 258 char* str) :