Class EIEIODataMessage.Header

java.lang.Object
uk.ac.manchester.spinnaker.messages.eieio.EIEIODataMessage.Header
All Implemented Interfaces:
EIEIOHeader, SerializableMessage
Enclosing class:
EIEIODataMessage

public static class EIEIODataMessage.Header
extends Object
implements EIEIOHeader
EIEIO header for data packets.
  • Field Details

    • eieioType

      public final EIEIOType eieioType
      The type of packet (size of various fields).
    • tag

      public final byte tag
      The tag on the message.
    • prefix

      public final Short prefix
      The prefix on the message, or null for no prefix.
    • prefixType

      public final EIEIOPrefix prefixType
      How to apply the prefix.
    • payloadBase

      public final Integer payloadBase
      An offset for the payload.
    • isTime

      public final boolean isTime
      Whether payloads are times.
  • Constructor Details

    • Header

      public Header​(EIEIOType eieioType, byte tag, Short prefix, EIEIOPrefix prefixType, Integer payloadBase, boolean isTime, byte count)
      Parameters:
      eieioType - the type of message
      tag - the tag of the message
      prefix - the key prefix of the message
      prefixType - the position of the prefix (upper or lower)
      payloadBase - The base payload to be applied
      isTime - true if the payloads should be taken to be timestamps, or false otherwise
      count - Count of the number of items in the packet
  • Method Details

    • getCount

      public byte getCount()
      Returns:
      The number of items in the packet.
    • setCount

      public void setCount​(byte count)
      Set the number of items in the packet to a specific value.
      Parameters:
      count - The value to set the count to.
    • incrementCount

      public void incrementCount()
      Increment the count of items in the packet.
    • resetCount

      public void resetCount()
      Reset the count of items in the packet to zero.
    • getSize

      public int getSize()
      Returns:
      The unit size per data component.
    • addToBuffer

      public void addToBuffer​(ByteBuffer buffer)
      Description copied from interface: SerializableMessage
      Writes this message into the given buffer as a contiguous range of bytes. This is so that a message can be sent. Implementors may assume that the buffer has been configured to be little-endian and that its position is at the point where they should begin writing. Once it has finished, the position should be immediately after the last byte written by this method.

      Calling this method should not update the internal state of the message. It should be possible to add the message to multiple buffers without special precautions by the caller.

      Specified by:
      addToBuffer in interface SerializableMessage
      Parameters:
      buffer - The buffer to write into.