3.3.1. Obtaining an interface pointer to the target

Figure 3.1 shows the steps required to obtain the interface pointer:

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

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

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

  4. 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.

  5. The caller knows that the target provides the desired 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.

Copyright © 2008-2010 ARM Limited. All rights reserved.ARM DUI 0444F