comparison Framework/Oracle/OrthancRestApiCommand.h @ 1135:a0a33e5ea5bb broker

IOracleCommand::Clone()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 06 Nov 2019 17:34:58 +0100
parents 87fbeb823375
children 0ca50d275b9a
comparison
equal deleted inserted replaced
1134:87fbeb823375 1135:a0a33e5ea5bb
34 class OrthancRestApiCommand : public OracleCommandBase 34 class OrthancRestApiCommand : public OracleCommandBase
35 { 35 {
36 public: 36 public:
37 typedef std::map<std::string, std::string> HttpHeaders; 37 typedef std::map<std::string, std::string> HttpHeaders;
38 38
39 class SuccessMessage : public OracleMessageBase 39 class SuccessMessage : public OriginMessage<OrthancRestApiCommand>
40 { 40 {
41 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); 41 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__);
42 42
43 private: 43 private:
44 const HttpHeaders& headers_; 44 const HttpHeaders& headers_;
45 const std::string& answer_; 45 const std::string& answer_;
46 46
47 public: 47 public:
48 SuccessMessage(OrthancRestApiCommand& command, 48 SuccessMessage(const OrthancRestApiCommand& command,
49 const HttpHeaders& answerHeaders, 49 const HttpHeaders& answerHeaders,
50 const std::string& answer) : 50 const std::string& answer) :
51 OracleMessageBase(command), 51 OriginMessage(command),
52 headers_(answerHeaders), 52 headers_(answerHeaders),
53 answer_(answer) 53 answer_(answer)
54 { 54 {
55 } 55 }
56 56
74 std::string body_; 74 std::string body_;
75 HttpHeaders headers_; 75 HttpHeaders headers_;
76 unsigned int timeout_; 76 unsigned int timeout_;
77 bool applyPlugins_; // Only makes sense for Stone as an Orthanc plugin 77 bool applyPlugins_; // Only makes sense for Stone as an Orthanc plugin
78 78
79 OrthancRestApiCommand(const OrthancRestApiCommand& other) :
80 method_(other.method_),
81 uri_(other.uri_),
82 body_(other.body_),
83 headers_(other.headers_),
84 timeout_(other.timeout_),
85 applyPlugins_(other.applyPlugins_)
86 {
87 }
88
79 public: 89 public:
80 OrthancRestApiCommand(); 90 OrthancRestApiCommand();
81 91
82 virtual Type GetType() const 92 virtual Type GetType() const
83 { 93 {
84 return Type_OrthancRestApi; 94 return Type_OrthancRestApi;
95 }
96
97 virtual IOracleCommand* Clone() const
98 {
99 return new OrthancRestApiCommand(*this);
85 } 100 }
86 101
87 void SetMethod(Orthanc::HttpMethod method) 102 void SetMethod(Orthanc::HttpMethod method)
88 { 103 {
89 method_ = method; 104 method_ = method;