abstract class RingItemAdapter extends java.lang.Object implements RingItem
PayloadBuffer
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
attachment
Associated object used to store things.
|
protected java.nio.ByteBuffer |
buffer
ByteBuffer to wrap.
|
protected ByteBufferItem |
byteBufferItem
This refers to the wrapper object of buffer in reusable ByteBufferSupply (if any).
|
protected ByteBufferSupply |
byteBufferSupply
This refers to a supply of reusable ByteBuffers from which buffer came (if any).
|
protected ControlType |
controlType
If this is a control event, what type of control is it (SYNC, GO, END, ...)?
|
protected org.jlab.coda.jevio.EvioEvent |
event
Event to wrap.
|
protected int |
eventCount
The number of CODA events (triggers) contained in this evio bank.
|
protected EventType |
eventType
What type of CODA events are contained in this bank (RocRaw, Physics, Control, User, ...)?
Only one type is stored in one RingItem object.
|
protected long |
firstEventNumber
The event number of the first CODA event in this evio bank.
|
protected boolean |
hasError
Has error? from ROC raw data record 4-bit status.
|
protected boolean |
isFirst
Is this USER event also a "first event" to be written in each file split?
|
protected boolean |
isSync
Is sync bank? from ROC raw data record 4-bit status.
|
protected boolean |
isUser
Is this a USER event type?
|
protected boolean |
matchesId
Does sourceId match id of input channel?
|
protected org.jlab.coda.jevio.EvioNode |
node
Object containing info about specific evio event in the buffer.
|
protected boolean |
nonFatalBuildingError
Was there an non-fatal error generated while trying to build an event?
|
protected int |
recordId
If the event type is RocRaw or Physics, this is the record id of this CODA events.
|
protected boolean |
reserved
Reserved.
|
protected int |
sourceId
If the event type is RocRaw, this is the CODA id of the source.
|
protected java.lang.String |
sourceName
The name of the source of these CODA events.
|
protected boolean |
switchRing
When reading from multiple rings, is it time to change to next ring?
|
Constructor and Description |
---|
RingItemAdapter()
Constructor.
|
RingItemAdapter(int nodeArraySize)
Constructor.
|
RingItemAdapter(RingItem ringItem)
Copy constructor which copies references and doesn't clone.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
void |
copy(RingItem ringItem)
Copy members of argument into this object (except for "reserved").
|
java.lang.Object |
getAttachment()
This method gets an attached object.
|
java.nio.ByteBuffer |
getBuffer()
Get the ByteBuffer object (containing evio data) referenced by this ring item if any.
|
ByteBufferItem |
getByteBufferItem()
Get the ByteBufferItem object used to wrap the referenced ByteBuffer (if any).
|
ByteBufferSupply |
getByteBufferSupply()
Get the ByteBufferSupply object used to create the referenced ByteBuffer (if any).
|
abstract java.nio.ByteOrder |
getByteOrder()
Get the byte order of the data contained in this object.
|
ControlType |
getControlType()
If this is control event, this method returns the type of
control event, otherwise it returns null.
|
org.jlab.coda.jevio.EvioEvent |
getEvent()
Get the evio event object contained in this ring item if any.
|
int |
getEventCount()
Get the number of ROC events in this object's data.
|
EventType |
getEventType()
Get the type of event (ROC raw, physics, user, control , etc) this is.
|
long |
getFirstEventNumber()
Get the first event number in this object's data.
|
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.
|
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.
|
int |
getSourceId()
If emu input channel is reading ROC raw data, then this method
gets the CODA id number of the source.
|
java.lang.String |
getSourceName()
Get the name of the data input channel (from xml config file)
which read the data into this object.
|
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.
|
abstract int |
getTotalBytes()
Get the length of this structure in bytes, including the header.
|
boolean |
hasError()
Did this object already have an error when first received from transport?
|
boolean |
hasNonFatalBuildingError()
Did this object generate a non-fatal error while being built
(still allows build to continue) ?
|
boolean |
isControlEvent()
Is this object a control event?
|
boolean |
isFirstEvent()
Is this object a first event?
|
void |
isFirstEvent(boolean isFirst)
Set whether this object a first event.
|
boolean |
isSync()
Is this object is a sync event?
This condition is set by the ROC and it is only read - never set.
|
boolean |
isUser()
Is this object a USER event type?
|
void |
isUser(boolean isUser) |
boolean |
matchesId()
Does the source id match that of the input channel?
|
void |
matchesId(boolean matchesId)
Set whether the source id matches that of the input channel.
|
void |
releaseByteBuffer()
Releases a ByteBuffer (if any) referenced by this object which was obtained
from a ByteBufferSupply object.
|
void |
setAll(org.jlab.coda.jevio.EvioEvent ev,
java.nio.ByteBuffer buf,
org.jlab.coda.jevio.EvioNode nd,
EventType eType,
ControlType cType,
boolean user,
boolean first,
int chanId,
int rId,
int sId,
int evCount,
java.lang.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 |
setAttachment(java.lang.Object attachment)
This method sets an attached object.
|
void |
setBuffer(java.nio.ByteBuffer buffer)
Set the ByteBuffer object (containing evio data) referenced by this ring item if any.
|
void |
setControlType(ControlType type)
Set the type of control event this is.
|
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 |
setEventType(EventType type)
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
RingItem.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(java.lang.String sourceName)
Set the name of the data input channel (from xml config file)
which read the data into this object.
|
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.
|
protected org.jlab.coda.jevio.EvioEvent event
protected java.nio.ByteBuffer buffer
protected org.jlab.coda.jevio.EvioNode node
protected EventType eventType
protected ControlType controlType
protected boolean isUser
protected boolean isFirst
protected int sourceId
protected boolean matchesId
protected java.lang.String sourceName
protected int recordId
protected int eventCount
protected long firstEventNumber
protected boolean switchRing
protected boolean isSync
protected boolean hasError
protected boolean reserved
protected boolean nonFatalBuildingError
protected java.lang.Object attachment
protected ByteBufferSupply byteBufferSupply
protected ByteBufferItem byteBufferItem
public RingItemAdapter()
public RingItemAdapter(int nodeArraySize)
nodeArraySize
- number of EvioNode objects to create in pool.public RingItemAdapter(RingItem ringItem)
ringItem
- ring item to copypublic void copy(RingItem ringItem)
public abstract java.nio.ByteOrder getByteOrder()
getByteOrder
in interface RingItem
public abstract int getTotalBytes()
getTotalBytes
in interface RingItem
public void setAll(org.jlab.coda.jevio.EvioEvent ev, java.nio.ByteBuffer buf, org.jlab.coda.jevio.EvioNode nd, EventType eType, ControlType cType, boolean user, boolean first, int chanId, int rId, int sId, int evCount, java.lang.String sName, ByteBufferItem bbItem, ByteBufferSupply bbSupply)
setAll
in interface RingItem
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" eventchanId
- 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 ByteBufferItempublic org.jlab.coda.jevio.EvioEvent getEvent()
public void setEvent(org.jlab.coda.jevio.EvioEvent event)
public java.nio.ByteBuffer getBuffer()
RingItem.getNode()
}.public void setBuffer(java.nio.ByteBuffer buffer)
RingItem.setNode(org.jlab.coda.jevio.EvioNode)
}.public org.jlab.coda.jevio.EvioNode getNode()
RingItem.getBuffer()
}.public void setNode(org.jlab.coda.jevio.EvioNode node)
RingItem.setBuffer(java.nio.ByteBuffer)
}.public void releaseByteBuffer()
releaseByteBuffer
in interface RingItem
public void setReusableByteBuffer(ByteBufferSupply byteBufferSupply, ByteBufferItem byteBufferItem)
RingItem.releaseByteBuffer()
)
the referenced ByteBuffer when no longer needed.setReusableByteBuffer
in interface RingItem
byteBufferSupply
- object which supplied the ByteBufferbyteBufferItem
- object wrapping ByteBuffer in the supplypublic ByteBufferSupply getByteBufferSupply()
getByteBufferSupply
in interface RingItem
public ByteBufferItem getByteBufferItem()
getByteBufferItem
in interface RingItem
public java.lang.Object getAttachment()
getAttachment
in interface Attached
public void setAttachment(java.lang.Object attachment)
setAttachment
in interface Attached
attachment
- the object to attach.public boolean isControlEvent()
isControlEvent
in interface RingItem
true
if control event, else false
.public ControlType getControlType()
getControlType
in interface RingItem
public void setControlType(ControlType type)
setControlType
in interface RingItem
type
- type of control event this is.public boolean isUser()
public void isUser(boolean isUser)
public boolean isFirstEvent()
isFirstEvent
in interface RingItem
true
if first event, else false
.public void isFirstEvent(boolean isFirst)
isFirstEvent
in interface RingItem
isFirst
- true
if first event, else false
.public EventType getEventType()
getEventType
in interface RingItem
public void setEventType(EventType type)
setEventType
in interface RingItem
type
- type of event this is.public int getSourceId()
getSourceId
in interface RingItem
public void setSourceId(int sourceId)
setSourceId
in interface RingItem
sourceId
- CODA id number of input Roc Raw data source.public boolean matchesId()
public void matchesId(boolean matchesId)
public int getRecordId()
getRecordId
in interface RingItem
public void setRecordId(int recordId)
setRecordId
in interface RingItem
recordId
- the record idpublic java.lang.String getSourceName()
getSourceName
in interface RingItem
public void setSourceName(java.lang.String sourceName)
setSourceName
in interface RingItem
sourceName
- name of the data input channel from xml config file.public int getEventCount()
getEventCount
in interface RingItem
public void setEventCount(int eventCount)
setEventCount
in interface RingItem
eventCount
- number of ROC events in this object's data.public long getFirstEventNumber()
getFirstEventNumber
in interface RingItem
public void setFirstEventNumber(long firstEventNumber)
setFirstEventNumber
in interface RingItem
firstEventNumber
- first event number in this object's data.public boolean getSwitchRing()
getSwitchRing
in interface RingItem
public void setSwitchRing(boolean switchRing)
setSwitchRing
in interface RingItem
switchRing
- true if time to switch ring being read, else false.public boolean isSync()
public void setSync(boolean sync)
public boolean hasError()
public void setError(boolean hasError)
public boolean hasNonFatalBuildingError()
hasNonFatalBuildingError
in interface RingItem
true
if this object generated a non-fatal build error, else false
.public void setNonFatalBuildingError(boolean nonFatalBuildingError)
setNonFatalBuildingError
in interface RingItem
nonFatalBuildingError
- true
if this object generate a non-fatal
error while being built, else false
.public java.lang.Object clone()
clone
in class java.lang.Object