comparison Plugins/Samples/Common/OrthancPluginCppWrapper.cpp @ 3752:4edeef72de75 storage-commitment

integration mainline->storage-commitment
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 16 Mar 2020 12:08:14 +0100
parents e64432336055 edabdf07ee83
children 7e33516965f8
comparison
equal deleted inserted replaced
3746:875308321fa8 3752:4edeef72de75
31 **/ 31 **/
32 32
33 33
34 #include "OrthancPluginCppWrapper.h" 34 #include "OrthancPluginCppWrapper.h"
35 35
36 #include <boost/algorithm/string/predicate.hpp>
37 #include <boost/move/unique_ptr.hpp>
36 #include <boost/thread.hpp> 38 #include <boost/thread.hpp>
37 #include <boost/algorithm/string/predicate.hpp>
38 #include <json/reader.h> 39 #include <json/reader.h>
39 #include <json/writer.h> 40 #include <json/writer.h>
40 41
41 42
42 namespace OrthancPlugins 43 namespace OrthancPlugins
2166 { 2167 {
2167 static const char* KEY_SYNCHRONOUS = "Synchronous"; 2168 static const char* KEY_SYNCHRONOUS = "Synchronous";
2168 static const char* KEY_ASYNCHRONOUS = "Asynchronous"; 2169 static const char* KEY_ASYNCHRONOUS = "Asynchronous";
2169 static const char* KEY_PRIORITY = "Priority"; 2170 static const char* KEY_PRIORITY = "Priority";
2170 2171
2171 std::auto_ptr<OrthancJob> protection(job); 2172 boost::movelib::unique_ptr<OrthancJob> protection(job);
2172 2173
2173 if (body.type() != Json::objectValue) 2174 if (body.type() != Json::objectValue)
2174 { 2175 {
2175 #if HAS_ORTHANC_EXCEPTION == 1 2176 #if HAS_ORTHANC_EXCEPTION == 1
2176 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, 2177 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
3057 { 3058 {
3058 OrthancPluginSendMethodNotAllowed(GetGlobalContext(), output, allowed.c_str()); 3059 OrthancPluginSendMethodNotAllowed(GetGlobalContext(), output, allowed.c_str());
3059 } 3060 }
3060 else 3061 else
3061 { 3062 {
3062 std::auto_ptr<IChunkedRequestReader> reader(PostHandler(url, request)); 3063 boost::movelib::unique_ptr<IChunkedRequestReader> reader(PostHandler(url, request));
3063 if (reader.get() == NULL) 3064 if (reader.get() == NULL)
3064 { 3065 {
3065 ORTHANC_PLUGINS_THROW_EXCEPTION(Plugin); 3066 ORTHANC_PLUGINS_THROW_EXCEPTION(Plugin);
3066 } 3067 }
3067 else 3068 else
3090 { 3091 {
3091 OrthancPluginSendMethodNotAllowed(GetGlobalContext(), output, allowed.c_str()); 3092 OrthancPluginSendMethodNotAllowed(GetGlobalContext(), output, allowed.c_str());
3092 } 3093 }
3093 else 3094 else
3094 { 3095 {
3095 std::auto_ptr<IChunkedRequestReader> reader(PutHandler(url, request)); 3096 boost::movelib::unique_ptr<IChunkedRequestReader> reader(PutHandler(url, request));
3096 if (reader.get() == NULL) 3097 if (reader.get() == NULL)
3097 { 3098 {
3098 ORTHANC_PLUGINS_THROW_EXCEPTION(Plugin); 3099 ORTHANC_PLUGINS_THROW_EXCEPTION(Plugin);
3099 } 3100 }
3100 else 3101 else