Using Reactors

To use a transient reactor, derive a new class from one of the following base classes:

AcApDocManagerReactor

Monitors a variety of document management events.

AcApLongTransactionReactor

Monitors actions associated with long transactions. See Long Transactions.

AcDbDatabaseReactor

Monitors creation, modification, and erasure of database objects.

AcDbLayoutManagerReactor

Monitors events related to the layout manager. See Layout Class Overview.

AcDbObjectReactor

Monitors events pertaining to a specific database object—creation, modification, erasure.

AcDbEntityReactor

Monitors an extra, entity-specific event, such as modified graphics.

AcEdInputContextReactor

Monitors events related to prompts for user input. See Input Context Events.

AcEdSSGetFilter/AcEdSSGetFilter2

Monitors selection set operations.

AcRxDLinkerReactor

Monitors ObjectARX application loading and unloading.

AcRxEventReactor

Monitors events that are common to both ObjectARX and ObjectDBX .

AcEditorReactor/AcEditorReactor2

Monitors AutoCAD-specific events such as commands and AutoLISP ® evaluations.

AcTransactionReactor

Monitors events related to the transaction manager—start, abort, or end of a transaction.

AcPublishReactor

Monitors key publish events.

AcPublishUIReactor

Monitors the Publish Options dialog.

AcRxProtocolReactor

Monitors events through the protocol extension mechanism. See Protocol Reactor Framework.

AcDMMReactor

Monitors Publish to DWF operations.

AcTcCatalogItemReactor

Monitors children added to, deleted from, or detached from a catalog item.

AcDbSummaryInfoReactor

Monitors changes to Summary Info.

In most cases, only standard C++ techniques are needed for creating new transient reactor classes. The ObjectARX macros, which create a class descriptor object for the new reactor class, are usually not used to derive from these reactor classes.

Each parent class contains a set of virtual notification functions that can be implemented by your newly derived class. For example, the AcDbObjectReactor class contains the following notification functions that respond to object-related events:

Each of these functions requires a pointer to the notifier of the event. The base class, AcDbObjectReactor, has NULL implementations for all of these functions. In your derived reactor class, implement the functions corresponding to the type of notifications you are interested in. Then instantiate the reactor and add it to any number of database objects using the AcDbObject::addReactor() function. To add a transient reactor to or delete it from a notifier object, the object can be open in any state (read, write, or notify). Adding or deleting a transient reactor is not monitored by the undo mechanism. (For persistent reactors, the notifier object must be opened for write, and adding or removing the reactors is monitored by the undo mechanism.) Because you created the transient reactor object, you are also responsible for deleting it.

When an object is erased, for example, it calls the corresponding erased() notification function on each reactor in its list. If you have implemented an erased() function for your reactor, that function is called by the database object, and you can then take whatever special action is appropriate for your application when an object is erased.