Mercurial > hg > orthanc-stone
comparison Applications/StoneApplicationContext.h @ 431:26b90b110719 am-vsol-upgrade
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
author | am@osimis.io |
---|---|
date | Thu, 29 Nov 2018 19:25:15 +0100 |
parents | c23df8b3433b |
children | a750f11892ec |
comparison
equal
deleted
inserted
replaced
430:b85f635f1eb5 | 431:26b90b110719 |
---|---|
20 | 20 |
21 | 21 |
22 #pragma once | 22 #pragma once |
23 | 23 |
24 #include "../Framework/Toolbox/IWebService.h" | 24 #include "../Framework/Toolbox/IWebService.h" |
25 #include "../Framework/Toolbox/IDelayedCallExecutor.h" | |
25 #include "../Framework/Toolbox/OrthancApiClient.h" | 26 #include "../Framework/Toolbox/OrthancApiClient.h" |
26 #include "../Framework/Viewport/WidgetViewport.h" | 27 #include "../Framework/Viewport/WidgetViewport.h" |
27 | 28 |
28 #include <list> | 29 #include <list> |
29 | 30 |
39 class StoneApplicationContext : public boost::noncopyable | 40 class StoneApplicationContext : public boost::noncopyable |
40 { | 41 { |
41 private: | 42 private: |
42 MessageBroker& broker_; | 43 MessageBroker& broker_; |
43 IWebService* webService_; | 44 IWebService* webService_; |
45 IDelayedCallExecutor* delayedCallExecutor_; | |
44 std::auto_ptr<OrthancApiClient> orthanc_; | 46 std::auto_ptr<OrthancApiClient> orthanc_; |
45 std::string orthancBaseUrl_; | 47 std::string orthancBaseUrl_; |
46 | 48 |
47 void InitializeOrthanc(); | 49 void InitializeOrthanc(); |
48 | 50 |
49 public: | 51 public: |
50 StoneApplicationContext(MessageBroker& broker) : | 52 StoneApplicationContext(MessageBroker& broker) : |
51 broker_(broker), | 53 broker_(broker), |
52 webService_(NULL) | 54 webService_(NULL), |
55 delayedCallExecutor_(NULL) | |
53 { | 56 { |
54 } | 57 } |
55 | 58 |
56 virtual ~StoneApplicationContext() | 59 virtual ~StoneApplicationContext() |
57 { | 60 { |
72 OrthancApiClient& GetOrthancApiClient(); | 75 OrthancApiClient& GetOrthancApiClient(); |
73 | 76 |
74 void SetWebService(IWebService& webService); | 77 void SetWebService(IWebService& webService); |
75 | 78 |
76 void SetOrthancBaseUrl(const std::string& baseUrl); | 79 void SetOrthancBaseUrl(const std::string& baseUrl); |
80 | |
81 void SetDelayedCallExecutor(IDelayedCallExecutor& delayedCallExecutor) | |
82 { | |
83 delayedCallExecutor_ = &delayedCallExecutor; | |
84 } | |
85 | |
86 IDelayedCallExecutor& GetDelayedCallExecutor() | |
87 { | |
88 return *delayedCallExecutor_; | |
89 } | |
77 }; | 90 }; |
78 } | 91 } |