Mercurial > hg > orthanc-stone
comparison Framework/SmartLoader.cpp @ 299:3897f9f28cfa am-callable-and-promise
backup work in progress: updated messaging framework with ICallable
author | am@osimis.io |
---|---|
date | Fri, 14 Sep 2018 16:44:01 +0200 |
parents | b04b13810540 |
children | b4abaeb783b1 |
comparison
equal
deleted
inserted
replaced
298:f58bfb7bbcc9 | 299:3897f9f28cfa |
---|---|
29 IObserver(broker), | 29 IObserver(broker), |
30 imageQuality_(SliceImageQuality_FullPam), | 30 imageQuality_(SliceImageQuality_FullPam), |
31 webService_(webService), | 31 webService_(webService), |
32 orthancApiClient_(broker, webService) | 32 orthancApiClient_(broker, webService) |
33 { | 33 { |
34 DeclareHandledMessage(MessageType_LayerSource_GeometryReady); | 34 // DeclareHandledMessage(MessageType_LayerSource_GeometryReady); |
35 DeclareHandledMessage(MessageType_LayerSource_LayerReady); | 35 // DeclareHandledMessage(MessageType_LayerSource_LayerReady); |
36 DeclareIgnoredMessage(MessageType_LayerSource_GeometryError); | 36 // DeclareIgnoredMessage(MessageType_LayerSource_GeometryError); |
37 DeclareIgnoredMessage(MessageType_LayerSource_ContentChanged); | 37 // DeclareIgnoredMessage(MessageType_LayerSource_ContentChanged); |
38 DeclareIgnoredMessage(MessageType_LayerSource_SliceChanged); | 38 // DeclareIgnoredMessage(MessageType_LayerSource_SliceChanged); |
39 | 39 |
40 // DeclareHandledMessage(MessageType_OrthancApi_InternalGetJsonResponseReady); | 40 // DeclareHandledMessage(MessageType_OrthancApi_InternalGetJsonResponseReady); |
41 // DeclareIgnoredMessage(MessageType_OrthancApi_InternalGetJsonResponseError); | 41 // DeclareIgnoredMessage(MessageType_OrthancApi_InternalGetJsonResponseError); |
42 } | 42 } |
43 | 43 |
63 default: | 63 default: |
64 VLOG("unhandled message type" << message.GetType()); | 64 VLOG("unhandled message type" << message.GetType()); |
65 } | 65 } |
66 | 66 |
67 // forward messages to its own observers | 67 // forward messages to its own observers |
68 IObservable::broker_.EmitMessage(from, IObservable::observers_, message); | 68 // TODO TODO TODO IObservable::broker_.EmitMessage(from, IObservable::observers_, message); |
69 } | 69 } |
70 | 70 |
71 ILayerSource* SmartLoader::GetFrame(const std::string& instanceId, unsigned int frame) | 71 ILayerSource* SmartLoader::GetFrame(const std::string& instanceId, unsigned int frame) |
72 { | 72 { |
73 // TODO: check if this frame has already been loaded or is already being loaded. | 73 // TODO: check if this frame has already been loaded or is already being loaded. |
76 // - if currently loading, we need to return an object that will observe the existing LayerSource and forward | 76 // - if currently loading, we need to return an object that will observe the existing LayerSource and forward |
77 // the messages to its observables | 77 // the messages to its observables |
78 // in both cases, we must be carefull about objects lifecycle !!! | 78 // in both cases, we must be carefull about objects lifecycle !!! |
79 std::auto_ptr<OrthancFrameLayerSource> layerSource (new OrthancFrameLayerSource(IObserver::broker_, webService_)); | 79 std::auto_ptr<OrthancFrameLayerSource> layerSource (new OrthancFrameLayerSource(IObserver::broker_, webService_)); |
80 layerSource->SetImageQuality(imageQuality_); | 80 layerSource->SetImageQuality(imageQuality_); |
81 layerSource->RegisterObserver(*this); | 81 //layerSource->RegisterObserverCallback(new Callable<SmartLoader, ILayerSource::GeometryReadyMessage>(*this, &SmartLoader::....)); |
82 layerSource->LoadFrame(instanceId, frame); | 82 layerSource->LoadFrame(instanceId, frame); |
83 | 83 |
84 return layerSource.release(); | 84 return layerSource.release(); |
85 } | 85 } |
86 | 86 |