LongPort OpenAPI C++ SDK
push.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <functional>
4 
5 namespace longport {
6 
7 template<typename Ctx, typename T>
8 struct PushEvent
9 {
10 private:
11  Ctx ctx_;
12  const T* data_;
13 
14 public:
15  PushEvent(Ctx ctx, const T* data)
16  : ctx_(ctx)
17  , data_(data)
18  {
19  }
20 
21  inline const T* operator->() const { return data_; }
22 
23  inline const Ctx& context() { return ctx_; }
24 };
25 
26 template<typename Ctx, typename T>
27 using PushCallback = std::function<void(PushEvent<Ctx, T>)>;
28 
29 }
Definition: async_result.hpp:7
std::function< void(PushEvent< Ctx, T >)> PushCallback
Definition: push.hpp:27
Definition: push.hpp:9
const T * operator->() const
Definition: push.hpp:21
PushEvent(Ctx ctx, const T *data)
Definition: push.hpp:15
const Ctx & context()
Definition: push.hpp:23