Converters

Converter Selection

When sending and receiving data via RSB, an appropriate instance of a converter needs to be selected by the RSB implementation. This selection process is performed by an implementation of a converter selection strategy.

The default converter selection strategy relies on the fact that the selection can always be performed without ambiguities. These ambiguities can arise in case multiple converters exist for the same wire schema or data type. In such cases, when using the default converter selection strategy, the user has to provide rules to disambiguate the different converters via the configuration mechanism.

Note

Each transport can use a different converter selection strategy.

Disambiguation

Potentially, multiple converters can exist that encoding to / decode from the same wire schema or data type. For example, there could be a common wire schema to encode image data, but different domain image types like OpenCV’s or ICL’s image classes. In order to resolve these ambiguities when using the default converter selection strategy you can configure your choice under the configuration section TRANSPORT.converter.LANGUAGE as entries of the form WIRE-SCHEMA = DATA-TYPE.

Using Custom Converter Selection Strategies

Different implementations of converter selection strategy apart from the default implementation are shipped with RSB or can be implemented by users. In order to use these implementations, you need to adapt the Configuration of the participant you are going to create.

The default rsb::ParticipantConfig will configure all transports using the default unambiguous converter selection strategy (implemented by rsb::converter::UnambiguousConverterMap). In order to replace this default rsb::converter::ConverterSelectionStrategy by a different one you need to modifying the converters option value of the respective transport options in the rsb::ParticipantConfig instance that you are going to pass to the factory method when creating a new participant.