diff Platforms/WebAssembly/WasmWebService.h @ 221:d7b2590744f8 am

wip: building applications reusable in SDL and WASM
author am@osimis.io
date Mon, 11 Jun 2018 14:01:02 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Platforms/WebAssembly/WasmWebService.h	Mon Jun 11 14:01:02 2018 +0200
@@ -0,0 +1,44 @@
+#pragma once
+
+#include <Framework/Toolbox/IWebService.h>
+
+namespace OrthancStone
+{
+  class WasmWebService : public IWebService
+  {
+  private:
+    std::string  base_;
+
+    // Private constructor => Singleton design pattern
+    WasmWebService() :
+      base_("../../")
+    {
+    }
+
+  public:
+    static WasmWebService& GetInstance()
+    {
+      static WasmWebService instance;
+      return instance;
+    }
+
+    void SetBaseUrl(const std::string base);
+
+    virtual void ScheduleGetRequest(ICallback& callback,
+                                    const std::string& uri,
+                                    Orthanc::IDynamicObject* payload);
+
+    virtual void SchedulePostRequest(ICallback& callback,
+                                     const std::string& uri,
+                                     const std::string& body,
+                                     Orthanc::IDynamicObject* payload);
+
+    virtual void Start()
+    {
+    }
+    
+    virtual void Stop()
+    {
+    }
+  };
+}