3.3.1. Obtaining an interface pointer to
the target

The caller queries the target component interface
for a CAInterface pointer.

The caller (for example, a debugger) acquires a CAInterface pointer
of the targeted component. This is typically requested from a CADI
simulation.

The caller must call the ObtainInterface() method
of the target and pass the required interface name and revision
to check for compatibility with the required interface.

If the requested interface is found, another CAInterface pointer
is returned that points to the requested interface. This might be
the same as the previously acquired pointer. A NULL pointer
is returned it there is not a matching interface.

The caller knows that the target provides the required
interface and the CAInterface pointer must be
converted to the proper interface class, in this case SpecificInterface.

It is necessary to perform a static_cast at
this point because the boundary of a dynamic library was crossed
and this prevents the use of a dynamic_cast.
The impossibility of using a dynamic_cast across
dynamic library boundaries was the primary reason for introducing ObtainInterface() followed
by the static_cast.)

Figure 3.1. Obtaining a pointer to a specific
interface

To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.