view 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 source

#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()
    {
    }
  };
}