blob: eafaaca3ef908da3247be555d67ed45370605796 [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;
Patrick Williams89492a12023-05-10 07:51:34 -050019 explicit AsyncResp(crow::Response&& resIn) : res(std::move(resIn)) {}
Iwona Klimaszewskac0a1c8a2019-07-12 18:26:38 +020020
Krzysztof Grobelnydab06042021-04-02 13:28:14 +000021 AsyncResp(const AsyncResp&) = delete;
22 AsyncResp(AsyncResp&&) = delete;
Ed Tanousecd6a3a2022-01-07 09:18:40 -080023 AsyncResp& operator=(const AsyncResp&) = delete;
24 AsyncResp& operator=(AsyncResp&&) = delete;
Krzysztof Grobelnydab06042021-04-02 13:28:14 +000025
Ed Tanouse3cb5a32018-08-08 14:16:49 -070026 ~AsyncResp()
27 {
28 res.end();
29 }
30
Nan Zhou72374eb2022-01-27 17:06:51 -080031 crow::Response res;
Ed Tanouse3cb5a32018-08-08 14:16:49 -070032};
33
Iwona Klimaszewskac0a1c8a2019-07-12 18:26:38 +020034} // namespace bmcweb