libkazv
cprjobhandler.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of libkazv.
3  * SPDX-FileCopyrightText: 2020 Tusooa Zhu
4  * SPDX-License-Identifier: AGPL-3.0-or-later
5  */
6 
7 
8 #pragma once
9 #include <libkazv-config.hpp>
10 
11 #include <memory>
12 
13 #include <boost/asio.hpp>
14 
15 #include "jobinterface.hpp"
16 
17 namespace Kazv
18 {
19  struct CprJobHandler : public JobInterface
20  {
21  CprJobHandler(boost::asio::io_context::executor_type executor);
22  ~CprJobHandler() override;
23  void async(std::function<void()> func) override;
24  void setTimeout(std::function<void()> func, int ms,
25  std::optional<std::string> timerId = std::nullopt) override;
26  void setInterval(std::function<void()> func, int ms,
27  std::optional<std::string> timerId = std::nullopt) override;
28  void cancel(std::string timerId) override;
29 
30  void submit(BaseJob job,
31  std::function<void(Response)> callback) override;
32 
33  void stop();
34  private:
35  struct Private;
36  std::unique_ptr<Private> m_d;
37  };
38 }
Definition: basejob.hpp:77
Definition: location.hpp:10
Definition: cprjobhandler.cpp:103
Definition: cprjobhandler.hpp:20
~CprJobHandler() override
void setTimeout(std::function< void()> func, int ms, std::optional< std::string > timerId=std::nullopt) override
Definition: cprjobhandler.cpp:301
void cancel(std::string timerId) override
cancels all pending timers with timerId
Definition: cprjobhandler.cpp:330
void stop()
Definition: cprjobhandler.cpp:500
CprJobHandler(boost::asio::io_context::executor_type executor)
Definition: cprjobhandler.cpp:281
void async(std::function< void()> func) override
Definition: cprjobhandler.cpp:294
void submit(BaseJob job, std::function< void(Response)> callback) override
makes an async fetch.
Definition: cprjobhandler.cpp:335
void setInterval(std::function< void()> func, int ms, std::optional< std::string > timerId=std::nullopt) override
Definition: cprjobhandler.cpp:317
Definition: jobinterface.hpp:21
Definition: basejob.hpp:50