Table of contents


Some template instructions (or "operators") rely on the previous value. This is considered an internal property of the operator.
For fields using operators that rely on a previous value, this value is used to derive the decoded value of the current message.
The previous value can be in one of three states: undefined, empty and assigned.

  • All values are in the state undefined when processing starts.
  • The assigned state indicates that the previous value is present and has some value.
  • The empty state is the assigned state but it indicates that previous value is absent. In such case previous values has "null" representaion of value.

At some defined moments the state of previous value of template fields need to be reset to the undefined state. These moments are defined by the protocol which is used to transfer data:

  • Protocols with packet boundaries (UDP, TCP stream with separator) considers to automatically reset state
  • For protocols without packet boundaries, the reset normally occurs at start of connection only.

However, It is important that reset must be preformed in the same order in the encoder and decoder with respect to the order of the content of the stream.

The following example shows reset action performing after each FAST message receiving

public Object decodeMessage(byte[] fastMessage) {
    messageTemplate.decode(fastMessage, offset, presenceMap, outputMessage);
    return outputMessage;

Resetting state means that all fields are set to their initial pre-processing state (undefined state).

The udefined state of fields implies non-existent of previous values. In such case on the first iteration of decoding process is used initial value instead of previous value. (An initial value is specified in the Template by the value attribute on the operator element.)
If the initial value is not defined by the template (if it has the "null" value representation), the base value can be used instead of initial value. Each field defined its own appropriate base value acording to data type property.