BIMHome v1.0.0
BIMHome接口文档说明
IDelegateManager.h
浏览该文件的文档.
1/************************************************************************
2* @file IDelegateManager.h
3*
4* @brief 代理管理类
5*
6* @details 代理管理类
7*
8* @author
9*
10* @version 1.0
11*
12* @date 2025-05-29
13*
14* @license 北京华科软科技有限公司
15*
16*************************************************************************/
17
18#ifndef BIMHOMEAPP_APP_IDELEGATE_MANAGER_H
19#define BIMHOMEAPP_APP_IDELEGATE_MANAGER_H
20
21#include "BHGlobal.h"
22#include <string>
23#include <functional>
24namespace App
25{
26 typedef void* (*CREATE_DELEGATE_FUNC)();
32 class AppExport IDelegateManager
33 {
34 public:
41
48 virtual void registerDelegate(const std::string& sDelegateName, CREATE_DELEGATE_FUNC pFunc) = 0;
49
50 };
57
58
65 DelegateRegister(const std::string& sClassName, void* pFunc) {
67 }
68 };
69}
70#define BIMHOME_DELEGATE_DECLARE(className) \
71 public:\
72 std::string delegateName()override;\
73 static void* create();
74
75#define BIMHOME_DELEGATE_DEFINE(className) \
76 std::string className##::delegateName(){\
77 return #className; \
78 }\
79 void* className##::create(){\
80 return new className(); \
81 }\
82 static App::DelegateRegister oRegister(#className, &className##::create);
83
84#endif // BIMHOMEAPP_APP_DELEGATE_MANAGER_H
virtual void registerDelegate(const std::string &sDelegateName, CREATE_DELEGATE_FUNC pFunc)=0
注册委托
static IDelegateManager & instance()
获取委托管理器的单例实例
委托管理器接口
Definition IDelegateManager.h:33
void *(* CREATE_DELEGATE_FUNC)()
Definition IDelegateManager.h:26
Definition BaseFigureFactory.h:28
DelegateRegister(const std::string &sClassName, void *pFunc)
构造函数
Definition IDelegateManager.h:65
委托注册结构体
Definition IDelegateManager.h:56