|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jlab.coda.et.Event
This class defines an ET event.
| Field Summary | |
(package private) int |
age
Specifies whether the event was obtained as a new event (through newEvents), or as a "used" event (through getEvents). |
(package private) int |
byteOrder
An integer used to keep track of the data's byte ordering. |
(package private) int[] |
control
An array of integers normally used by stations to filter events out of their input lists. |
(package private) byte[] |
data
The event data is stored here. |
(package private) int |
dataStatus
Status of the data. |
(package private) int |
id
Unique id number. |
(package private) boolean |
isJava
Flag specifying whether the ET system process is Java based or not. |
(package private) int |
length
Length of the valid data in bytes. |
(package private) int |
memSize
Size of the data buffer in bytes. |
(package private) int |
modify
Specifies whether the user wants to read the event only, will modify only the event header, or will modify the data. |
(package private) int |
owner
The attachment id which owns or got the event. |
(package private) int |
priority
Event priority which is either high Constants.high or low
Constants.low. |
(package private) int |
sizeLimit
Size limit of events' data buffers in bytes. |
| Constructor Summary | |
(package private) |
Event(int size)
Creates an event object for users of Java-based ET systems or by the system itself. |
(package private) |
Event(int size,
int limit,
boolean isJavaSystem)
Creates an event object for ET system users. |
| Method Summary | |
static int |
bytesToInt(byte[] b,
int off)
Converts 4 bytes of a byte array into an integer. |
static short |
bytesToShort(byte[] b,
int off)
Converts 2 bytes of a byte array into a short. |
void |
codaSwap()
Swaps data that is in the CODA format only. |
byte[] |
copyData()
Gets the event's data array. |
void |
copyDataIn(byte[] dat)
Set the event's data by copying it in. |
void |
copyDataIn(byte[] dat,
int srcOff,
int destOff,
int len)
Set the event's data by copying it in. |
int |
getByteOrder()
Gets the event's byte order - either Constants.endianBig or
Constants.endianLittle. |
int[] |
getControl()
Gets the event's control array. |
byte[] |
getData()
Gets the event's data array. |
int |
getDataStatus()
Gets the status of the data. |
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. |
int |
getModify()
Gets the event's modify value. |
int |
getPriority()
Gets the event's priority. |
int |
getSizeLimit()
Gets the size limit of the data buffer in bytes when using a C-based ET system. |
(package private) void |
init()
Initialize an event's fields. |
static void |
intToBytes(int intVal,
byte[] b,
int off)
Copies an integer value into 4 bytes of a byte array. |
boolean |
needToSwap()
Tells caller if the event data needs to be swapped in order to be the correct byte order. |
void |
setByteOrder(int endian)
Set the event's byte order. |
void |
setControl(int[] con)
Sets the event's control array by copying it in. |
void |
setData(byte[] dat)
Sets the event's data without copying. |
void |
setDataStatus(int status)
Sets the event's data status. |
void |
setLength(int len)
Sets the event's data length in bytes. |
void |
setPriority(int pri)
Sets the event's priority. |
static void |
shortToBytes(short shortVal,
byte[] b,
int off)
Copies a short value into 2 bytes of a byte array. |
static void |
swapArrayInt(byte[] b,
int off)
Swaps 4 bytes of a byte array in place. |
static void |
swapArrayShort(byte[] b,
int off)
Swaps 2 bytes of a byte array in place. |
static int |
swapInt(int n)
Swaps the byte order of an integer. |
static short |
swapShort(short n)
Swaps the byte order of a short. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
int id
int age
Constants.eventNew otherwise
Constants.eventUsed.
int priority
Constants.high or low
Constants.low.
int owner
Constants.system.
int length
int memSize
int sizeLimit
int dataStatus
Constants.dataOk, corrupted
Constants.dataCorrupt, or possibly corrupted
Constants.dataPossiblyCorrupt.
int byteOrder
int modify
int[] control
byte[] data
boolean isJava
| Constructor Detail |
Event(int size)
size - size of the data array in bytes
Event(int size,
int limit,
boolean isJavaSystem)
size - size of the data array in bytes.limit - limit on the size of the data array in bytes. Only used
for C-based ET systems.isJavaSystem - is ET system Java based?| Method Detail |
void init()
public int getId()
public int getPriority()
public int getLength()
public int getMemSize()
public int getSizeLimit()
public int getDataStatus()
public int getModify()
public int[] getControl()
public byte[] getData()
public byte[] copyData()
public void setData(byte[] dat)
throws EtException
dat - data array
EtException
public void copyDataIn(byte[] dat)
throws EtException
dat - data array
EtException - if the data array is the wrong size
public void copyDataIn(byte[] dat,
int srcOff,
int destOff,
int len)
throws EtException
dat - data arraysrcOff - offset in "dat" byte arraydestOff - offset in the event's byte arraylen - bytes of data to copy
EtException - if the data array is the wrong size
public void setPriority(int pri)
throws EtException
pri - event priority
EtException - if argument is a bad value
public void setLength(int len)
throws EtException
len - data length
EtException - if length is less than zero
public void setControl(int[] con)
throws EtException
con - control array
EtException - if control array has the wrong number of elements
public void setDataStatus(int status)
throws EtException
status - data status
EtException - if argument is a bad valuepublic int getByteOrder()
Constants.endianBig or
Constants.endianLittle.
public void setByteOrder(int endian)
throws EtException
Constants.endianBig,
Constants.endianLittle, Constants.endianLocal,
Constants.endianNotLocal, or Constants.endianSwitch
endian - endian value
EtException - if argument is a bad value
public boolean needToSwap()
throws EtException
true if swapping is needed, otherwise false
EtException - if the byte order has a bad valuepublic void codaSwap()
public static final int swapInt(int n)
n - integer to be swapped
public static final short swapShort(short n)
n - short to be swapped
public static final int bytesToInt(byte[] b,
int off)
b - byte arrayoff - offset into the byte array (0 = start at first element)
public static final void intToBytes(int intVal,
byte[] b,
int off)
intVal - integer valueb - byte arrayoff - offset into the byte array
public static final void swapArrayInt(byte[] b,
int off)
b - byte arrayoff - offset into the byte array
public static final short bytesToShort(byte[] b,
int off)
b - byte arrayoff - offset into the byte array (0 = start at first element)
public static final void shortToBytes(short shortVal,
byte[] b,
int off)
shortVal - short valueb - byte arrayoff - offset into the byte array
public static final void swapArrayShort(byte[] b,
int off)
b - byte arrayoff - offset into the byte array
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||