comparison OrthancFramework/Sources/RestApi/RestApiGetCall.cpp @ 4834:bec432ee1094

download of numpy arrays from the REST API
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 Nov 2021 19:03:32 +0100
parents 7053502fbf97
children 43e613a7756b
comparison
equal deleted inserted replaced
4833:970092a67897 4834:bec432ee1094
22 22
23 23
24 #include "../PrecompiledHeaders.h" 24 #include "../PrecompiledHeaders.h"
25 #include "RestApiGetCall.h" 25 #include "RestApiGetCall.h"
26 26
27 #include "../OrthancException.h"
28 #include "../SerializationToolbox.h"
29
27 namespace Orthanc 30 namespace Orthanc
28 { 31 {
29 bool RestApiGetCall::ParseJsonRequest(Json::Value& result) const 32 bool RestApiGetCall::ParseJsonRequest(Json::Value& result) const
30 { 33 {
31 result.clear(); 34 result.clear();
36 result[it->first] = it->second; 39 result[it->first] = it->second;
37 } 40 }
38 41
39 return true; 42 return true;
40 } 43 }
44
45
46 bool RestApiGetCall::GetBooleanArgument(const std::string& name,
47 bool defaultValue) const
48 {
49 HttpToolbox::Arguments::const_iterator found = getArguments_.find(name);
50
51 bool value;
52
53 if (found == getArguments_.end())
54 {
55 return defaultValue;
56 }
57 else if (found->second.empty())
58 {
59 return true;
60 }
61 else if (SerializationToolbox::ParseBoolean(value, found->second))
62 {
63 return value;
64 }
65 else
66 {
67 throw OrthancException(ErrorCode_ParameterOutOfRange, "Expected a Boolean for GET argument \"" +
68 name + "\", found: " + found->second);
69 }
70 }
41 } 71 }