Interface RingItem

All Superinterfaces:
Attached, Cloneable
All Known Implementing Classes:
PayloadBuffer

public interface RingItem extends Cloneable, Attached
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 Type
    Method
    Description
    void
    copy(RingItem ringItem)
    Copy 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.
    long
    Get the input channel sequence used to get this item.
    com.lmax.disruptor.Sequence
    Get 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.EvioEvent
    Get the evio event object contained in this ring item if any.
    int
    Get the number of ROC events in this object's data.
    Get the type of event (ROC raw, physics, user, control , etc) this is.
    long
    Get the first event number in this object's data.
    org.jlab.coda.jevio.EvioNode
    Get the EvioNode object which selects a particular event in the ByteBuffer referenced by this ring item, if any.
    int
    The recordId, for a physics or ROC Raw type, starts at zero and increases by one in each successive "evio-file-format" data buffer.
    int
    If 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.
    boolean
    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.
    long
    Get the time frame number (sequential count of time slice).
    long
    Get the timestamp if DAQ in streaming mode.
    int
    Get the length of this structure in bytes, including the header.
    boolean
    Did this object already have an error when first received from transport?
    boolean
    Did this object generate a non-fatal error while being built (still allows build to continue) ?
    boolean
    Is this object a control event?
    boolean
    Does this object represent a missing frame?
    boolean
    Is this object a first event?
    void
    isFirstEvent(boolean isFirst)
    Set whether this object a first event.
    boolean
    Is the DAQ triggering or streaming? This condition is set by the ROC and it is only read - never set.
    boolean
    Is this object is a sync event? This condition is set by the ROC and it is only read - never set.
    boolean
    Is this object a USER event type?
    boolean
    Does the source id match that of the input channel?
    void
    matchesId(boolean matchId)
    Set whether the source id matches that of the input channel.
    void
    Releases a ByteBuffer (if any) referenced by this object which was obtained from a ByteBufferSupply object.
    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.
    void
    Set the ByteBuffer object (containing evio data) referenced by this ring item if any.
    void
    Sets the input channel sequence used to get this item.
    void
    setChannelSequenceObj(com.lmax.disruptor.Sequence seq)
    Sets the input channel sequence object used to get this item.
    void
    Set the type of control event this is.
    void
    setEmptyFrame(boolean empty)
    Sets whether this object represents a missing frame.
    void
    setError(boolean hasError)
    Sets whether or not this object has an error.
    void
    setEvent(org.jlab.coda.jevio.EvioEvent event)
    Set the evio event object contained in this ring item.
    void
    setEventCount(int eventCount)
    Set the number of ROC events in this object's data.
    void
    Set the type of event (ROC raw, physics, user, control , etc) this is.
    void
    setFirstEventNumber(long firstEventNumber)
    Set the first event number in this object's data.
    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.
    void
    setNonFatalBuildingError(boolean nonFatalBuildingError)
    Sets whether or not this object generated a non-fatal error while being built.
    void
    setRecordId(int recordId)
    This method sets the record id.
    void
    setReusableByteBuffer(ByteBufferSupply byteBufferSupply, ByteBufferItem byteBufferItem)
    Set the objects needed to release (by calling releaseByteBuffer()) the referenced ByteBuffer when no longer needed.
    void
    setSourceId(int sourceId)
    If emu input channel is reading Roc Raw data, then this method sets the CODA id number of the source.
    void
    setSourceName(String sourceName)
    Set the name of the data input channel (from xml config file) which read the data into this object.
    void
    setStreaming(boolean sync)
    Sets whether DAQ triggering or streaming.
    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.
    void
    setSync(boolean sync)
    Sets whether or not this object is a sync event.
    void
    setTimeFrame(long frame)
    Sets the time frame number (sequential count of time slice).
    void
    setTimestamp(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

      void copy(RingItem ringItem)
      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

      void setBuffer(ByteBuffer buffer)
      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:
      true if control event, else false.
    • 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

      void setControlType(ControlType type)
      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:
      true if USEr event type, else false.
    • isFirstEvent

      boolean isFirstEvent()
      Is this object a first event?
      Returns:
      true if first event, else false.
    • isFirstEvent

      void isFirstEvent(boolean isFirst)
      Set whether this object a first event.
      Parameters:
      isFirst - true if first event, else false.
    • getEventType

      EventType getEventType()
      Get the type of event (ROC raw, physics, user, control , etc) this is.
      Returns:
      type of event this is.
    • setEventType

      void setEventType(EventType type)
      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:
      true if source id matches that of the input channel, else false.
    • matchesId

      void matchesId(boolean matchId)
      Set whether the source id matches that of the input channel.
      Parameters:
      matchId - true if source id matches that of the input channel, else false.
    • 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

      void setSourceName(String sourceName)
      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:
      true if this object is a sync event, else false.
    • 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 - true if this object is a sync event, else false.
    • hasError

      boolean hasError()
      Did this object already have an error when first received from transport?
      Returns:
      true if this object had an error when first received, else false.
    • setError

      void setError(boolean hasError)
      Sets whether or not this object has an error.
      Parameters:
      hasError - true if this object has an error, else false.
    • hasNonFatalBuildingError

      boolean hasNonFatalBuildingError()
      Did this object generate a non-fatal error while being built (still allows build to continue) ?
      Returns:
      true if this object generated a non-fatal build error, else false.
    • setNonFatalBuildingError

      void setNonFatalBuildingError(boolean nonFatalBuildingError)
      Sets whether or not this object generated a non-fatal error while being built.
      Parameters:
      nonFatalBuildingError - true if this object generate a non-fatal error while being built, else false.
    • 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

      void setReusableByteBuffer(ByteBufferSupply byteBufferSupply, ByteBufferItem byteBufferItem)
      Set the objects needed to release (by calling releaseByteBuffer()) the referenced ByteBuffer when no longer needed.
      Parameters:
      byteBufferSupply - object which supplied the ByteBuffer
      byteBufferItem - 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:
      true if DAQ is streaming, else false.
    • 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 - true if this DAQ is streaming, else false.
    • isEmptyFrame

      boolean isEmptyFrame()
      Does this object represent a missing frame?
      Returns:
      true if this object represents a missing frame, else false.
    • setEmptyFrame

      void setEmptyFrame(boolean empty)
      Sets whether this object represents a missing frame.
      Parameters:
      empty - true if this object represents a missing frame, else false.
    • 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 type
      first - is this a "first" or "beginning-of-run" event
      streaming - is DAQ streaming or triggered
      chanId - ID of data channel this method is called for
      rId - record ID
      sId - CODA ID of data source
      evCount - number of events in data
      sName - name of data source
      bbItem - ByteBufferItem object holding the ByteBuffer containing the data
      bbSupply - Supply object containing the ByteBufferItem