# HG changeset patch # User Sebastien Jodogne # Date 1557478777 -7200 # Node ID 392783c906071e8976ddb1a7307428757e234ba9 # Parent e706188d6078e65b14fad38709e14bb207d54481 renames diff -r e706188d6078 -r 392783c90607 Samples/Sdl/Loader.cpp --- a/Samples/Sdl/Loader.cpp Fri May 10 10:57:21 2019 +0200 +++ b/Samples/Sdl/Loader.cpp Fri May 10 10:59:37 2019 +0200 @@ -62,8 +62,8 @@ enum Type { Type_OrthancRestApi, - Type_DecodeOrthancImage, - Type_DecodeOrthancWebViewerJpeg + Type_GetOrthancImage, + Type_GetOrthancWebViewerJpeg }; virtual ~IOracleCommand() @@ -312,18 +312,18 @@ - class DecodeOrthancImageCommand : public OracleCommandWithPayload + class GetOrthancImageCommand : public OracleCommandWithPayload { public: class SuccessMessage : public OrthancStone::OriginMessage + GetOrthancImageCommand> { private: std::auto_ptr image_; Orthanc::MimeType mime_; public: - SuccessMessage(const DecodeOrthancImageCommand& command, + SuccessMessage(const GetOrthancImageCommand& command, Orthanc::ImageAccessor* image, // Takes ownership Orthanc::MimeType mime) : OriginMessage(command), @@ -357,7 +357,7 @@ std::auto_ptr< OrthancStone::MessageHandler > failureCallback_; public: - DecodeOrthancImageCommand() : + GetOrthancImageCommand() : uri_("/"), timeout_(10) { @@ -365,7 +365,7 @@ virtual Type GetType() const { - return Type_DecodeOrthancImage; + return Type_GetOrthancImage; } void SetUri(const std::string& uri) @@ -450,24 +450,24 @@ std::string(Orthanc::EnumerationToString(contentType))); } - DecodeOrthancImageCommand::SuccessMessage message(*this, image.release(), contentType); + GetOrthancImageCommand::SuccessMessage message(*this, image.release(), contentType); emitter.EmitMessage(receiver, message); } }; - class DecodeOrthancWebViewerJpegCommand : public OracleCommandWithPayload + class GetOrthancWebViewerJpegCommand : public OracleCommandWithPayload { public: class SuccessMessage : public OrthancStone::OriginMessage + GetOrthancWebViewerJpegCommand> { private: std::auto_ptr image_; public: - SuccessMessage(const DecodeOrthancWebViewerJpegCommand& command, + SuccessMessage(const GetOrthancWebViewerJpegCommand& command, Orthanc::ImageAccessor* image) : // Takes ownership OriginMessage(command), image_(image) @@ -495,7 +495,7 @@ std::auto_ptr< OrthancStone::MessageHandler > failureCallback_; public: - DecodeOrthancWebViewerJpegCommand() : + GetOrthancWebViewerJpegCommand() : frame_(0), quality_(95), timeout_(10) @@ -504,7 +504,7 @@ virtual Type GetType() const { - return Type_DecodeOrthancWebViewerJpeg; + return Type_GetOrthancWebViewerJpeg; } void SetInstance(const std::string& instanceId) @@ -583,7 +583,7 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } - //DecodeOrthancWebViewerJpegCommand::SuccessMessage message(command, image.release(), contentType); + //GetOrthancWebViewerJpegCommand::SuccessMessage message(command, image.release(), contentType); //emitter.EmitMessage(receiver, message); } }; @@ -718,7 +718,7 @@ void Execute(const OrthancStone::IObserver& receiver, - const DecodeOrthancImageCommand& command) + const GetOrthancImageCommand& command) { Orthanc::HttpClient client(orthanc_, command.GetUri()); client.SetTimeout(command.GetTimeout()); @@ -736,7 +736,7 @@ void Execute(const OrthancStone::IObserver& receiver, - const DecodeOrthancWebViewerJpegCommand& command) + const GetOrthancWebViewerJpegCommand& command) { Orthanc::HttpClient client(orthanc_, command.GetUri()); client.SetTimeout(command.GetTimeout()); @@ -753,7 +753,6 @@ } - void Step() { std::auto_ptr object(queue_.Dequeue(100)); @@ -771,14 +770,14 @@ dynamic_cast(item.GetCommand())); break; - case IOracleCommand::Type_DecodeOrthancImage: + case IOracleCommand::Type_GetOrthancImage: Execute(item.GetReceiver(), - dynamic_cast(item.GetCommand())); + dynamic_cast(item.GetCommand())); break; - case IOracleCommand::Type_DecodeOrthancWebViewerJpeg: + case IOracleCommand::Type_GetOrthancWebViewerJpeg: Execute(item.GetReceiver(), - dynamic_cast(item.GetCommand())); + dynamic_cast(item.GetCommand())); break; default: @@ -1459,7 +1458,7 @@ printf("ICI [%s]\n", v.toStyledString().c_str()); } - void Handle(const Refactoring::DecodeOrthancImageCommand::SuccessMessage& message) + void Handle(const Refactoring::GetOrthancImageCommand::SuccessMessage& message) { printf("IMAGE %dx%d\n", message.GetImage().GetWidth(), message.GetImage().GetHeight()); } @@ -1470,8 +1469,8 @@ switch (message.GetCommand().GetType()) { - case Refactoring::IOracleCommand::Type_DecodeOrthancWebViewerJpeg: - printf("URI: [%s]\n", dynamic_cast + case Refactoring::IOracleCommand::Type_GetOrthancWebViewerJpeg: + printf("URI: [%s]\n", dynamic_cast (message.GetCommand()).GetUri().c_str()); break; @@ -1490,7 +1489,7 @@ oracle.RegisterObserverCallback (new OrthancStone::Callable - (*this, &Toto::Handle)); + (*this, &Toto::Handle)); oracle.RegisterObserverCallback (new OrthancStone::Callable @@ -1538,7 +1537,7 @@ if (0) { - std::auto_ptr command(new Refactoring::DecodeOrthancImageCommand); + std::auto_ptr command(new Refactoring::GetOrthancImageCommand); command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Jpeg))); command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/preview"); oracle.Schedule(*toto, command.release()); @@ -1546,7 +1545,7 @@ if (0) { - std::auto_ptr command(new Refactoring::DecodeOrthancImageCommand); + std::auto_ptr command(new Refactoring::GetOrthancImageCommand); command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Png))); command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/preview"); oracle.Schedule(*toto, command.release()); @@ -1554,7 +1553,7 @@ if (1) { - std::auto_ptr command(new Refactoring::DecodeOrthancImageCommand); + std::auto_ptr command(new Refactoring::GetOrthancImageCommand); command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Png))); command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/image-uint16"); oracle.Schedule(*toto, command.release()); @@ -1562,7 +1561,7 @@ if (1) { - std::auto_ptr command(new Refactoring::DecodeOrthancImageCommand); + std::auto_ptr command(new Refactoring::GetOrthancImageCommand); command->SetHttpHeader("Accept-Encoding", "gzip"); command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Pam))); command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/image-uint16"); @@ -1571,7 +1570,7 @@ if (1) { - std::auto_ptr command(new Refactoring::DecodeOrthancImageCommand); + std::auto_ptr command(new Refactoring::GetOrthancImageCommand); command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Pam))); command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/image-uint16"); oracle.Schedule(*toto, command.release()); @@ -1579,7 +1578,7 @@ if (1) { - std::auto_ptr command(new Refactoring::DecodeOrthancWebViewerJpegCommand); + std::auto_ptr command(new Refactoring::GetOrthancWebViewerJpegCommand); command->SetHttpHeader("Accept-Encoding", "gzip"); command->SetInstance("e6c7c20b-c9f65d7e-0d76f2e2-830186f2-3e3c600e"); command->SetQuality(90);