OpenTTCN/2.56.0/ANSI C SDK library reference/TCI-CD extensions/otSetEncoder

From OpenTTCN

Jump to: navigation, search

otSetEncoder

The otSetEncoder function registers either default encoder or encoder for a particular type.

void otSetEncoder(
    TciType type,
    TciEncodeFunctionPtr efp);

Parameters

type

   

Type of values that the encoder function being registered claims to be able to encode, or 0 for default encoder.

efp

   

Pointer to encoder function being registered.

Remarks

Whenever test execution is about to encode a value of a particular type, it consults its internal table of registered encoders and selects the encoder function that claims to support encoding of values of that type. If no such encoder is found, a test case error is reported.

If called with 0 as type parameter (TciType), this function sets the default encoder. Default encoder claims to support encoding of all types, unless a specific encoder for a particular type has been registered. Default encoder is selected by the test execution if no type-specific encoding function is registered for a particular type.

Starting with OpenTTCN ANSI C SDK 2.54.0.RC8, this function provides a more powerful replacement to user-supplied tciEncode() function for specifying encoders. The actual name of the tciEncode() function does not have to be hard-coded anymore, although tciEncode() can still be used "as is", for example, for strict standard compliancy reasons. In order to specify tciEncode() as the only encoding function registered in the encoding subsystem that handles encoding of all types by default, add the following statement into initialization part of your code:

otSetEncoder(0, &tciEncode);

This will register tciEncode() as the only encoding function in the system.

For simplicity and for documentation compatibility reasons, activities performed by the test execution to select and call a correct encode function as described above are collectively referred to as "performing tciEncode() function call", although this does not necessarily mean actual tciEncode() C function call.

Requirements

Header

Declared in <tci/tci_ext.h>; include <tci/tci.h>.

Library

openttcn-tcd-mt.lib

Compatibility

OpenTTCN ANSI C SDK 2.x and higher

See also

tciEncode

Views
Personal tools