diff Framework/Oracle/GetOrthancImageCommand.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 78b8bfe154bc
line wrap: on
line diff
--- a/Framework/Oracle/GetOrthancImageCommand.h	Wed Nov 06 15:16:45 2019 +0100
+++ b/Framework/Oracle/GetOrthancImageCommand.h	Wed Nov 06 17:34:58 2019 +0100
@@ -35,7 +35,7 @@
   public:
     typedef std::map<std::string, std::string>  HttpHeaders;
 
-    class SuccessMessage : public OracleMessageBase
+    class SuccessMessage : public OriginMessage<GetOrthancImageCommand>
     {
       ORTHANC_STONE_MESSAGE(__FILE__, __LINE__);
       
@@ -44,10 +44,10 @@
       Orthanc::MimeType              mime_;
 
     public:
-      SuccessMessage(GetOrthancImageCommand& command,
+      SuccessMessage(const GetOrthancImageCommand& command,
                      const Orthanc::ImageAccessor& image,
                      Orthanc::MimeType mime) :
-        OracleMessageBase(command),
+        OriginMessage(command),
         image_(image),
         mime_(mime)
       {
@@ -72,6 +72,15 @@
     bool                  hasExpectedFormat_;
     Orthanc::PixelFormat  expectedFormat_;
 
+    GetOrthancImageCommand(const GetOrthancImageCommand& other) :
+      uri_(other.uri_),
+      headers_(other.headers_),
+      timeout_(other.timeout_),
+      hasExpectedFormat_(other.hasExpectedFormat_),
+      expectedFormat_(other.expectedFormat_)
+    {
+    }
+
   public:
     GetOrthancImageCommand();
 
@@ -80,6 +89,11 @@
       return Type_GetOrthancImage;
     }
 
+    virtual IOracleCommand* Clone() const
+    {
+      return new GetOrthancImageCommand(*this);
+    }
+
     void SetExpectedPixelFormat(Orthanc::PixelFormat format);
 
     void SetUri(const std::string& uri)
@@ -119,6 +133,6 @@
     void ProcessHttpAnswer(boost::weak_ptr<IObserver> receiver,
                            IMessageEmitter& emitter,
                            const std::string& answer,
-                           const HttpHeaders& answerHeaders);
+                           const HttpHeaders& answerHeaders) const;
   };
 }