Constructor and Description |
---|
EtEventImpl(EtEventImpl ev)
Creates an event object by duplicating another.
|
EtEventImpl(int size)
Creates an event object for users of Java-based ET systems or by the
system itself.
|
Modifier and Type | Method and Description |
---|---|
org.jlab.coda.et.enums.Age |
getAge()
Gets the age of the event, either
Age.NEW if a new event obtained through
calling EtSystem.newEvents(EtAttachment, org.jlab.coda.et.enums.Mode, int, int, int)
or Age.USED if obtained through calling
EtSystem.getEvents(EtAttachment, org.jlab.coda.et.enums.Mode, org.jlab.coda.et.enums.Modify, int, int) . |
java.nio.ByteOrder |
getByteOrder()
Gets the event data's byte order.
|
int[] |
getControl()
Gets the event's control array.
|
byte[] |
getData()
Gets the data array which is backing the event's data buffer if there is one.
|
java.nio.ByteBuffer |
getDataBuffer()
Gets the event's data buffer.
|
org.jlab.coda.et.enums.DataStatus |
getDataStatus()
Gets the status of the data (set by the system), which can be OK
DataStatus.OK ,
corrupted DataStatus.CORRUPT , or possibly corrupted
DataStatus.POSSIBLYCORRUPT . |
int |
getDataStatusValue()
Get int value associated with DataStatus enum.
|
int |
getGroup()
Gets the group the event belongs to (1, 2, ...) if ET system events are divided into groups.
|
int |
getId()
Gets the event's id number.
|
int |
getLength()
Gets the length of the data in bytes.
|
int |
getMemSize()
Gets the size of the data buffer in bytes.
|
org.jlab.coda.et.enums.Modify |
getModify()
Gets the event's modify value when receiving it over the network.
|
int |
getOwner()
Gets the attachment id of the attachment which owns or got the event.
|
org.jlab.coda.et.enums.Priority |
getPriority()
Gets the event's priority, either high
Priority.HIGH or low Priority.LOW . |
int |
getPriorityValue()
Get int value associated with Priority enum.
|
int |
getRawByteOrder()
Gets the raw byte order data (0x04030201 or 0x01020304).
|
int |
getSizeLimit()
Gets the size limit of the data buffer in bytes when using a C-based ET system.
|
void |
init()
Initialize an event's fields.
|
boolean |
needToSwap()
Tells caller if the event data needs to be swapped in order to be the
same byte order as the local JVM.
|
void |
setAge(org.jlab.coda.et.enums.Age age)
Sets the age of the event which is
Age.NEW for new events obtained by calling
EtSystem.newEvents(EtAttachment, org.jlab.coda.et.enums.Mode, int, int, int) ),
or Age.NEW for "used" event obtained by calling
EtSystem.getEvents(EtAttachment, org.jlab.coda.et.enums.Mode, org.jlab.coda.et.enums.Modify, int, int) ). |
void |
setByteOrder(java.nio.ByteOrder order)
Set the event data's byte order.
|
void |
setByteOrder(int endian)
Set the event data's byte order by using values consistent with C-based ET systems,
EtConstants.endianBig , EtConstants.endianLittle , EtConstants.endianLocal ,
EtConstants.endianNotLocal , or EtConstants.endianSwitch . |
void |
setControl(int[] con)
Sets the event's control array by copying it into the event.
|
void |
setData(byte[] data)
Sets the event's data without copying.
|
void |
setDataBuffer(java.nio.ByteBuffer dataBuffer)
Sets the event's data buffer (must be backed by data array).
|
void |
setDataStatus(org.jlab.coda.et.enums.DataStatus status)
Sets the event's data status.
|
void |
setGroup(int group)
Sets the group the event belongs to: (1, 2, ...) if ET system events are divided into groups,
or group = 1 if not.
|
void |
setId(int id)
Sets the event's id number.
|
void |
setLength(int len)
Sets the event's data length in bytes.
|
void |
setLengthFromServer(int len)
Set the length of valid data from server where sizeLimit may be 0.
|
void |
setMemSize(int memSize)
Sets the size of the data buffer in bytes.
|
void |
setModify(org.jlab.coda.et.enums.Modify modify)
Sets whether the user wants to read the event only, will modify only the event header
(everything except the data), or will modify the data and/or header.
|
void |
setOwner(int owner)
Sets the owner of the event (attachment using event or system).
|
void |
setPriority(org.jlab.coda.et.enums.Priority pri)
Sets the event's priority, either high
Priority.HIGH or low Priority.LOW . |
void |
setRawByteOrder(int byteOrder)
Set the event data's byte order as big with 0x04030201 or
as little with 0x01020304.
|
public EtEventImpl(int size)
size
- size of the data array in bytespublic EtEventImpl(EtEventImpl ev)
ev
- event to duplicatepublic void init()
public int getId()
public org.jlab.coda.et.enums.Age getAge()
Age.NEW
if a new event obtained through
calling EtSystem.newEvents(EtAttachment, org.jlab.coda.et.enums.Mode, int, int, int)
or Age.USED
if obtained through calling
EtSystem.getEvents(EtAttachment, org.jlab.coda.et.enums.Mode, org.jlab.coda.et.enums.Modify, int, int)
.public int getGroup()
public org.jlab.coda.et.enums.Priority getPriority()
Priority.HIGH
or low Priority.LOW
.
Low priority is normal while high priority events get placed at the front of stations'
input and output event lists.getPriority
in interface EtEvent
public int getPriorityValue()
public int getOwner()
EtConstants.system
.getOwner
in interface EtEvent
EtConstants.system
if system owns itpublic int getLength()
public int getMemSize()
getMemSize
in interface EtEvent
public int getSizeLimit()
public org.jlab.coda.et.enums.DataStatus getDataStatus()
DataStatus.OK
,
corrupted DataStatus.CORRUPT
, or possibly corrupted
DataStatus.POSSIBLYCORRUPT
. Data is OK by default, it is never labeled
as corrupt but can be labeled as possible corrupt if the process owning an
event crashes and the system recovers it.getDataStatus
in interface EtEvent
public int getDataStatusValue()
public org.jlab.coda.et.enums.Modify getModify()
Modify.ANYTHING
, modifying only the header
is Modify.HEADER
, else the default assumed, Modify.NOTHING
,
is that nothing is modified resulting in this event being put back into
the ET system (by remote server) immediately upon being copied and that copy
sent to the user.public java.nio.ByteOrder getByteOrder()
getByteOrder
in interface EtEvent
public int getRawByteOrder()
getRawByteOrder
in interface EtEvent
public int[] getControl()
getControl
in interface EtEvent
public byte[] getData() throws java.lang.UnsupportedOperationException
public java.nio.ByteBuffer getDataBuffer()
getDataBuffer
in interface EtEvent
public void setId(int id)
id
- event's id numberpublic void setAge(org.jlab.coda.et.enums.Age age)
Age.NEW
for new events obtained by calling
EtSystem.newEvents(EtAttachment, org.jlab.coda.et.enums.Mode, int, int, int)
),
or Age.NEW
for "used" event obtained by calling
EtSystem.getEvents(EtAttachment, org.jlab.coda.et.enums.Mode, org.jlab.coda.et.enums.Modify, int, int)
).age
- age of the eventpublic void setGroup(int group)
group
- group the event belongs topublic void setPriority(org.jlab.coda.et.enums.Priority pri)
Priority.HIGH
or low Priority.LOW
.
Low priority is normal while high priority events get placed at the front of stations'
input and output event lists.setPriority
in interface EtEvent
pri
- event prioritypublic void setOwner(int owner)
owner
- owner of event (attachment using event or system)public void setLength(int len) throws org.jlab.coda.et.exception.EtException
public void setLengthFromServer(int len) throws org.jlab.coda.et.exception.EtException
len
- length of valid dataorg.jlab.coda.et.exception.EtException
- if len is negativepublic void setMemSize(int memSize)
memSize
- size of the data buffer in bytespublic void setDataStatus(org.jlab.coda.et.enums.DataStatus status)
DataStatus.OK
which is the default,
corrupted DataStatus.CORRUPT
which is never used actually, or possibly corrupted
DataStatus.POSSIBLYCORRUPT
which occurs when a process holding the event crashes
and the system recovers it.status
- data statuspublic void setModify(org.jlab.coda.et.enums.Modify modify)
Modify.ANYTHING
, modifying only the header
is Modify.HEADER
, else the default assumed, Modify.NOTHING
,
is that nothing is modified resulting in this event being put back into
the ET system (by remote server) immediately upon being copied and that copy
sent to the user.modify
- public void setByteOrder(int endian) throws org.jlab.coda.et.exception.EtException
EtConstants.endianBig
, EtConstants.endianLittle
, EtConstants.endianLocal
,
EtConstants.endianNotLocal
, or EtConstants.endianSwitch
.setByteOrder
in interface EtEvent
endian
- endian valueorg.jlab.coda.et.exception.EtException
- if argument is a bad valuepublic void setByteOrder(java.nio.ByteOrder order)
setByteOrder
in interface EtEvent
order
- data's byte orderpublic void setRawByteOrder(int byteOrder) throws org.jlab.coda.et.exception.EtException
setRawByteOrder
in interface EtEvent
byteOrder
- data's byte order as big with 0x04030201 or
as little with 0x01020304.org.jlab.coda.et.exception.EtException
public void setControl(int[] con) throws org.jlab.coda.et.exception.EtException
setControl
in interface EtEvent
con
- control arrayorg.jlab.coda.et.exception.EtException
- if control array has the wrong number of elementspublic void setData(byte[] data)
data
- data arraypublic void setDataBuffer(java.nio.ByteBuffer dataBuffer)
dataBuffer
- event's data buffer (must be backed by data array)public boolean needToSwap()
needToSwap
in interface EtEvent
true
if swapping is needed, otherwise false