To simplify the registration and storage of protocol reactor class objects, the protocol reactor API provides a set of convenience macros. These macros return pointers to the principal framework components and typically reduce several lines of complex code to a single line. The following macros are defined in the rxprotevnt.h header file:
Returns a pointer to the singleton AcRxProtocolReactorFactory object
Uses the acrxProtocolReactors macro to get a pointer to the AcRxProtocolReactorManager object for the specified AcRx class
Uses the ACRX_PROTOCOL_REACTOR_MANAGER_AT to query the reactor manager for the specified AcRx class. Returns a pointer to its list of reactors for the specified reactor class.
For example, if you have created a protocol reactor class named AsdkInsertionPoints that derives from the AcDbBlockInsertionPoints class, you would use the following code to instantiate a class object and register it with the proper reactor manager:
AsdkInsertionPoints* pPts = NULL; pPts = new AsdkInsertionPoints(); ACRX_PROTOCOL_REACTOR_LIST_AT(AcDbBlockTableRecord::desc(), AsdkInsertionPoints::desc())->addReactor(pPts);
When you have finished using the reactor, or when your application exits, you remove the reactor and destroy it.
if (pPts) { ACRX_PROTOCOL_REACTOR_LIST_AT(AcDbBlockTableRecord::desc(), AsdkInsertionPoints::desc())->removeReactor(pPts); delete pPts; }