aicas logoJamaica 6.4 release 1

javax.realtime.device
Interface RawLongReader

All Superinterfaces:
RawMemory
All Known Subinterfaces:
RawLong

public interface RawLongReader
extends RawMemory

A marker for a long accessor object encapsulating the protocol for reading longs from raw memory. A long accessor can always access at least one long. Each long is transfered in a single atomic operation. Groups of longs may be transfered together; however, this is not required.

Objects of this type are created with the method RawMemoryFactory.createRawLongReader(javax.realtime.device.RawMemoryRegion, long, int, int) and RawMemoryFactory.createRawLong(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.

Since:
RTSJ 2.0

Method Summary
 int get(int offset, long[] 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, long[] values, int start, int count)
          Fill values with data from the memory region, where offset is first long in the memory region and start is the first index in values.
 long getLong()
          Get the value at the first position referenced by this instance, i.e., the value at its start address.
 long getLong(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

getLong

long getLong()
Get the value at the first position referenced by this instance, i.e., the value at its start address. This operation must be atomic with respect to all other raw memory accesses to the address.

Returns:
the value at the base address provided to the factory method that created this object.

getLong

long getLong(int offset)
             throws OffsetOutOfBoundsException
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). When an exception is thrown, no data is transfered.

Parameters:
offset - of long in the memory region starting from the address specified in the associated factory method.
Returns:
the value at the address specified.
Throws:
OffsetOutOfBoundsException - when offset is negative or greater than or equal to the number of elements in the raw memory region.

get

int get(int offset,
        long[] values)
        throws OffsetOutOfBoundsException,
               NullPointerException
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. Only the longs 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.

Parameters:
offset - of the first long in the memory region to transfere
values - the array to received the longs
Returns:
the number of elements copied to values
Throws:
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.

get

int get(int offset,
        long[] values,
        int start,
        int count)
        throws OffsetOutOfBoundsException,
               ArrayIndexOutOfBoundsException,
               IllegalArgumentException,
               NullPointerException
Fill values with data from the memory region, where offset is first long 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.

Parameters:
offset - of the first long in the memory region to transfere
values - the array to received the longs
start - the first index in array to fill
count - the maximum number of longs to copy
Returns:
the number of longs actually transfered.
Throws:
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.

aicas logoJamaica 6.4 release 1

aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2015 aicas GmbH. All Rights Reserved.