Class GenerationUtil

java.lang.Object
uk.co.real_logic.sbe.ir.GenerationUtil

public final class GenerationUtil extends Object
Common code generation utility functions to be used by the different language specific backends.
  • Constructor Details

    • GenerationUtil

      public GenerationUtil()
  • Method Details

    • collectFields

      public static int collectFields(List<Token> tokens, int index, List<Token> fields)
      Collect the fields for a message.
      Parameters:
      tokens - for the message.
      index - index at which to begin.
      fields - to collect the field tokens into.
      Returns:
      resulting index.
    • collectGroups

      public static int collectGroups(List<Token> tokens, int index, List<Token> groups)
      Collect the groups for a message.
      Parameters:
      tokens - for the message.
      index - index at which to begin.
      groups - to collect the group tokens into.
      Returns:
      resulting index.
    • collectVarData

      public static int collectVarData(List<Token> tokens, int index, List<Token> varData)
      Collect the var data for a message.
      Parameters:
      tokens - for the message.
      index - index at which to begin.
      varData - to collect the var data tokens into.
      Returns:
      resulting index.
    • collect

      public static int collect(Signal signal, List<Token> tokens, int index, List<Token> collected)
      Collect a run of tokens matching a signal.
      Parameters:
      signal - to match against.
      tokens - for the message.
      index - index at which to begin.
      collected - to collect the tokens into.
      Returns:
      resulting index.
    • getMessageBody

      public static List<Token> getMessageBody(List<Token> tokens)
      Get the tokens for the message body by subtracting the message wrapper.
      Parameters:
      tokens - for the message.
      Returns:
      the tokens for the message body by subtracting the message wrapper.
    • findEndSignal

      public static int findEndSignal(List<Token> tokens, int index, Signal signal, String name)
      Find the index of the end signal for a given name.
      Parameters:
      tokens - to search.
      index - to start from.
      signal - to match.
      name - to match.
      Returns:
      index where found.
    • findSubGroupNames

      public static List<String> findSubGroupNames(List<Token> tokens)
      Find a list of subgroup names.
      Parameters:
      tokens - to search.
      Returns:
      list of names for the subgroups.
    • findSignal

      public static int findSignal(List<Token> tokens, Signal signal)
      Find the first instance of a given signal.
      Parameters:
      tokens - to search.
      signal - to search for.
      Returns:
      index the signal was found at or -1 if not found.