comparison Framework/Oracle/HttpCommand.h @ 1134:87fbeb823375 broker

allocating messages from oracle commands on the stack
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 06 Nov 2019 15:16:45 +0100
parents 8e3763d1736a
children a0a33e5ea5bb
comparison
equal deleted inserted replaced
1133:0e3a3be313fd 1134:87fbeb823375
34 class HttpCommand : public OracleCommandBase 34 class HttpCommand : 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 OriginMessage<HttpCommand> 39 class SuccessMessage : public OracleMessageBase
40 { 40 {
41 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); 41 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__);
42 42
43 private: 43 private:
44 HttpHeaders headers_; 44 const HttpHeaders& headers_;
45 std::string answer_; 45 const std::string& answer_;
46 46
47 public: 47 public:
48 SuccessMessage(const HttpCommand& command, 48 SuccessMessage(HttpCommand& command,
49 const HttpHeaders& answerHeaders, 49 const HttpHeaders& answerHeaders,
50 std::string& answer /* will be swapped to avoid a memcpy() */); 50 const std::string& answer);
51 51
52 const std::string& GetAnswer() const 52 const std::string& GetAnswer() const
53 { 53 {
54 return answer_; 54 return answer_;
55 } 55 }
56 56
57 void ParseJsonBody(Json::Value& target) const; 57 void ParseJsonBody(Json::Value& target) const;
58 58
59 const HttpHeaders& GetAnswerHeaders() const 59 const HttpHeaders& GetAnswerHeaders() const
60 { 60 {
61 return headers_; 61 return headers_;
62 } 62 }
63 }; 63 };
64 64