# HG changeset patch # User Sebastien Jodogne # Date 1557502488 -7200 # Node ID f0008c55e5f7e4e3b8a1799b29149cb64fe26922 # Parent 7ca8dc7ec17b23c32c7a68e6c679c21c25cc4e16 getting rid of MessageType enumeration diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Layers/DicomSeriesVolumeSlicer.h --- a/Framework/Layers/DicomSeriesVolumeSlicer.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Layers/DicomSeriesVolumeSlicer.h Fri May 10 17:34:48 2019 +0200 @@ -38,8 +38,10 @@ { public: // TODO: Add "frame" and "instanceId" - class FrameReadyMessage : public OriginMessage + class FrameReadyMessage : public OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: const Orthanc::ImageAccessor& frame_; SliceImageQuality imageQuality_; diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Layers/IVolumeSlicer.h --- a/Framework/Layers/IVolumeSlicer.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Layers/IVolumeSlicer.h Fri May 10 17:34:48 2019 +0200 @@ -33,18 +33,20 @@ class IVolumeSlicer : public IObservable { public: - typedef OriginMessage GeometryReadyMessage; - typedef OriginMessage GeometryErrorMessage; - typedef OriginMessage ContentChangedMessage; + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, GeometryReadyMessage, IVolumeSlicer); + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, GeometryErrorMessage, IVolumeSlicer); + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, ContentChangedMessage, IVolumeSlicer); - class SliceContentChangedMessage : public OriginMessage + class SliceContentChangedMessage : public OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: const Slice& slice_; public: SliceContentChangedMessage(IVolumeSlicer& origin, - const Slice& slice) : + const Slice& slice) : OriginMessage(origin), slice_(slice) { @@ -57,8 +59,10 @@ }; - class LayerReadyMessage : public OriginMessage + class LayerReadyMessage : public OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + public: class IRendererFactory : public boost::noncopyable { @@ -96,8 +100,10 @@ }; - class LayerErrorMessage : public OriginMessage + class LayerErrorMessage : public OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: const CoordinateSystem3D& slice_; diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Messages/ICallable.h --- a/Framework/Messages/ICallable.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Messages/ICallable.h Fri May 10 17:34:48 2019 +0200 @@ -41,7 +41,8 @@ virtual void Apply(const IMessage& message) = 0; - virtual MessageType GetMessageType() const = 0; + virtual const MessageIdentifier& GetMessageIdentifier() = 0; + virtual IObserver* GetObserver() const = 0; }; @@ -58,8 +59,8 @@ private: typedef void (TObserver::* MemberFunction) (const TMessage&); - TObserver& observer_; - MemberFunction function_; + TObserver& observer_; + MemberFunction function_; public: Callable(TObserver& observer, @@ -79,9 +80,9 @@ ApplyInternal(dynamic_cast(message)); } - virtual MessageType GetMessageType() const + virtual const MessageIdentifier& GetMessageIdentifier() { - return static_cast(TMessage::Type); + return TMessage::GetStaticIdentifier(); } virtual IObserver* GetObserver() const @@ -115,11 +116,6 @@ lambda_(dynamic_cast(message)); } - virtual MessageType GetMessageType() const - { - return static_cast(TMessage::Type); - } - virtual IObserver* GetObserver() const { return &observer_; diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Messages/IMessage.h --- a/Framework/Messages/IMessage.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Messages/IMessage.h Fri May 10 17:34:48 2019 +0200 @@ -21,79 +21,79 @@ #pragma once -#include "../StoneEnumerations.h" +#include -#include +#include namespace OrthancStone { - // base message that are exchanged between IObservable and IObserver - class IMessage : public boost::noncopyable + class MessageIdentifier { private: - MessageType messageType_; - - protected: - IMessage(MessageType messageType) : - messageType_(messageType) + const char* file_; + int line_; + + public: + MessageIdentifier(const char* file, + int line) : + file_(file), + line_(line) + { + } + + MessageIdentifier() : + file_(NULL), + line_(0) { } + + bool operator< (const MessageIdentifier& other) const + { + if (file_ == NULL) + { + return false; + } + else if (line_ != other.line_) + { + return line_ < other.line_; + } + else + { + return strcmp(file_, other.file_) < 0; + } + } + }; + + /** + * Base messages that are exchanged between IObservable and + * IObserver. Messages are distinguished by the "__FILE__" and + * "__LINE__" macro, as in "Orthanc::SQLite::StatementId". + **/ + class IMessage : public boost::noncopyable + { public: virtual ~IMessage() { } - virtual MessageType GetType() const - { - return messageType_; - } + virtual const MessageIdentifier& GetIdentifier() const = 0; }; - // base class to derive from to implement your own messages - // it handles the message type for you - template - class BaseMessage : public IMessage - { - public: - enum - { - Type = type - }; - - BaseMessage() : - IMessage(static_cast(Type)) - { - } - }; - - - // simple message implementation when no payload is needed - // sample usage: - // typedef NoPayloadMessage GeometryReadyMessage; - template - class NoPayloadMessage : public BaseMessage - { - public: - NoPayloadMessage() : - BaseMessage() - { - } - }; - - // simple message implementation when no payload is needed but the origin is required - // sample usage: - // typedef OriginMessage SliceGeometryErrorMessage; - template - class OriginMessage : public BaseMessage + /** + * Simple message implementation when no payload is needed but the + * origin is required. Sample usage: + * typedef OriginMessage SliceGeometryErrorMessage; + **/ + template + class OriginMessage : public IMessage { private: - const TOrigin& origin_; + const TOrigin& origin_; public: OriginMessage(const TOrigin& origin) : - BaseMessage(), origin_(origin) { } @@ -104,3 +104,36 @@ } }; } + + +#define ORTHANC_STONE_MESSAGE(FILE, LINE) \ + public: \ + static const ::OrthancStone::MessageIdentifier& GetStaticIdentifier() \ + { \ + static const ::OrthancStone::MessageIdentifier id(FILE, LINE); \ + return id; \ + } \ + \ + virtual const ::OrthancStone::MessageIdentifier& GetIdentifier() const \ + { \ + return GetStaticIdentifier(); \ + } + + +#define ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(FILE, LINE, NAME, ORIGIN) \ + class NAME : public ::OrthancStone::OriginMessage \ + { \ + ORTHANC_STONE_MESSAGE(FILE, LINE); \ + \ + NAME(const ORIGIN& origin) : \ + OriginMessage(origin) \ + { \ + } \ + }; + + +#define ORTHANC_STONE_DEFINE_EMPTY_MESSAGE(FILE, LINE, NAME) \ + class NAME : public ::OrthancStone::IMessage \ + { \ + ORTHANC_STONE_MESSAGE(FILE, LINE); \ + }; diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Messages/IObservable.cpp --- a/Framework/Messages/IObservable.cpp Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Messages/IObservable.cpp Fri May 10 17:34:48 2019 +0200 @@ -59,9 +59,8 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); } - MessageType messageType = callable->GetMessageType(); - - callables_[messageType].insert(callable); + const MessageIdentifier& id = callable->GetMessageIdentifier(); + callables_[id].insert(callable); } void IObservable::Unregister(IObserver *observer) @@ -87,7 +86,7 @@ void IObservable::EmitMessageInternal(const IObserver* receiver, const IMessage& message) { - Callables::const_iterator found = callables_.find(message.GetType()); + Callables::const_iterator found = callables_.find(message.GetIdentifier()); if (found != callables_.end()) { diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Messages/IObservable.h --- a/Framework/Messages/IObservable.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Messages/IObservable.h Fri May 10 17:34:48 2019 +0200 @@ -35,8 +35,9 @@ class IObservable : public boost::noncopyable { private: - typedef std::map > Callables; - typedef std::set Forwarders; + typedef std::map > Callables; + + typedef std::set Forwarders; MessageBroker& broker_; Callables callables_; diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Radiography/RadiographyLayer.h --- a/Framework/Radiography/RadiographyLayer.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Radiography/RadiographyLayer.h Fri May 10 17:34:48 2019 +0200 @@ -55,18 +55,7 @@ friend class RadiographyScene; public: - class LayerEditedMessage : - public OriginMessage - { - private: - - public: - LayerEditedMessage(const RadiographyLayer& origin) : - OriginMessage(origin) - { - } - }; - + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, LayerEditedMessage, RadiographyLayer); class Geometry { diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Radiography/RadiographyScene.h --- a/Framework/Radiography/RadiographyScene.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Radiography/RadiographyScene.h Fri May 10 17:34:48 2019 +0200 @@ -37,9 +37,10 @@ public IObservable { public: - class GeometryChangedMessage : - public OriginMessage + class GeometryChangedMessage : public OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: RadiographyLayer& layer_; @@ -57,9 +58,10 @@ } }; - class ContentChangedMessage : - public OriginMessage + class ContentChangedMessage : public OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: RadiographyLayer& layer_; @@ -77,9 +79,10 @@ } }; - class LayerEditedMessage : - public OriginMessage + class LayerEditedMessage : public OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: const RadiographyLayer& layer_; @@ -95,20 +98,12 @@ { return layer_; } - }; - class WindowingChangedMessage : - public OriginMessage - { - public: - WindowingChangedMessage(const RadiographyScene& origin) : - OriginMessage(origin) - { - } - }; + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, WindowingChangedMessage, RadiographyScene); + class LayerAccessor : public boost::noncopyable { private: diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Scene2D/ColorSceneLayer.h --- a/Framework/Scene2D/ColorSceneLayer.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Scene2D/ColorSceneLayer.h Fri May 10 17:34:48 2019 +0200 @@ -35,17 +35,20 @@ uint8_t green_; uint8_t blue_; uint64_t revision_; + protected: void BumpRevision() { - // this is *not* thread-safe!!! + // this is *not* thread-safe!!! => (SJO) no problem, Stone assumes mono-threading revision_++; } + public: ColorSceneLayer() : red_(255), green_(255), - blue_(255) + blue_(255), + revision_(0) { } diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/StoneEnumerations.h --- a/Framework/StoneEnumerations.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/StoneEnumerations.h Fri May 10 17:34:48 2019 +0200 @@ -115,74 +115,6 @@ BitmapAnchor_TopRight }; - enum MessageType - { - MessageType_Widget_GeometryChanged, - MessageType_Widget_ContentChanged, - - MessageType_VolumeSlicer_GeometryReady, // instance tags have been loaded - MessageType_VolumeSlicer_GeometryError, - MessageType_VolumeSlicer_ContentChanged, - MessageType_VolumeSlicer_SliceChanged, - MessageType_VolumeSlicer_LayerReady, // layer is ready to be rendered - MessageType_VolumeSlicer_LayerError, - - MessageType_DicomSeriesVolumeSlicer_FrameReady, // pixels data of the frame have been loaded - - MessageType_SliceViewerWidget_DisplayedSlice, // The displayed slice has changed - - MessageType_SliceLoader_GeometryReady, - MessageType_SliceLoader_GeometryError, - MessageType_SliceLoader_ImageReady, - MessageType_SliceLoader_ImageError, - - MessageType_VolumeLoader_GeometryReady, - MessageType_VolumeLoader_GeometryError, - MessageType_VolumeLoader_ContentChanged, // Content of several slices in the loader has changed - - MessageType_SlicedVolume_GeometryReady, - MessageType_SlicedVolume_GeometryError, - MessageType_SlicedVolume_VolumeReady, - MessageType_SlicedVolume_ContentChanged, - MessageType_SlicedVolume_SliceContentChanged, - - MessageType_HttpRequestSuccess, - MessageType_HttpRequestError, - - MessageType_OrthancApi_InternalGetJsonResponseReady, - MessageType_OrthancApi_InternalGetJsonResponseError, - - MessageType_OrthancApi_GenericGetJson_Ready, - MessageType_OrthancApi_GenericGetBinary_Ready, - MessageType_OrthancApi_GenericHttpError_Ready, - MessageType_OrthancApi_GenericEmptyResponse_Ready, - - MessageType_RadiographyScene_GeometryChanged, - MessageType_RadiographyScene_ContentChanged, - MessageType_RadiographyScene_LayerEdited, - MessageType_RadiographyScene_WindowingChanged, - - MessageType_RadiographyLayer_Edited, - - MessageType_ViewportChanged, - - MessageType_Timeout, - - // used in unit tests only - MessageType_Test1, - MessageType_Test2, - - - - MessageType_OrthancRestApiCommand, - MessageType_GetOrthancImageCommand, - MessageType_GetOrthancWebViewerJpegCommand, - MessageType_OracleCommandExceptionMessage, - - MessageType_CustomMessage // Custom messages ids ust be greater than this (this one must remain in last position) - }; - - enum ControlPointType { ControlPoint_TopLeftCorner = 0, diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Toolbox/IDelayedCallExecutor.h --- a/Framework/Toolbox/IDelayedCallExecutor.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Toolbox/IDelayedCallExecutor.h Fri May 10 17:34:48 2019 +0200 @@ -39,8 +39,7 @@ MessageBroker& broker_; public: - - typedef NoPayloadMessage TimeoutMessage; + ORTHANC_STONE_DEFINE_EMPTY_MESSAGE(__FILE__, __LINE__, TimeoutMessage); IDelayedCallExecutor(MessageBroker& broker) : broker_(broker) diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Toolbox/IWebService.h --- a/Framework/Toolbox/IWebService.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Toolbox/IWebService.h Fri May 10 17:34:48 2019 +0200 @@ -45,8 +45,10 @@ public: typedef std::map HttpHeaders; - class HttpRequestSuccessMessage : public BaseMessage + class HttpRequestSuccessMessage : public IMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: const std::string& uri_; const void* answer_; @@ -97,8 +99,10 @@ }; - class HttpRequestErrorMessage : public BaseMessage + class HttpRequestErrorMessage : public IMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: const std::string& uri_; const Orthanc::IDynamicObject* payload_; diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Toolbox/OrthancApiClient.h --- a/Framework/Toolbox/OrthancApiClient.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Toolbox/OrthancApiClient.h Fri May 10 17:34:48 2019 +0200 @@ -35,9 +35,10 @@ public IObserver { public: - class JsonResponseReadyMessage : - public BaseMessage + class JsonResponseReadyMessage : public IMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: const std::string& uri_; const Json::Value& json_; @@ -72,9 +73,10 @@ }; - class BinaryResponseReadyMessage : - public BaseMessage + class BinaryResponseReadyMessage : public IMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: const std::string& uri_; const void* answer_; @@ -117,9 +119,10 @@ }; - class EmptyResponseReadyMessage : - public BaseMessage + class EmptyResponseReadyMessage : public IMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: const std::string& uri_; const Orthanc::IDynamicObject* payload_; diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Toolbox/OrthancSlicesLoader.h --- a/Framework/Toolbox/OrthancSlicesLoader.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Toolbox/OrthancSlicesLoader.h Fri May 10 17:34:48 2019 +0200 @@ -35,13 +35,14 @@ class OrthancSlicesLoader : public IObservable, public IObserver { public: - - typedef OriginMessage SliceGeometryReadyMessage; - typedef OriginMessage SliceGeometryErrorMessage; + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, SliceGeometryReadyMessage, OrthancSlicesLoader); + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, SliceGeometryErrorMessage, OrthancSlicesLoader); - class SliceImageReadyMessage : - public OriginMessage + + class SliceImageReadyMessage : public OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: unsigned int sliceIndex_; const Slice& slice_; @@ -84,9 +85,10 @@ }; - class SliceImageErrorMessage : - public OriginMessage + class SliceImageErrorMessage : public OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: const Slice& slice_; unsigned int sliceIndex_; diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Viewport/IViewport.h --- a/Framework/Viewport/IViewport.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Viewport/IViewport.h Fri May 10 17:34:48 2019 +0200 @@ -35,7 +35,7 @@ class IViewport : public IObservable { public: - typedef OriginMessage ViewportChangedMessage; + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, ViewportChangedMessage, IViewport); IViewport(MessageBroker& broker) : IObservable(broker) diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Volumes/ISlicedVolume.h --- a/Framework/Volumes/ISlicedVolume.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Volumes/ISlicedVolume.h Fri May 10 17:34:48 2019 +0200 @@ -29,14 +29,16 @@ class ISlicedVolume : public IObservable { public: - typedef OriginMessage ContentChangedMessage; - typedef OriginMessage GeometryErrorMessage; - typedef OriginMessage GeometryReadyMessage; - typedef OriginMessage VolumeReadyMessage; + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, ContentChangedMessage, ISlicedVolume); + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, GeometryErrorMessage, ISlicedVolume); + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, GeometryReadyMessage, ISlicedVolume); + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, VolumeReadyMessage, ISlicedVolume); - class SliceContentChangedMessage : - public OriginMessage + + class SliceContentChangedMessage : public OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: size_t sliceIndex_; const Slice& slice_; diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Volumes/IVolumeLoader.h --- a/Framework/Volumes/IVolumeLoader.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Volumes/IVolumeLoader.h Fri May 10 17:34:48 2019 +0200 @@ -28,9 +28,9 @@ class IVolumeLoader : public IObservable { public: - typedef OriginMessage GeometryReadyMessage; - typedef OriginMessage GeometryErrorMessage; - typedef OriginMessage ContentChangedMessage; + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, GeometryReadyMessage, IVolumeLoader); + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, GeometryErrorMessage, IVolumeLoader); + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, ContentChangedMessage, IVolumeLoader); IVolumeLoader(MessageBroker& broker) : IObservable(broker) diff -r 7ca8dc7ec17b -r f0008c55e5f7 Framework/Widgets/SliceViewerWidget.h --- a/Framework/Widgets/SliceViewerWidget.h Fri May 10 14:54:03 2019 +0200 +++ b/Framework/Widgets/SliceViewerWidget.h Fri May 10 17:34:48 2019 +0200 @@ -36,12 +36,15 @@ public IObservable { public: - typedef OriginMessage GeometryChangedMessage; - typedef OriginMessage ContentChangedMessage; + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, GeometryChangedMessage, SliceViewerWidget); + ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, ContentChangedMessage, SliceViewerWidget); + // TODO - Use this message in ReferenceLineSource - class DisplayedSliceMessage : public OriginMessage + class DisplayedSliceMessage : public OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: const Slice& slice_; diff -r 7ca8dc7ec17b -r f0008c55e5f7 Samples/Sdl/Loader.cpp --- a/Samples/Sdl/Loader.cpp Fri May 10 14:54:03 2019 +0200 +++ b/Samples/Sdl/Loader.cpp Fri May 10 17:34:48 2019 +0200 @@ -139,9 +139,10 @@ - class OracleCommandExceptionMessage : - public OrthancStone::BaseMessage + class OracleCommandExceptionMessage : public OrthancStone::IMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: const IOracleCommand& command_; Orthanc::OrthancException exception_; @@ -178,9 +179,10 @@ class OrthancRestApiCommand : public OracleCommandWithPayload { public: - class SuccessMessage : public OrthancStone::OriginMessage + class SuccessMessage : public OrthancStone::OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: HttpHeaders headers_; std::string answer_; @@ -316,9 +318,10 @@ class GetOrthancImageCommand : public OracleCommandWithPayload { public: - class SuccessMessage : public OrthancStone::OriginMessage + class SuccessMessage : public OrthancStone::OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: std::auto_ptr image_; Orthanc::MimeType mime_; @@ -461,9 +464,10 @@ class GetOrthancWebViewerJpegCommand : public OracleCommandWithPayload { public: - class SuccessMessage : public OrthancStone::OriginMessage + class SuccessMessage : public OrthancStone::OriginMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + private: std::auto_ptr image_; diff -r 7ca8dc7ec17b -r f0008c55e5f7 UnitTestsSources/TestMessageBroker.cpp --- a/UnitTestsSources/TestMessageBroker.cpp Fri May 10 14:54:03 2019 +0200 +++ b/UnitTestsSources/TestMessageBroker.cpp Fri May 10 17:34:48 2019 +0200 @@ -34,32 +34,25 @@ using namespace OrthancStone; - enum CustomMessageType - { - CustomMessageType_First = MessageType_CustomMessage + 1, - - CustomMessageType_Completed, - CustomMessageType_Increment - }; - - class MyObservable : public IObservable { public: - struct MyCustomMessage: public BaseMessage<(MessageType) CustomMessageType_Completed> + struct MyCustomMessage : public IMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + int payload_; - MyCustomMessage(int payload) - : BaseMessage(), - payload_(payload) - {} + MyCustomMessage(int payload) : + payload_(payload) + { + } }; - MyObservable(MessageBroker& broker) - : IObservable(broker) - {} - + MyObservable(MessageBroker& broker) : + IObservable(broker) + { + } }; class MyObserver : public IObserver @@ -94,15 +87,18 @@ class MyPromiseSource : public IObservable { Promise* currentPromise_; + public: - struct MyPromiseMessage: public BaseMessage + struct MyPromiseMessage: public IMessage { + ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); + int increment; - MyPromiseMessage(int increment) - : BaseMessage(), - increment(increment) - {} + MyPromiseMessage(int increment) : + increment(increment) + { + } }; MyPromiseSource(MessageBroker& broker)