A.1.1 About the CAInterface class

CAInterface provides a basis for a software model built around components and interfaces.

For CADI, an interface:

  • Is an abstract class consisting entirely of pure virtual methods.
  • Derives from CAInterface.
  • Provides a number of methods for interacting with a component.
  • Is identified by a string name of type if_name_t and an integer revision of type if_rev_t. A higher revision number indicates a newer revision of the same interface.

A component is a black-box entity that has a unique identity and provides concrete implementations of one or more interfaces:

  • Each of these interfaces can expose different facets of the component behavior.
  • These interfaces are the only way to interact with the component.
  • There is no way for a client to enumerate the set of interfaces that a component implements. The client must ask for specific interfaces by name.

    (The implementation of a component interface might be provided by one or several interacting C++ objects. This is an implementation detail that is opaque to the client.)

  • If the component does not implement the requested interface, it returns a NULL pointer.

The CAInterface class is the base class for all interfaces. It defines a method, CAInterface::ObtainInterface(), that enables a client to obtain a reference to any of the interfaces that the component implements.

The client specifies the ID and revision of the interface that it is requesting. The component can return NULL if it does not implement that interface, or only implements a lower revision.

Because each interface derives from CAInterface, a client can call ObtainInterface() on any one interface pointer to obtain a pointer to any other interface implemented by the same component.

These rules govern the use of components and interfaces:

  • Each component is distinct. No two components can return the same pointer for a given interface. An ObtainInterface() call on one component must not return an interface on a different component.
  • Each interface consists of a name, a revision number, and a C++ abstract class definition. The return value of ObtainInterface() is either NULL or a pointer, castable to the class type.
  • Where two interfaces have the same if_name_t, the newer revision of the interface must be compatible with the old revision. (This includes the binary layout of any data structures that it uses and the semantics of any methods.)
  • During the lifetime of a component, any calls to ObtainInterface() for a given interface name and revision must always return the same pointer value. It must not matter which of the component interfaces is used to invoke ObtainInterface().
  • All components must implement an interface derived from eslapi::CAInterface.
Non-ConfidentialPDF file icon PDF version100963_0200_03_en
Copyright © 2014–2018 Arm Limited or its affiliates. All rights reserved.