comparison Applications/StoneApplicationContext.h @ 418:c23df8b3433b

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 15 Nov 2018 18:32:48 +0100
parents aee3d7941c9b
children 26b90b110719 b70e9be013e4
comparison
equal deleted inserted replaced
417:aee3d7941c9b 418:c23df8b3433b
36 // the WebService is provided by the browser while, in a native environment, 36 // the WebService is provided by the browser while, in a native environment,
37 // the WebService is provided by the OracleWebService (a C++ Http client) 37 // the WebService is provided by the OracleWebService (a C++ Http client)
38 38
39 class StoneApplicationContext : public boost::noncopyable 39 class StoneApplicationContext : public boost::noncopyable
40 { 40 {
41 protected: 41 private:
42 // TODO ADD THE MessageBroker HERE 42 MessageBroker& broker_;
43
44 IWebService* webService_; 43 IWebService* webService_;
45 std::auto_ptr<OrthancApiClient> orthanc_; 44 std::auto_ptr<OrthancApiClient> orthanc_;
45 std::string orthancBaseUrl_;
46
47 void InitializeOrthanc();
46 48
47 public: 49 public:
48 StoneApplicationContext() : 50 StoneApplicationContext(MessageBroker& broker) :
51 broker_(broker),
49 webService_(NULL) 52 webService_(NULL)
50 { 53 {
51 } 54 }
52 55
53 virtual ~StoneApplicationContext() 56 virtual ~StoneApplicationContext()
54 { 57 {
55 } 58 }
56 59
60 MessageBroker& GetMessageBroker()
61 {
62 return broker_;
63 }
64
65 bool HasWebService() const
66 {
67 return webService_ != NULL;
68 }
69
57 IWebService& GetWebService(); 70 IWebService& GetWebService();
58 71
59 OrthancApiClient& GetOrthancApiClient(); 72 OrthancApiClient& GetOrthancApiClient();
60 73
61 void Initialize(MessageBroker& broker, 74 void SetWebService(IWebService& webService);
62 IWebService& webService, 75
63 const std::string& orthancBaseUrl); 76 void SetOrthancBaseUrl(const std::string& baseUrl);
64 }; 77 };
65 } 78 }