Package org.jlab.coda.emu.support.data
Interface RingItem
- All Known Implementing Classes:
PayloadBuffer
This interface defines the type of item which may be passed to the EMU
through its transport channels.
This interface may be implemented to give EMU modules some flexibility
in the type of data they can handle.
-
Method Summary
Modifier and TypeMethodDescriptionvoidCopy the argument's data into this RingItem object.Get the ByteBuffer object (containing evio data) referenced by this ring item if any.Get the ByteBufferItem object used to wrap the referenced ByteBuffer (if any).Get the ByteBufferSupply object used to create the referenced ByteBuffer (if any).Get the byte order of the data contained in this object.longGet the input channel sequence used to get this item.com.lmax.disruptor.SequenceGet the input channel sequence object used to get this item.If this is control event, this method returns the type of control event, otherwise it returns null.org.jlab.coda.jevio.EvioEventgetEvent()Get the evio event object contained in this ring item if any.intGet the number of ROC events in this object's data.Get the type of event (ROC raw, physics, user, control , etc) this is.longGet the first event number in this object's data.org.jlab.coda.jevio.EvioNodegetNode()Get the EvioNode object which selects a particular event in the ByteBuffer referenced by this ring item, if any.intThe recordId, for a physics or ROC Raw type, starts at zero and increases by one in each successive "evio-file-format" data buffer.intIf emu input channel is reading ROC raw data, then this method gets the CODA id number of the source.Get the name of the data input channel (from xml config file) which read the data into this object.booleanIf merging contents of multiple rings, it's convenient to have a means to tell the caller when to switch reading from one ring to the next.longGet the time frame number (sequential count of time slice).longGet the timestamp if DAQ in streaming mode.intGet the length of this structure in bytes, including the header.booleanhasError()Did this object already have an error when first received from transport?booleanDid this object generate a non-fatal error while being built (still allows build to continue) ?booleanIs this object a control event?booleanDoes this object represent a missing frame?booleanIs this object a first event?voidisFirstEvent(boolean isFirst) Set whether this object a first event.booleanIs the DAQ triggering or streaming? This condition is set by the ROC and it is only read - never set.booleanisSync()Is this object is a sync event? This condition is set by the ROC and it is only read - never set.booleanisUser()Is this object a USER event type?booleanDoes the source id match that of the input channel?voidmatchesId(boolean matchId) Set whether the source id matches that of the input channel.voidReleases a ByteBuffer (if any) referenced by this object which was obtained from a ByteBufferSupply object.voidsetAll(org.jlab.coda.jevio.EvioEvent ev, ByteBuffer buf, org.jlab.coda.jevio.EvioNode nd, EventType eType, ControlType cType, boolean user, boolean first, boolean streaming, int chanId, int rId, int sId, int evCount, String sName, ByteBufferItem bbItem, ByteBufferSupply bbSupply) For a ringItem producer, when a new item is obtained, it must have all of its values set or reset.voidsetBuffer(ByteBuffer buffer) Set the ByteBuffer object (containing evio data) referenced by this ring item if any.voidsetChannelSequence(long seq) Sets the input channel sequence used to get this item.voidsetChannelSequenceObj(com.lmax.disruptor.Sequence seq) Sets the input channel sequence object used to get this item.voidsetControlType(ControlType type) Set the type of control event this is.voidsetEmptyFrame(boolean empty) Sets whether this object represents a missing frame.voidsetError(boolean hasError) Sets whether or not this object has an error.voidsetEvent(org.jlab.coda.jevio.EvioEvent event) Set the evio event object contained in this ring item.voidsetEventCount(int eventCount) Set the number of ROC events in this object's data.voidsetEventType(EventType type) Set the type of event (ROC raw, physics, user, control , etc) this is.voidsetFirstEventNumber(long firstEventNumber) Set the first event number in this object's data.voidsetNode(org.jlab.coda.jevio.EvioNode node) Set the EvioNode object which selects a particular event in the ByteBuffer referenced by this ring item, if any.voidsetNonFatalBuildingError(boolean nonFatalBuildingError) Sets whether or not this object generated a non-fatal error while being built.voidsetRecordId(int recordId) This method sets the record id.voidsetReusableByteBuffer(ByteBufferSupply byteBufferSupply, ByteBufferItem byteBufferItem) Set the objects needed to release (by callingreleaseByteBuffer()) the referenced ByteBuffer when no longer needed.voidsetSourceId(int sourceId) If emu input channel is reading Roc Raw data, then this method sets the CODA id number of the source.voidsetSourceName(String sourceName) Set the name of the data input channel (from xml config file) which read the data into this object.voidsetStreaming(boolean sync) Sets whether DAQ triggering or streaming.voidsetSwitchRing(boolean switchRing) If merging contents of multiple rings, it's convenient to have a means to tell the caller when to switch reading from one ring to the next.voidsetSync(boolean sync) Sets whether or not this object is a sync event.voidsetTimeFrame(long frame) Sets the time frame number (sequential count of time slice).voidsetTimestamp(long time) Sets the timestamp.Methods inherited from interface org.jlab.coda.emu.support.data.Attached
getAttachment, setAttachment
-
Method Details
-
getByteOrder
ByteOrder getByteOrder()Get the byte order of the data contained in this object.- Returns:
- byte order of the data contained in this object.
-
copy
Copy the argument's data into this RingItem object.- Parameters:
ringItem- RingItem to copy from
-
getEvent
org.jlab.coda.jevio.EvioEvent getEvent()Get the evio event object contained in this ring item if any.- Returns:
- evio event object contained in this ring item if any (null if none).
-
setEvent
void setEvent(org.jlab.coda.jevio.EvioEvent event) Set the evio event object contained in this ring item.- Parameters:
event- evio event object to be contained in this ring item.
-
getBuffer
ByteBuffer getBuffer()Get the ByteBuffer object (containing evio data) referenced by this ring item if any. Used in conjunction with {getNode()}.- Returns:
- ByteBuffer object referenced by this ring item if any (null if none).
-
setBuffer
Set the ByteBuffer object (containing evio data) referenced by this ring item if any. Used in conjunction with {setNode(org.jlab.coda.jevio.EvioNode)}.- Parameters:
buffer- ByteBuffer object to be referenced by this ring item.
-
getNode
org.jlab.coda.jevio.EvioNode getNode()Get the EvioNode object which selects a particular event in the ByteBuffer referenced by this ring item, if any. Used in conjunction with {getBuffer()}.- Returns:
- EvioNode object which selects a particular event in the ByteBuffer referenced by this ring item, if any (null if none).
-
setNode
void setNode(org.jlab.coda.jevio.EvioNode node) Set the EvioNode object which selects a particular event in the ByteBuffer referenced by this ring item, if any. Used in conjunction with {setBuffer(java.nio.ByteBuffer)}.- Parameters:
node- EvioNode object which selects a particular event in the ByteBuffer referenced by this ring item.
-
getTotalBytes
int getTotalBytes()Get the length of this structure in bytes, including the header.- Returns:
- the length of this structure in bytes, including the header.
-
isControlEvent
boolean isControlEvent()Is this object a control event?- Returns:
trueif control event, elsefalse.
-
getControlType
ControlType getControlType()If this is control event, this method returns the type of control event, otherwise it returns null.- Returns:
- type of control event, else null.
-
setControlType
Set the type of control event this is.- Parameters:
type- type of control event this is.
-
isUser
boolean isUser()Is this object a USER event type?- Returns:
trueif USEr event type, elsefalse.
-
isFirstEvent
boolean isFirstEvent()Is this object a first event?- Returns:
trueif first event, elsefalse.
-
isFirstEvent
void isFirstEvent(boolean isFirst) Set whether this object a first event.- Parameters:
isFirst-trueif first event, elsefalse.
-
getEventType
EventType getEventType()Get the type of event (ROC raw, physics, user, control , etc) this is.- Returns:
- type of event this is.
-
setEventType
Set the type of event (ROC raw, physics, user, control , etc) this is.- Parameters:
type- type of event this is.
-
getSourceId
int getSourceId()If emu input channel is reading ROC raw data, then this method gets the CODA id number of the source.- Returns:
- CODA id number of input ROC raw data source.
-
setSourceId
void setSourceId(int sourceId) If emu input channel is reading Roc Raw data, then this method sets the CODA id number of the source.- Parameters:
sourceId- CODA id number of input Roc Raw data source.
-
matchesId
boolean matchesId()Does the source id match that of the input channel?- Returns:
trueif source id matches that of the input channel, elsefalse.
-
matchesId
void matchesId(boolean matchId) Set whether the source id matches that of the input channel.- Parameters:
matchId-trueif source id matches that of the input channel, elsefalse.
-
getRecordId
int getRecordId()The recordId, for a physics or ROC Raw type, starts at zero and increases by one in each successive "evio-file-format" data buffer. It is set to -1 for other data types. This id is copied into each RingItem and many items can have the same id. This method gets the record id.- Returns:
- record id
-
setRecordId
void setRecordId(int recordId) This method sets the record id.- Parameters:
recordId- the record id
-
getSourceName
String getSourceName()Get the name of the data input channel (from xml config file) which read the data into this object.- Returns:
- name of the data input channel from xml config file.
-
setSourceName
Set the name of the data input channel (from xml config file) which read the data into this object.- Parameters:
sourceName- name of the data input channel from xml config file.
-
getEventCount
int getEventCount()Get the number of ROC events in this object's data.- Returns:
- number of ROC events in this object's data.
-
setEventCount
void setEventCount(int eventCount) Set the number of ROC events in this object's data.- Parameters:
eventCount- number of ROC events in this object's data.
-
getFirstEventNumber
long getFirstEventNumber()Get the first event number in this object's data.- Returns:
- first event number in this object's data.
-
setFirstEventNumber
void setFirstEventNumber(long firstEventNumber) Set the first event number in this object's data.- Parameters:
firstEventNumber- first event number in this object's data.
-
getSwitchRing
boolean getSwitchRing()If merging contents of multiple rings, it's convenient to have a means to tell the caller when to switch reading from one ring to the next.- Returns:
- true if time to switch ring being read, else false.
-
setSwitchRing
void setSwitchRing(boolean switchRing) If merging contents of multiple rings, it's convenient to have a means to tell the caller when to switch reading from one ring to the next.- Parameters:
switchRing- true if time to switch ring being read, else false.
-
isSync
boolean isSync()Is this object is a sync event? This condition is set by the ROC and it is only read - never set.- Returns:
trueif this object is a sync event, elsefalse.
-
setSync
void setSync(boolean sync) Sets whether or not this object is a sync event. This condition is set by the ROC and so this method is only used to pass on that information.- Parameters:
sync-trueif this object is a sync event, elsefalse.
-
hasError
boolean hasError()Did this object already have an error when first received from transport?- Returns:
trueif this object had an error when first received, elsefalse.
-
setError
void setError(boolean hasError) Sets whether or not this object has an error.- Parameters:
hasError-trueif this object has an error, elsefalse.
-
hasNonFatalBuildingError
boolean hasNonFatalBuildingError()Did this object generate a non-fatal error while being built (still allows build to continue) ?- Returns:
trueif this object generated a non-fatal build error, elsefalse.
-
setNonFatalBuildingError
void setNonFatalBuildingError(boolean nonFatalBuildingError) Sets whether or not this object generated a non-fatal error while being built.- Parameters:
nonFatalBuildingError-trueif this object generate a non-fatal error while being built, elsefalse.
-
releaseByteBuffer
void releaseByteBuffer()Releases a ByteBuffer (if any) referenced by this object which was obtained from a ByteBufferSupply object. This allows the buffer to be reused. -
setReusableByteBuffer
Set the objects needed to release (by callingreleaseByteBuffer()) the referenced ByteBuffer when no longer needed.- Parameters:
byteBufferSupply- object which supplied the ByteBufferbyteBufferItem- object wrapping ByteBuffer in the supply
-
getByteBufferSupply
ByteBufferSupply getByteBufferSupply()Get the ByteBufferSupply object used to create the referenced ByteBuffer (if any).- Returns:
- ByteBufferSupply object used to create the referenced ByteBuffer (if any, else null).
-
getByteBufferItem
ByteBufferItem getByteBufferItem()Get the ByteBufferItem object used to wrap the referenced ByteBuffer (if any).- Returns:
- ByteBufferItem object used to wrap the referenced ByteBuffer (if any, else null).
-
isStreaming
boolean isStreaming()Is the DAQ triggering or streaming? This condition is set by the ROC and it is only read - never set.- Returns:
trueif DAQ is streaming, elsefalse.
-
setStreaming
void setStreaming(boolean sync) Sets whether DAQ triggering or streaming. This condition is set by the ROC and so this method is only used to pass on that information.- Parameters:
sync-trueif this DAQ is streaming, elsefalse.
-
isEmptyFrame
boolean isEmptyFrame()Does this object represent a missing frame?- Returns:
trueif this object represents a missing frame, elsefalse.
-
setEmptyFrame
void setEmptyFrame(boolean empty) Sets whether this object represents a missing frame.- Parameters:
empty-trueif this object represents a missing frame, elsefalse.
-
getTimestamp
long getTimestamp()Get the timestamp if DAQ in streaming mode.- Returns:
- timestamp, only meaningful in streaming mode.
- See Also:
-
setTimestamp
void setTimestamp(long time) Sets the timestamp. Relevent only if DAQ in streaming mode.- Parameters:
time- timestamp.- See Also:
-
getTimeFrame
long getTimeFrame()Get the time frame number (sequential count of time slice). Relevent only if DAQ in streaming mode.- Returns:
- time frame number (sequential count of time slice), only meaningful in streaming mode.
- See Also:
-
setTimeFrame
void setTimeFrame(long frame) Sets the time frame number (sequential count of time slice). Relevent only if DAQ in streaming mode.- Parameters:
frame- time frame number (sequential count of time slice).- See Also:
-
getChannelSequence
long getChannelSequence()Get the input channel sequence used to get this item.- Returns:
- input channel sequence used to get this item.
-
setChannelSequence
void setChannelSequence(long seq) Sets the input channel sequence used to get this item.- Parameters:
seq- input channel sequence used to get this item.
-
getChannelSequenceObj
com.lmax.disruptor.Sequence getChannelSequenceObj()Get the input channel sequence object used to get this item.- Returns:
- input channel sequence object used to get this item.
-
setChannelSequenceObj
void setChannelSequenceObj(com.lmax.disruptor.Sequence seq) Sets the input channel sequence object used to get this item.- Parameters:
seq- input channel sequence object used to get this item.
-
setAll
void setAll(org.jlab.coda.jevio.EvioEvent ev, ByteBuffer buf, org.jlab.coda.jevio.EvioNode nd, EventType eType, ControlType cType, boolean user, boolean first, boolean streaming, int chanId, int rId, int sId, int evCount, String sName, ByteBufferItem bbItem, ByteBufferSupply bbSupply) For a ringItem producer, when a new item is obtained, it must have all of its values set or reset. This does so in one convenient method. Note that in general, only 1 of ev, buf, or node is specified.- Parameters:
ev- EvioEvent object (1st way of specifying evio data)buf- ByteBuffer object (2nd way of specifying evio data)nd- EvioNode object (3rd way of specifying evio data)eType- type of event: roc raw, physics, user, control, etc.cType- type of control event: prestart, go, end, etc.user- is this a USER event typefirst- is this a "first" or "beginning-of-run" eventstreaming- is DAQ streaming or triggeredchanId- ID of data channel this method is called forrId- record IDsId- CODA ID of data sourceevCount- number of events in datasName- name of data sourcebbItem- ByteBufferItem object holding the ByteBuffer containing the databbSupply- Supply object containing the ByteBufferItem
-