Class EIEIODataMessage.Header
java.lang.Object
uk.ac.manchester.spinnaker.messages.eieio.EIEIODataMessage.Header
- All Implemented Interfaces:
EIEIOHeader,SerializableMessage
- Enclosing class:
- EIEIODataMessage
EIEIO header for data packets.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal EIEIOTypeThe type of packet (size of various fields).final booleanWhether payloads are times.final IntegerAn offset for the payload.final ShortThe prefix on the message, ornullfor no prefix.final EIEIOPrefixHow to apply the prefix.final byteThe tag on the message. -
Constructor Summary
ConstructorsConstructorDescriptionHeader(EIEIOType eieioType, byte tag, Short prefix, EIEIOPrefix prefixType, Integer payloadBase, boolean isTime, byte count) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToBuffer(ByteBuffer buffer) Writes this message into the given buffer as a contiguous range of bytes.bytegetCount()intgetSize()voidIncrement the count of items in the packet.voidReset the count of items in the packet to zero.voidsetCount(byte count) Set the number of items in the packet to a specific value.
-
Field Details
-
eieioType
The type of packet (size of various fields). -
tag
public final byte tagThe tag on the message. -
prefix
The prefix on the message, ornullfor no prefix. -
prefixType
How to apply the prefix. -
payloadBase
An offset for the payload. -
isTime
public final boolean isTimeWhether 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 messagetag- the tag of the messageprefix- the key prefix of the messageprefixType- the position of the prefix (upper or lower)payloadBase- The base payload to be appliedisTime- true if the payloads should be taken to be timestamps, or false otherwisecount- 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
Description copied from interface:SerializableMessageWrites 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:
addToBufferin interfaceSerializableMessage- Parameters:
buffer- The buffer to write into.
-