4.1. Overview of the extension mechanism

One of the major features introduced with CADI 2.0 is the extension mechanism that:

A single target can present multiple interfaces. Each of the interfaces, including the basic CADI interface, is an extension of the abstract CAInterface class. The client can use a pointer to any of the interfaces to obtain a pointer to any of the other interfaces implemented by the target.

The CADI extension mechanism is based on the CAInterface class and its methods that must be implemented for any custom interface:

IFNAME()

is a static method that must be defined by each interface class. It returns the name.

IFREVISION()

is a static method that must be defined by each interface class. It returns the revision.

ObtainInterface()

is a virtual method that is implemented in the class that implements the interface. It retrieves an interface from a target, including those introduced by an extension, and performs compatibility checks.

The main work of adding a custom extension to CADI must be done in the implementation for the target. A new class is declared and implemented provides access to all interfaces the target component offers.

A typical implementation requires consideration of the following:

  1. Declare a class with the custom interface extensions that must be derived from CAInterface. The inherited method calls must be implemented.

  2. Implement ObtainInterface() for the custom extension so that all existing interfaces are accessible.

  3. Other implemented interfaces provided by the target require a link to the extension through their ObtainInterface() implementations.

Implementation example for extending the target-side provides an example of creating and implementing an extension interface.

Copyright © 2008-2014 ARM. All rights reserved.ARM DUI 0444M
Non-ConfidentialID051314