LongPort OpenAPI C++ SDK
callback.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 
5 #include "async_result.hpp"
6 #include "push.hpp"
7 
8 namespace longport {
9 namespace callback {
10 
11 template<typename Ctx, typename Res>
14 {
15  return (PushCallback<Ctx, Res>*)p;
16 }
17 
18 template<typename Ctx, typename Res>
19 std::unique_ptr<AsyncCallback<Ctx, Res>>
21 {
22  auto callback_ptr = (AsyncCallback<Ctx, Res>*)p;
23  return std::unique_ptr<AsyncCallback<Ctx, Res>>(callback_ptr);
24 }
25 
26 } // namespace callback
27 } // namespace longport
std::unique_ptr< AsyncCallback< Ctx, Res > > get_async_callback(void *p)
Definition: callback.hpp:20
PushCallback< Ctx, Res > * get_push_callback(void *p)
Definition: callback.hpp:13
Definition: async_result.hpp:7
std::function< void(AsyncResult< Ctx, T >)> AsyncCallback
Definition: async_result.hpp:39
std::function< void(PushEvent< Ctx, T >)> PushCallback
Definition: push.hpp:27