xref: /openbmc/bmcweb/include/async_resp.hpp (revision a529a6aa)
1 #pragma once
2 
3 #include "http_response.hpp"
4 
5 #include <functional>
6 
7 namespace bmcweb
8 {
9 
10 /**
11  * AsyncResp
12  * Gathers data needed for response processing after async calls are done
13  */
14 
15 class AsyncResp
16 {
17   public:
18     AsyncResp() = default;
19     explicit AsyncResp(crow::Response&& resIn) : res(std::move(resIn)) {}
20 
21     AsyncResp(const AsyncResp&) = delete;
22     AsyncResp(AsyncResp&&) = delete;
23     AsyncResp& operator=(const AsyncResp&) = delete;
24     AsyncResp& operator=(AsyncResp&&) = delete;
25 
26     ~AsyncResp()
27     {
28         res.end();
29     }
30 
31     crow::Response res;
32 };
33 
34 } // namespace bmcweb
35