NIM PC Cross Platform SDK
nim_qchat_helper.h
Go to the documentation of this file.
1
6#ifndef _NIM_SDK_CPP_NIM_QCHAT_SDK_LOADER_HELPER_H_
7#define _NIM_SDK_CPP_NIM_QCHAT_SDK_LOADER_HELPER_H_
8
10
11namespace nim_qchat {
12extern nim::SDKInstance* nim_qchat_sdk_instance;
13} // namespace nim_qchat
14
15template <typename C, typename R>
16static void InvokeCallback(const R& response) {
17 if (response.user_data != nullptr) {
18 auto cb = reinterpret_cast<C*>(response.user_data);
19 if (cb) {
20 if (*cb) {
21 (*cb)(response);
22 }
23 delete cb;
24 }
25 }
26}
27
28// template <typename C, typename R>
29// static void InvokeCallback(const R* response) {
30// if (response != nullptr && response->user_data != nullptr) {
31// auto cb = reinterpret_cast<C*>(response->user_data);
32// if (cb) {
33// (*cb)(*response);
34// delete cb;
35// }
36// }
37// }
38
39#ifdef NIM_SDK_DLL_IMPORT
40#define NIM_QCHAT_SDK_GET_FUNC(function_ptr) NIM_SDK_GET_FUNC_FROM_INSTANCE(nim_qchat_sdk_instance, function_ptr)
41#else
42#define NIM_QCHAT_SDK_GET_FUNC(function_ptr) function_ptr
43#endif
44#endif // _NIM_SDK_CPP_NIM_QCHAT_SDK_LOADER_HELPER_H_
SDK库辅助类,提供加载/卸载SDK库以及获取接口的方法
Definition: nim_sdk_util.h:38
namespace nim_qchat
SDK库辅助方法