Components
This framework offers component based development. Components come at various levels of the development and can be associated to become a larger component. Components can also contain sub-components. It defines a composable entity whose roles can vary from a driver to a functional component.
A component contains 2 entities, an interface, that is shared between all components of the same type and an implementation-specific configuration.
For example, we will define a square which interface is a generic shape.
interface Shape
{
using Area = Integer [min(0)];
method surface() -> Area;
}
component Square : Shape
{
config:
width = Integer;
}
A square is defined by its border width. Such component is instantiated from a composable scope:
This component exposes the Shape interface.
Sub-components
Components can be made from other components. The syntax is similar to a top level component, except that everything takes part in the component definition.
component ComplexShape : Shape
{
config:
width1 = Integer;
width2 = Integer;
composition:
square1 = Square(width = width1);
square2 = Square(width = width2);
}
The C++ implementation of the complex component could be something like:
Sub-components help with encapsulation and hence reduce the complexity and improve composability while improving re-usability. For example, imagine a complex sub-system: