CapitolSoft Banner
Open Architecture
Control Development Kit
RAD Foundation Class
Enhanced IntelliSense
Migration Center

"Publish-Subscribe" Event

RAD C++ Event Model


One of the great new features of RadVC's "Open Architecture" is its use of a powerful and very flexible event model. In many ways, this model is far more superior than the traditional models used by MFC and ATL class libraries. However this new model does not replace the existing models, it merely extends them to a new level.
How Does it Work:
The model is based on a concept called "Publishing and Subscription", where the event "publisher" manages the events in a way that when an event occurs (created / raised / fired), it has the responsibility to notify (broadcast) it to the event subscriber (sink) that handles the event.
Here is a list of the main features of the RadVC' event architecture:

(1) Library Independence: The model is independent of any C++ class library like MFC or ATL. The event model used by MFC and ATL are tightly coupled and have two different ways to make the contract between the event source and the event sink. In RAD C++ Event model, the user now can use one unified approach to implement an event connection.

(2) Class Independence: The event model used by MFC and ATL only allows you to add events to classes that are derived from certain classes. For example, to add an event to a MFC class, the class must be derived from CCmdTarget or any of its derived class (e.g. CWnd). This is not the case in "RAD C++ Event" model, the class that implements the event source and the event sink can be derived from any class.

(3) Dynamic:  In "RAD C++ Event" model, the link between the event source and the event sink can be added any time during program execution. Also, if a sink becomes redundant at a certain time during the execution, then that sink can be easily detached from the event source.

(4) Multiple Sink: In "RAD C++ Event" model, several event sinks can be connected to an event source simultaneously, both in design and runtime. Thus when the event source (publisher) raises (or publishes) and event that event notification is broadcast simultaneously to the all event sinks that are connected to the event source.

How to Use:
Please read the tutorial in "Spice up your C++ Control with a Touch of RAD", where we show you how to manually create a RAD C++ control in Visual C++ (without RadVC).
You can also read Part 6: Adding an Event to the New Control to find how an event can be added automatically to a RAD C++ control in RadVC environment and Part 9: Testing the Modified Control to know how an event sink can be added to the client module.



Microsoft Visual C++, Microsoft Visual Basic and Microsoft Visual Studio are registered trademarks of Microsoft Corporation.
Copyright 1998-2000 Capitolsoft Corporation. All rights reserved.
Disclaimer: Capitolsoft Corporation is an independent business organization incorporated with the State Commission of Virginia and hence has no connection with U.S. Capitol or any other federal agency of U.S. government. Opinions expressed by the individuals in this site are of their own alone and hence do not necessarily reflect the views of Capitolsoft Corporation.


This page was last updated on November 21, 2005
Hit Counter