async_resp.hpp (9062d478d4dc89598e215e1538ba8fbb8db2cf10) async_resp.hpp (ecd6a3a20ab128ae9d3e356d6250695800dc13be)
1#pragma once
2
3#include "http_response.hpp"
4
5#include <functional>
6
7namespace bmcweb
8{

--- 10 unchanged lines hidden (view full) ---

19 {}
20
21 AsyncResp(crow::Response& response, std::function<void()>&& function) :
22 res(response), func(std::move(function))
23 {}
24
25 AsyncResp(const AsyncResp&) = delete;
26 AsyncResp(AsyncResp&&) = delete;
1#pragma once
2
3#include "http_response.hpp"
4
5#include <functional>
6
7namespace bmcweb
8{

--- 10 unchanged lines hidden (view full) ---

19 {}
20
21 AsyncResp(crow::Response& response, std::function<void()>&& function) :
22 res(response), func(std::move(function))
23 {}
24
25 AsyncResp(const AsyncResp&) = delete;
26 AsyncResp(AsyncResp&&) = delete;
27 AsyncResp& operator=(const AsyncResp&) = delete;
28 AsyncResp& operator=(AsyncResp&&) = delete;
27
28 ~AsyncResp()
29 {
30 if (func && res.result() == boost::beast::http::status::ok)
31 {
32 func();
33 }
34
35 res.end();
36 }
37
38 crow::Response& res;
39 std::function<void()> func;
40};
41
42} // namespace bmcweb
29
30 ~AsyncResp()
31 {
32 if (func && res.result() == boost::beast::http::status::ok)
33 {
34 func();
35 }
36
37 res.end();
38 }
39
40 crow::Response& res;
41 std::function<void()> func;
42};
43
44} // namespace bmcweb