Boost.Interfaces

Disclaimer

Overview

Boost.Interfaces provides a macro-based Interface Definition Language (IDL) which can be used to define C++ class types called interfaces. An interface is a lightweight value type associated with a set of named function signatures. An interface instance can be bound at runtime to any object which implements the interface, i.e., to any object of a type with accessible non-static member functions having the same name and signature as the set of functions associated with the interface. The functions of the bound object can then be invoked through the interface instance using the �dot� operator. Binding is completely non-intrusive: the object's type need not declare any virtual functions or derive from any particluar base class.

Interfaces were described in a September 2004 C/C++ Users Journal article by Christopher Diggins.

Current applications include:

Non-intrusive dynamic polymorphism — interfaces can often be used in place of abstract base classes, and are sometimes much faster.

Dynamic inheritance — allows function calls to be forwarded automatically to an object specified at runtime.

Smart Interface Pointers — smart pointers which can manage the lifetime of any object whose type implements a given interface.

Smart References — like smart interface pointers, but the managed object is accessed using the �dot� operator.

The Object Oriented Template Library, a project in the initial stages of development, by Christopher Diggins.

Planned future applications include:

Runtime reflection — will allow an interface's functions to be enumerated and looked up by name at runtime

Aspect Oriented Programming as described in a August 2004 Dr. Dobb's Journal article by Christopher Diggins.

Possible future applications include:

Integration with component architectures such as COM and CORBA.

Boost.Names — by abstracting the various uses of identifiers in C++ into preprocessor generated types called names, C++ classes and functions can be constructed in a straigtforward manner using template metaprogramming.