CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ObjectARX 开发指南

AcRxProtocolReactor Macros

2022-12-31 17:18| 发布者: admin| 查看: 267| 评论: 0|来自: AutoCAD

为了简化协议反应器类对象的注册和存储,协议反应器 API 提供了一组方便的宏。这些宏返回指向主要框架组件的指针,并且通常将几行复杂代码减少为一行。以下宏在rxprotevnt.h头文件中定义:

  • acrxProtocolReactors

    返回指向单一实例对象的指针AcRxProtocolReactorFactory

  • ACRX_PROTOCOL_REACTOR_MANAGER_AT(acrxClass)

    使用宏获取指向指定 AcRx 类的对象的指针acrxProtocolReactorsAcRxProtocolReactorManager

  • ACRX_PROTOCOL_REACTOR_LIST_AT(acrxClass, reactorClass)

    使用在反应器管理器中查询指定的 AcRx 类。返回指向指定反应器类的反应堆列表的指针。ACRX_PROTOCOL_REACTOR_MANAGER_AT

例如,如果已创建名为 That 派生自 theclass 的协议反应器类,则可以使用以下代码实例化类对象并将其注册到适当的反应器管理器:AsdkInsertionPointsAcDbBlockInsertionPoints

AsdkInsertionPoints* pPts = NULL;
pPts = new AsdkInsertionPoints();
ACRX_PROTOCOL_REACTOR_LIST_AT(AcDbBlockTableRecord::desc(),
	AsdkInsertionPoints::desc())->addReactor(pPts);

使用完反应器后,或者应用程序退出时,移除反应器并将其销毁。

if (pPts)
{
ACRX_PROTOCOL_REACTOR_LIST_AT(AcDbBlockTableRecord::desc(), 
    AsdkInsertionPoints::desc())->removeReactor(pPts);
delete pPts;
}

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 15:27

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部