Titan



encvalue


This built-in function is used to encode a value argument into a bitstring.

Related keywords:


encvalue( value_part [, encoding_info [, dynamic_encoding]] ) return bitstring;


Example 1:

type float MyFloat with { encode "RAW" }

var MyFloat f := 1.1;

var bitstring bs := encvalue(f);

This will store the "RAW" encoded form of the float value 1.1 into the bitstring variable bs.


Example 2:

type record MyRecord {
   integer num,
   charstring str
}
with {
   encode "XML";
   encode "JSON";
}

var MyRecord r := { num := 3, str := "abc" };

var bitstring bs := encvalue(r, "", "JSON");

This will store the "JSON" encoded form of the record value { num := 3, str := "abc" } into the bitstring variable bs.



BNF definition of encvalue