Mercurial > hg > orthanc-stone
changeset 641:392783c90607
renames
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 10 May 2019 10:59:37 +0200 |
parents | e706188d6078 |
children | 7ca8dc7ec17b |
files | Samples/Sdl/Loader.cpp |
diffstat | 1 files changed, 30 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- 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<OrthancStone::MessageType_ImageReady, // TODO - DecodeOrthancImageCommand> + GetOrthancImageCommand> { private: std::auto_ptr<Orthanc::ImageAccessor> 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<OracleCommandExceptionMessage> > 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<OrthancStone::MessageType_ImageReady, // TODO - DecodeOrthancWebViewerJpegCommand> + GetOrthancWebViewerJpegCommand> { private: std::auto_ptr<Orthanc::ImageAccessor> 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<OracleCommandExceptionMessage> > 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<Orthanc::IDynamicObject> object(queue_.Dequeue(100)); @@ -771,14 +770,14 @@ dynamic_cast<const OrthancRestApiCommand&>(item.GetCommand())); break; - case IOracleCommand::Type_DecodeOrthancImage: + case IOracleCommand::Type_GetOrthancImage: Execute(item.GetReceiver(), - dynamic_cast<const DecodeOrthancImageCommand&>(item.GetCommand())); + dynamic_cast<const GetOrthancImageCommand&>(item.GetCommand())); break; - case IOracleCommand::Type_DecodeOrthancWebViewerJpeg: + case IOracleCommand::Type_GetOrthancWebViewerJpeg: Execute(item.GetReceiver(), - dynamic_cast<const DecodeOrthancWebViewerJpegCommand&>(item.GetCommand())); + dynamic_cast<const GetOrthancWebViewerJpegCommand&>(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<const Refactoring::DecodeOrthancWebViewerJpegCommand&> + case Refactoring::IOracleCommand::Type_GetOrthancWebViewerJpeg: + printf("URI: [%s]\n", dynamic_cast<const Refactoring::GetOrthancWebViewerJpegCommand&> (message.GetCommand()).GetUri().c_str()); break; @@ -1490,7 +1489,7 @@ oracle.RegisterObserverCallback (new OrthancStone::Callable - <Toto, Refactoring::DecodeOrthancImageCommand::SuccessMessage>(*this, &Toto::Handle)); + <Toto, Refactoring::GetOrthancImageCommand::SuccessMessage>(*this, &Toto::Handle)); oracle.RegisterObserverCallback (new OrthancStone::Callable @@ -1538,7 +1537,7 @@ if (0) { - std::auto_ptr<Refactoring::DecodeOrthancImageCommand> command(new Refactoring::DecodeOrthancImageCommand); + std::auto_ptr<Refactoring::GetOrthancImageCommand> 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<Refactoring::DecodeOrthancImageCommand> command(new Refactoring::DecodeOrthancImageCommand); + std::auto_ptr<Refactoring::GetOrthancImageCommand> 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<Refactoring::DecodeOrthancImageCommand> command(new Refactoring::DecodeOrthancImageCommand); + std::auto_ptr<Refactoring::GetOrthancImageCommand> 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<Refactoring::DecodeOrthancImageCommand> command(new Refactoring::DecodeOrthancImageCommand); + std::auto_ptr<Refactoring::GetOrthancImageCommand> 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<Refactoring::DecodeOrthancImageCommand> command(new Refactoring::DecodeOrthancImageCommand); + std::auto_ptr<Refactoring::GetOrthancImageCommand> 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<Refactoring::DecodeOrthancWebViewerJpegCommand> command(new Refactoring::DecodeOrthancWebViewerJpegCommand); + std::auto_ptr<Refactoring::GetOrthancWebViewerJpegCommand> command(new Refactoring::GetOrthancWebViewerJpegCommand); command->SetHttpHeader("Accept-Encoding", "gzip"); command->SetInstance("e6c7c20b-c9f65d7e-0d76f2e2-830186f2-3e3c600e"); command->SetQuality(90);