|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RawShortReader
A marker for a short accessor object encapsulating the protocol for reading shorts from raw memory. A short accessor can always access at least one short. Each short is transfered in a single atomic operation. Groups of shorts may be transfered together; however, this is not required.
Objects of this type are created with the method
RawMemoryFactory.createRawShortReader(javax.realtime.device.RawMemoryRegion, long, int, int)
and
RawMemoryFactory.createRawShort(javax.realtime.device.RawMemoryRegion, long, int, int)
. Each object references
a range of elements in the RawMemoryRegion
starting at the
base address provided to the factory method. The size provided
to the factor method determines the number of elements accessable.
Caching of the memory access is controlled by the factory that created this object. If the memory is not cached, this method guarantees serialized access. In other words, the memory access at the memory occurs in the same order as in the program. Multiple writes to the same location may not be coalesced.
Method Summary | |
---|---|
int |
get(int offset,
short[] values)
Fill the values starting at the address referenced by
this instance plus the offset scaled by the element size in bytes and
the object's stride. |
int |
get(int offset,
short[] values,
int start,
int count)
Fill values with data from the memory region, where
offset is first short in the memory region and
start is the first index in values . |
short |
getShort()
Get the value at the first position referenced by this instance, i.e., the value at its start address. |
short |
getShort(int offset)
Get the value of the nth element referenced by this instance, where n is offset and the
address is base address + (offset
× the stride × element size in bytes). |
Methods inherited from interface javax.realtime.device.RawMemory |
---|
getAddress, getSize, getStride |
Method Detail |
---|
short getShort()
short getShort(int offset) throws OffsetOutOfBoundsException
n
is offset
and the
address is base address + (offset
× the stride × element size in bytes). When an
exception is thrown, no data is transfered.
offset
- of short in the memory region starting from the address
specified in the associated factory method.
OffsetOutOfBoundsException
- when offset
is
negative or greater than or equal to the number of elements in
the raw memory region.int get(int offset, short[] values) throws OffsetOutOfBoundsException, NullPointerException
values
starting at the address referenced by
this instance plus the offset scaled by the element size in bytes and
the object's stride.
Only the shorts in the intersection of the start and end of
values
and the base address and the
end of the memory region are transfered. When an exception is
thrown, no data is transfered.
offset
- of the first short in the memory region to transferevalues
- the array to received the shorts
values
OffsetOutOfBoundsException
- when offset
is
negative or greater than or equal to the number of elements in the
raw memory region.
NullPointerException
- when values
is null.int get(int offset, short[] values, int start, int count) throws OffsetOutOfBoundsException, ArrayIndexOutOfBoundsException, IllegalArgumentException, NullPointerException
values
with data from the memory region, where
offset
is first short in the memory region and
start
is the first index in values
. The
number of bytes transfered is the minimum of count
, the
size of the memory region minus offset
, and
length of values
minus start
. When an
exception is thrown, no data is transfered.
offset
- of the first short in the memory region to transferevalues
- the array to received the shortsstart
- the first index in array to fillcount
- the maximum number of shorts to copy
OffsetOutOfBoundsException
- when offset
is
negative or greater than or equal to the number of elements in the
raw memory area.
ArrayIndexOutOfBoundsException
- when start
is
negative or either start
or start + count
is greater than or equal to the size of values.
IllegalArgumentException
- when count
is negative.
NullPointerException
- when values
is null or
count
is negative.
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |