blob: d7f581914266e946b51c49f56cf77b285c0a7c9f [file] [log] [blame]
Ed Tanouse3cb5a32018-08-08 14:16:49 -07001#pragma once
2
zhanghch058d1b46d2021-04-01 11:18:24 +08003#include "http_response.hpp"
4
Iwona Klimaszewskac0a1c8a2019-07-12 18:26:38 +02005#include <functional>
6
Ed Tanouse3cb5a32018-08-08 14:16:49 -07007namespace bmcweb
8{
9
10/**
11 * AsyncResp
12 * Gathers data needed for response processing after async calls are done
13 */
Iwona Klimaszewskac0a1c8a2019-07-12 18:26:38 +020014
Ed Tanouse3cb5a32018-08-08 14:16:49 -070015class AsyncResp
16{
17 public:
Nan Zhou72374eb2022-01-27 17:06:51 -080018 AsyncResp() = default;
Ed Tanous13548d82022-07-22 09:50:44 -070019 explicit AsyncResp(crow::Response&& resIn) : res(std::move(resIn))
20 {}
Iwona Klimaszewskac0a1c8a2019-07-12 18:26:38 +020021
Krzysztof Grobelnydab06042021-04-02 13:28:14 +000022 AsyncResp(const AsyncResp&) = delete;
23 AsyncResp(AsyncResp&&) = delete;
Ed Tanousecd6a3a2022-01-07 09:18:40 -080024 AsyncResp& operator=(const AsyncResp&) = delete;
25 AsyncResp& operator=(AsyncResp&&) = delete;
Krzysztof Grobelnydab06042021-04-02 13:28:14 +000026
Ed Tanouse3cb5a32018-08-08 14:16:49 -070027 ~AsyncResp()
28 {
29 res.end();
30 }
31
Nan Zhou72374eb2022-01-27 17:06:51 -080032 crow::Response res;
Ed Tanouse3cb5a32018-08-08 14:16:49 -070033};
34
Iwona Klimaszewskac0a1c8a2019-07-12 18:26:38 +020035} // namespace bmcweb