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 Summary
Fields Modifier and Type Field Description EIEIOType
eieioType
The type of packet (size of various fields).boolean
isTime
Whether payloads are times.Integer
payloadBase
An offset for the payload.Short
prefix
The prefix on the message, ornull
for no prefix.EIEIOPrefix
prefixType
How to apply the prefix.byte
tag
The tag on the message. -
Constructor Summary
Constructors Constructor Description Header(EIEIOType eieioType, byte tag, Short prefix, EIEIOPrefix prefixType, Integer payloadBase, boolean isTime, byte count)
-
Method Summary
Modifier and Type Method Description void
addToBuffer(ByteBuffer buffer)
Writes this message into the given buffer as a contiguous range of bytes.byte
getCount()
int
getSize()
void
incrementCount()
Increment the count of items in the packet.void
resetCount()
Reset the count of items in the packet to zero.void
setCount(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, ornull
for 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: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 interfaceSerializableMessage
- Parameters:
buffer
- The buffer to write into.
-