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

IOracleCommand::Clone()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 06 Nov 2019 17:34:58 +0100
parents 8e3763d1736a
children 0ca50d275b9a
comparison
equal deleted inserted replaced
1134:87fbeb823375 1135:a0a33e5ea5bb
27 namespace OrthancStone 27 namespace OrthancStone
28 { 28 {
29 class ReadFileCommand : public OracleCommandBase 29 class ReadFileCommand : public OracleCommandBase
30 { 30 {
31 public: 31 public:
32 class SuccessMessage : public OracleMessageBase 32 class SuccessMessage : public OriginMessage<ReadFileCommand>
33 { 33 {
34 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); 34 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__);
35 35
36 private: 36 private:
37 std::string content_; 37 const std::string& content_;
38 38
39 public: 39 public:
40 SuccessMessage(ReadFileCommand& command, 40 SuccessMessage(const ReadFileCommand& command,
41 std::string& content /* will be swapped to avoid a memcpy() */) : 41 const std::string& content) :
42 OracleMessageBase(command) 42 OriginMessage(command),
43 content_(content)
43 { 44 {
44 content_.swap(content);
45 } 45 }
46 46
47 const std::string& GetContent() const 47 const std::string& GetContent() const
48 { 48 {
49 return content_; 49 return content_;
63 virtual Type GetType() const 63 virtual Type GetType() const
64 { 64 {
65 return Type_ReadFile; 65 return Type_ReadFile;
66 } 66 }
67 67
68 virtual IOracleCommand* Clone() const
69 {
70 return new ReadFileCommand(path_);
71 }
72
68 const std::string& GetPath() const 73 const std::string& GetPath() const
69 { 74 {
70 return path_; 75 return path_;
71 } 76 }
72 }; 77 };