xref: /openbmc/bmcweb/include/async_resp.hpp (revision 89492a157c9cf972b342421e24d41fd382510251)
1e3cb5a31SEd Tanous #pragma once
2e3cb5a31SEd Tanous 
38d1b46d7Szhanghch05 #include "http_response.hpp"
48d1b46d7Szhanghch05 
5c0a1c8a0SIwona Klimaszewska #include <functional>
6c0a1c8a0SIwona Klimaszewska 
7e3cb5a31SEd Tanous namespace bmcweb
8e3cb5a31SEd Tanous {
9e3cb5a31SEd Tanous 
10e3cb5a31SEd Tanous /**
11e3cb5a31SEd Tanous  * AsyncResp
12e3cb5a31SEd Tanous  * Gathers data needed for response processing after async calls are done
13e3cb5a31SEd Tanous  */
14c0a1c8a0SIwona Klimaszewska 
15e3cb5a31SEd Tanous class AsyncResp
16e3cb5a31SEd Tanous {
17e3cb5a31SEd Tanous   public:
1872374eb7SNan Zhou     AsyncResp() = default;
AsyncResp(crow::Response && resIn)19*89492a15SPatrick Williams     explicit AsyncResp(crow::Response&& resIn) : res(std::move(resIn)) {}
20c0a1c8a0SIwona Klimaszewska 
21dab0604aSKrzysztof Grobelny     AsyncResp(const AsyncResp&) = delete;
22dab0604aSKrzysztof Grobelny     AsyncResp(AsyncResp&&) = delete;
23ecd6a3a2SEd Tanous     AsyncResp& operator=(const AsyncResp&) = delete;
24ecd6a3a2SEd Tanous     AsyncResp& operator=(AsyncResp&&) = delete;
25dab0604aSKrzysztof Grobelny 
~AsyncResp()26e3cb5a31SEd Tanous     ~AsyncResp()
27e3cb5a31SEd Tanous     {
28e3cb5a31SEd Tanous         res.end();
29e3cb5a31SEd Tanous     }
30e3cb5a31SEd Tanous 
3172374eb7SNan Zhou     crow::Response res;
32e3cb5a31SEd Tanous };
33e3cb5a31SEd Tanous 
34e3cb5a31SEd Tanous } // namespace bmcweb
35