comparison Resources/Orthanc/Plugins/Samples/Common/OrthancPluginConnection.cpp @ 69:d529d9ce3c7e

cache for DicomPyramidInstance
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Nov 2016 21:56:07 +0100
parents a59fdb848a7b
children 319b8c45c231
comparison
equal deleted inserted replaced
68:c619c8bd72ed 69:d529d9ce3c7e
56 const std::string& uri, 56 const std::string& uri,
57 const std::string& body) 57 const std::string& body)
58 { 58 {
59 OrthancPlugins::MemoryBuffer buffer(context_); 59 OrthancPlugins::MemoryBuffer buffer(context_);
60 60
61 if (!buffer.RestApiPost(uri, body.c_str(), body.size(), false)) 61 if (buffer.RestApiPost(uri, body.c_str(), body.size(), false))
62 { 62 {
63 buffer.ToString(result); 63 buffer.ToString(result);
64 } 64 }
65 else 65 else
66 { 66 {
67 ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_UnknownResource); 67 ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_UnknownResource);
68 } 68 }
69 } 69 }
70
71
72 void OrthancPluginConnection::RestApiPut(std::string& result,
73 const std::string& uri,
74 const std::string& body)
75 {
76 OrthancPlugins::MemoryBuffer buffer(context_);
77
78 if (buffer.RestApiPut(uri, body.c_str(), body.size(), false))
79 {
80 buffer.ToString(result);
81 }
82 else
83 {
84 ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_UnknownResource);
85 }
86 }
87
88
89 void OrthancPluginConnection::RestApiDelete(const std::string& uri)
90 {
91 OrthancPlugins::MemoryBuffer buffer(context_);
92
93 if (!::OrthancPlugins::RestApiDelete(context_, uri, false))
94 {
95 ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_UnknownResource);
96 }
97 }
70 } 98 }