4.1 Overview of the extension mechanism

A major feature introduced with CADI 2.0 is the extension mechanism.

The extension mechanism:

  • Provides a simple framework that enables adding more interfaces to a target component.
  • Enables checking compatibility between the caller and the target.

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:

is a static method that must be defined by each interface class. It returns the name.
is a static method that must be defined by each interface class. It returns the revision.
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 must consider:

  1. Declaring a class with the custom interface extensions that must be derived from CAInterface. The inherited method calls must be implemented.
  2. Implementing ObtainInterface() for the custom extension so that all existing interfaces are accessible.
  3. Linking the extension to other implemented interfaces provided by the target through their ObtainInterface() implementations.
Non-ConfidentialPDF file icon PDF versionARM 100963_0200_00_en
Copyright © 2014–2017 ARM Limited or its affiliates. All rights reserved.