public class EtContainer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
EtContainer.MethodType
Keep track of whether we're setup to do a
newEvents(), getEvents(), putEvents(), or dumpEvents().
|
Modifier and Type | Field and Description |
---|---|
(package private) EtAttachment |
att
Attachment to ET system used to make, get, put, and dump events.
|
(package private) org.jlab.coda.et.system.AttachmentLocal |
attLocal
Local attachment to ET system used to make, get, put, and dump events.
|
(package private) byte[] |
byteArray
Array used in newEvents(), getEvents(), putEvents(), or dumpEvents()
for any purpose.
|
(package private) int |
count
Number of events asked for in newEvents() or getEvents().
|
(package private) int |
eventCount
Number of valid events when getting event array for newEvents and getEvents.
|
(package private) int |
group
Group number from which to get events in newEvents().
|
(package private) EtEventImpl[] |
holdEvents
Place to store references to events being put/dumped using JNI with local calls.
|
(package private) int |
length
When doing put/dumpEvents, number of events to put/dump.
|
(package private) EtContainer.MethodType |
method
The method this container is set to deal with.
|
(package private) int |
microSec
Timeout in microseconds used when obtaining events with newEvents() or getEvents().
|
(package private) org.jlab.coda.et.enums.Mode |
mode
Mode used to obtain events with newEvents() or getEvents().
|
(package private) org.jlab.coda.et.enums.Modify |
modify
Modify used to obtain events with getEvents().
|
(package private) int |
offset
When doing put/dumpEvents, offset into event array arg.
|
(package private) EtEventImpl[] |
putDumpEvents
Reference to events being put/dumped using normal calls.
|
(package private) EtEventImpl[] |
realEvents
Actual ET events with buffers/real memory.
|
(package private) int |
size
Size in bytes of events asked for in newEvents().
|
Constructor and Description |
---|
EtContainer(int eventSize)
Constructor.
|
EtContainer(int count,
int eventSize)
Constructor specifying the number and size of internal buffers
which are then created and initialized.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
adjustByteArraySize(int neededBytes)
Make sure the byte array has at least the given amount of bytes.
|
void |
dumpEvents(org.jlab.coda.et.system.AttachmentLocal att)
This method is for expert use only!
Set this container up for dumping events back into an ET system.
|
void |
dumpEvents(EtAttachment att,
int offset,
int length)
Set this container up for dumping events back into an ET system.
|
EtAttachment |
getAtt()
Get the attachment to ET system.
|
org.jlab.coda.et.system.AttachmentLocal |
getAttLocal()
If ET is java-based in this JVM, attachment to it.
|
int |
getCount()
Get the number of events asked for in newEvents() or getEvents().
|
int |
getEtEventSize()
Get the size of ET system events in bytes.
|
EtEvent[] |
getEventArray()
Get an array containing events resulting from a call to
newEvents(EtAttachment, Mode, int, int, int, int) or
getEvents(EtAttachment, Mode, Modify, int, int) . |
EtEventImpl[] |
getEventArrayLocal()
Get an array containing events resulting from a call to
newEvents(AttachmentLocal, int, int, int, int, int) or
getEvents(AttachmentLocal, int, int, int) . |
int |
getEventCount()
Get the number of valid events resulting from a call to newEvents or getEvents.
|
void |
getEvents(org.jlab.coda.et.system.AttachmentLocal att,
int modeVal,
int microSec,
int count)
This method is for expert use only!
Set this container up for getting events from an ET system.
|
void |
getEvents(EtAttachment att,
org.jlab.coda.et.enums.Mode mode,
org.jlab.coda.et.enums.Modify modify,
int microSec,
int count)
Set this container up for getting events from an ET system.
|
void |
getEvents(EtAttachment att,
org.jlab.coda.et.enums.Mode mode,
org.jlab.coda.et.enums.Modify modify,
int microSec,
int count,
boolean allocate)
Set this container up for getting events from an ET system.
|
int |
getGroup()
Get the group number from which to get events in newEvents().
|
EtEventImpl[] |
getHoldEvents()
Get the array used to store references to events being put/dumped using JNI with local calls.
|
int |
getLastIndex()
Get the index of the last valid event in the array of the events being put.
|
EtContainer.MethodType |
getMethod()
Get variable keeping track of whether we're setup to do a
newEvents(), getEvents(), putEvents(), or dumpEvents().
|
int |
getMicroSec()
Get the timeout in microseconds used when obtaining
events with newEvents() or getEvents().
|
org.jlab.coda.et.enums.Mode |
getMode()
Get the mode used to obtain events with newEvents() or getEvents().
|
int |
getSize()
Get the size in bytes of events asked for in newEvents().
|
boolean |
hasEndEvent()
Get whether the events being put contain the END event.
|
void |
holdLocalEvents(EtEventImpl[] evs)
This method is NOT for general use! Experts only!
Take the events obtained in
SystemCreate.getEvents(EtContainer)
and assign them to local storage. |
void |
holdLocalEvents(java.util.List<EtEventImpl> list)
This method is NOT for general use! Experts only!
Take the new events obtained in
SystemCreate.newEvents(EtContainer)
and assign them to local storage. |
(package private) void |
holdNewEvents(EtEventImpl[] evs)
Take the new events obtained in
EtSystem.newEvents(EtContainer) or
EtSystem.getEvents(EtContainer) and assign them to local storage. |
(package private) void |
holdNewEvents(EtEventImpl[] evs,
int len)
Take the new events obtained in
EtSystem.newEvents(EtContainer) or
EtSystem.getEvents(EtContainer) and assign them to local storage. |
void |
newEvents(org.jlab.coda.et.system.AttachmentLocal att,
int modeVal,
int microSec,
int count,
int size,
int group)
This method is for expert use only!
Set this container up for getting new (unused) events from a specified group
of such events in an ET system.
|
void |
newEvents(EtAttachment att,
org.jlab.coda.et.enums.Mode mode,
int microSec,
int count,
int size,
int group)
Set this container up for getting new (unused) events from a specified group
of such events in an ET system.
|
void |
newEvents(EtAttachment att,
org.jlab.coda.et.enums.Mode mode,
int microSec,
int count,
int size,
int group,
boolean allocate)
Set this container up for getting new (unused) events from a specified group
of such events in an ET system.
|
void |
putEvents(org.jlab.coda.et.system.AttachmentLocal att)
This method is for expert use only!
Set this container up for putting (used) events back into an ET system.
|
void |
putEvents(EtAttachment att,
int offset,
int length)
Set this container up for putting (used) events back into an ET system.
|
void |
setHasEndEvent(boolean index)
Set whether the events being put contain the END event.
|
void |
setLastIndex(int index)
Set the index of the last valid event in the array of the events being put.
|
EtContainer.MethodType method
int eventCount
EtEventImpl[] realEvents
EtEventImpl[] putDumpEvents
EtEventImpl[] holdEvents
int offset
int length
EtAttachment att
org.jlab.coda.et.system.AttachmentLocal attLocal
byte[] byteArray
org.jlab.coda.et.enums.Modify modify
org.jlab.coda.et.enums.Mode mode
int microSec
int count
int size
int group
public EtContainer(int eventSize) throws org.jlab.coda.et.exception.EtException
eventSize
- ET system event size in bytes.org.jlab.coda.et.exception.EtException
- if eventSize < 1.public EtContainer(int count, int eventSize) throws org.jlab.coda.et.exception.EtException
count
- number of internal buffers/events.eventSize
- ET system event size in bytes.org.jlab.coda.et.exception.EtException
- if either arg < 1.public int getEtEventSize()
public EtAttachment getAtt()
public org.jlab.coda.et.system.AttachmentLocal getAttLocal()
public org.jlab.coda.et.enums.Mode getMode()
public int getCount()
public int getSize()
public int getGroup()
public int getMicroSec()
public EtEventImpl[] getHoldEvents()
public EtContainer.MethodType getMethod()
public void newEvents(EtAttachment att, org.jlab.coda.et.enums.Mode mode, int microSec, int count, int size, int group) throws org.jlab.coda.et.exception.EtException
att
- attachment object.mode
- if there are no new events available, this parameter specifies
whether to wait for some by sleeping Mode.SLEEP
,
to wait for a set time Mode.TIMED
,
or to return immediately Mode.ASYNC
.microSec
- the number of microseconds to wait if a timed wait is specified.count
- the number of events desired .size
- the size of events in bytes.group
- group number from which to draw new events. Some ET systems have
unused events divided into groups whose numbering starts at 1.
For ET system not so divided, all events belong to group 1.org.jlab.coda.et.exception.EtException
- if arguments have bad values;
if attachment object is invalid;public void newEvents(EtAttachment att, org.jlab.coda.et.enums.Mode mode, int microSec, int count, int size, int group, boolean allocate) throws org.jlab.coda.et.exception.EtException
att
- attachment object.mode
- if there are no new events available, this parameter specifies
whether to wait for some by sleeping Mode.SLEEP
,
to wait for a set time Mode.TIMED
,
or to return immediately Mode.ASYNC
.microSec
- the number of microseconds to wait if a timed wait is specified.count
- the number of events desired .size
- the size of events in bytes.group
- group number from which to draw new events. Some ET systems have
unused events divided into groups whose numbering starts at 1.
For ET system not so divided, all events belong to group 1.allocate
- if true, allocate new objects in which to store the new events.org.jlab.coda.et.exception.EtException
- if arguments have bad values;
if attachment object is invalid;public void newEvents(org.jlab.coda.et.system.AttachmentLocal att, int modeVal, int microSec, int count, int size, int group) throws org.jlab.coda.et.exception.EtException
att
- local attachment object.modeVal
- if there are no new events available, this parameter specifies
whether to wait for some by sleeping EtConstants.sleep
,
to wait for a set time EtConstants.timed
,
or to return immediately EtConstants.async
.microSec
- the number of microseconds to wait if a timed wait is specified.count
- the number of events desired .size
- the size of events in bytes.group
- group number from which to draw new events. Some ET systems have
unused events divided into groups whose numbering starts at 1.
For ET system not so divided, all events belong to group 1.org.jlab.coda.et.exception.EtException
- if arguments have bad values;public void getEvents(EtAttachment att, org.jlab.coda.et.enums.Mode mode, org.jlab.coda.et.enums.Modify modify, int microSec, int count) throws org.jlab.coda.et.exception.EtException
att
- attachment object.mode
- if there are no events available, this parameter specifies
whether to wait for some by sleeping Mode.SLEEP
,
to wait for a set time Mode.TIMED
,
or to return immediately Mode.ASYNC
.modify
- this specifies whether this application plans
on modifying the data in events obtained Modify.ANYTHING
, or
only modifying headers Modify.HEADER
. The default assumed ,Modify.NOTHING
,
means that no values are modified resulting in the events being put back into
the ET system (by remote server) immediately upon being copied and that copy
sent to this method's caller.microSec
- the number of microseconds to wait if a timed wait is specified.count
- the number of events desired.org.jlab.coda.et.exception.EtException
- if arguments have bad values;
if the attachment's station is GRAND_CENTRAL;
if the attachment object is invalid;public void getEvents(EtAttachment att, org.jlab.coda.et.enums.Mode mode, org.jlab.coda.et.enums.Modify modify, int microSec, int count, boolean allocate) throws org.jlab.coda.et.exception.EtException
att
- attachment object.mode
- if there are no events available, this parameter specifies
whether to wait for some by sleeping Mode.SLEEP
,
to wait for a set time Mode.TIMED
,
or to return immediately Mode.ASYNC
.modify
- this specifies whether this application plans
on modifying the data in events obtained Modify.ANYTHING
, or
only modifying headers Modify.HEADER
. The default assumed ,Modify.NOTHING
,
means that no values are modified resulting in the events being put back into
the ET system (by remote server) immediately upon being copied and that copy
sent to this method's caller.microSec
- the number of microseconds to wait if a timed wait is specified.count
- the number of events desired.allocate
- if true, allocate new objects in which to store the new events.org.jlab.coda.et.exception.EtException
- if arguments have bad values;
if the attachment's station is GRAND_CENTRAL;
if the attachment object is invalid;public void getEvents(org.jlab.coda.et.system.AttachmentLocal att, int modeVal, int microSec, int count) throws org.jlab.coda.et.exception.EtException
att
- local attachment object.modeVal
- if there are no new events available, this parameter specifies
whether to wait for some by sleeping EtConstants.sleep
,
to wait for a set time EtConstants.timed
,
or to return immediately EtConstants.async
.microSec
- the number of microseconds to wait if a timed wait is specified.count
- the number of events desired.org.jlab.coda.et.exception.EtException
- if arguments have bad values;
if the attachment's station is GRAND_CENTRAL;
if the attachment object is invalid;public void putEvents(EtAttachment att, int offset, int length) throws org.jlab.coda.et.exception.EtException
att
- attachment objectoffset
- offset into arraylength
- number of array elements to putorg.jlab.coda.et.exception.EtException
- if invalid arg(s);
if events are not owned by this attachment;public void putEvents(org.jlab.coda.et.system.AttachmentLocal att) throws org.jlab.coda.et.exception.EtException
att
- local attachment objectorg.jlab.coda.et.exception.EtException
- if invalid arg(s);
if events are not owned by this attachment;public void dumpEvents(EtAttachment att, int offset, int length) throws org.jlab.coda.et.exception.EtException
att
- attachment objectoffset
- offset into arraylength
- number of array elements to putorg.jlab.coda.et.exception.EtException
- if invalid arg(s);
if events are not owned by this attachment;public void dumpEvents(org.jlab.coda.et.system.AttachmentLocal att) throws org.jlab.coda.et.exception.EtException
att
- local attachment objectorg.jlab.coda.et.exception.EtException
- if invalid arg(s);
if events are not owned by this attachment;void holdNewEvents(EtEventImpl[] evs)
EtSystem.newEvents(EtContainer)
or
EtSystem.getEvents(EtContainer)
and assign them to local storage.evs
- array of incoming events. This array will be realEvents
unless it is from a jni method call, in which case we store it
in the jniEvents
array.void holdNewEvents(EtEventImpl[] evs, int len)
EtSystem.newEvents(EtContainer)
or
EtSystem.getEvents(EtContainer)
and assign them to local storage.evs
- array of incoming events. This array will be realEvents
unless it is from a jni method call, in which case we store it
in the jniEvents
array.len
- number of valid events in array (starting at 0).public void holdLocalEvents(java.util.List<EtEventImpl> list)
SystemCreate.newEvents(EtContainer)
and assign them to local storage.list
- list of events which will be placed in holdEvents
.public void holdLocalEvents(EtEventImpl[] evs)
SystemCreate.getEvents(EtContainer)
and assign them to local storage.evs
- array of events which will be placed in holdEvents
.public EtEvent[] getEventArray()
newEvents(EtAttachment, Mode, int, int, int, int)
or
getEvents(EtAttachment, Mode, Modify, int, int)
.
Not all of these are valid since the returned array is a reference to a
large internal array. Get the number of valid events by calling
getEventCount()
. Don't do anything nasty to
the elements of this internal array.public EtEventImpl[] getEventArrayLocal()
newEvents(AttachmentLocal, int, int, int, int, int)
or
getEvents(AttachmentLocal, int, int, int)
.
Not all of these are valid since the returned array is a reference to a
large internal array. Get the number of valid events by calling
getEventCount()
. Don't do anything nasty to
the elements of this internal array.public int getEventCount()
void adjustByteArraySize(int neededBytes)
neededBytes
- needed amount of bytes in byte array.public int getLastIndex()
public void setLastIndex(int index)
index
- index of the last valid event in the array of the events being put.
Set to -1 if none.public boolean hasEndEvent()
public void setHasEndEvent(boolean index)
index
- true if the events being put contain the END event.