annotate Platforms/Wasm/WasmWebService.h @ 240:ddbb339ed4cf am

orthancBaseUrl is now configurable
author am@osimis.io
date Wed, 20 Jun 2018 09:43:36 +0200
parents b4642964c355
children 3d523c9a8f0d 8ff70c04c6df
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
221
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
1 #pragma once
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
2
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
3 #include <Framework/Toolbox/IWebService.h>
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
4
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
5 namespace OrthancStone
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
6 {
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
7 class WasmWebService : public IWebService
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
8 {
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
9 private:
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
10 std::string base_;
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
11
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
12 // Private constructor => Singleton design pattern
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
13 WasmWebService() :
240
ddbb339ed4cf orthancBaseUrl is now configurable
am@osimis.io
parents: 237
diff changeset
14 base_("../../") // note: this is configurable from the JS code by calling WasmWebService_SetBaseUrl
221
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
15 {
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
16 }
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
17
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
18 public:
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
19 static WasmWebService& GetInstance()
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
20 {
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
21 static WasmWebService instance;
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
22 return instance;
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
23 }
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
24
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
25 void SetBaseUrl(const std::string base);
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
26
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
27 virtual void ScheduleGetRequest(ICallback& callback,
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
28 const std::string& uri,
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
29 Orthanc::IDynamicObject* payload);
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
30
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
31 virtual void SchedulePostRequest(ICallback& callback,
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
32 const std::string& uri,
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
33 const std::string& body,
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
34 Orthanc::IDynamicObject* payload);
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
35
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
36 virtual void Start()
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
37 {
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
38 }
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
39
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
40 virtual void Stop()
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
41 {
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
42 }
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
43 };
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
44 }