Using convertors

The service profiles offered by DIET are sometimes not understandable by the service implementations. To solve this problem, a convertor processes each profile before it is passed to the implementation. This is mainly used to hide the implementation specific profile of a service from the user. It allows different servers to declare the same service with the same profile using different implementations of the service. If no convertor is passed when declaring a new service, a default convertor is assigned to it that does not change its profile nor its path.

To translate a profile, the convertor defines a new destination profile with a new path. It then chooses for each argument of the new profile a predefined function to assign this argument from the source profile. This allows the following operations:

Permutation of arguments. This is done implicitly by specifying which argument in the source profile corresponds to which argument in the destination profile.
Copy of arguments. Arguments can be simply used by applying the DIET_CVT_IDENTITY function. If the same source argument corresponds to two destination arguments it is automatically copied.
Creation of new arguments. New arguments can either contain static values or the properties of existing arguments. To create a new static value, the index for the source argument must be invalid (e.g.,-1) and the arg parameter must be set to the static argument. To extract a property of an existing argument, other functions than DIET_CVT_IDENTITY must be applied. The result of this function will then be used as the value for the destination argument. Corresponding to the DIET datatypes, the following functions exist:
Only the DIET_CVT_IDENTITY function can be applied to any argument; all other functions only operate on one type of argument.

The DIET Team - Mer 29 nov 2017 15:13:36 EST