aicas logoJamaica 6.4 release 1

javax.realtime
Class RawMemoryFloatAccess

java.lang.Object
  extended by javax.realtime.RawMemoryAccess
      extended by javax.realtime.RawMemoryFloatAccess

public class RawMemoryFloatAccess
extends RawMemoryAccess

Jamaica Real-Time Specification for Java class RawMemoryFloatAccess

This class enables the low-level access of a range of physical memory as a sequence of bytes. This class permits the development of device drivers using memory-mapped I/O, flash memory, battery-backed RAM, etc.

The memory can be accessed as primitive types byte, short, int, long, float, double, or as arrays of these primitive types. No non-primitive types (Java references or Java objects) can be stored in this memory since this would undermine Java's inherent type safety for references and objects.

The byte ordering on accesses to the memory depends on the current setting of RealtimeSystem.BYTE_ORDER.


Field Summary
 
Fields inherited from class javax.realtime.RawMemoryAccess
byteSwapEnabled_
 
Constructor Summary
RawMemoryFloatAccess(Object type, long size)
           Constructor to create an instance of RawMemoryFloatAccess for the given parameters and make this memory accessible.
RawMemoryFloatAccess(Object type, long base, long size)
           Constructor to create an instance of RawMemoryFloatAccess for the given parameters and make this memory accessible.
 
Method Summary
 double getDouble(long offset)
          getDouble reads a double from the given offset.
 void getDoubles(long offset, double[] doubles, int low, int number)
          getDoubles reads a number of doubles from the given offset.
 float getFloat(long offset)
          getFloat reads a float from the given offset.
 void getFloats(long offset, float[] floats, int low, int number)
          getFloats reads a number of floats from the given offset.
 void setDouble(long offset, double value)
          setDouble writes a double to the given offset.
 void setDoubles(long offset, double[] doubles, int low, int number)
          setDoubles writes a number of doubles to the given offset.
 void setFloat(long offset, float value)
          setFloat writes a float to the given offset.
 void setFloats(long offset, float[] floats, int low, int number)
          setFloats writes a number of floats to the given offset.
 
Methods inherited from class javax.realtime.RawMemoryAccess
getByte, getBytes, getInt, getInts, getLong, getLongs, getMappedAddress, getShort, getShorts, map, map, map, setByte, setBytes, setInt, setInts, setLong, setLongs, setShort, setShorts, swapBytes, swapBytes, swapBytes, unmap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawMemoryFloatAccess

public RawMemoryFloatAccess(Object type,
                            long size)
                     throws SecurityException,
                            OffsetOutOfBoundsException,
                            SizeOutOfBoundsException,
                            UnsupportedPhysicalMemoryException,
                            MemoryTypeConflictException,
                            OutOfMemoryError

Constructor to create an instance of RawMemoryFloatAccess for the given parameters and make this memory accessible.

The base address will be chosen freely by the implementation.

Parameters:
type - The type of the memory (e.g., PhysicalMemoryManager.DMA, etc). This may be an array of types if several type attributes are required. type may be null if any memory type is acceptable.
size - the size of the range.
Throws:
SecurityException - if the application is not allowed to access physical memory or memory of the specified type.
SizeOutOfBoundsException - iff size is negative or base plus size extends into an illegal memory range.
OffsetOutOfBoundsException - iff base is invalid.
UnsupportedPhysicalMemoryException - if the specified memory type is not supported.
MemoryTypeConflictException - if the memory at the specified base address is incompatible with the attributes specified in the type parameter.
OutOfMemoryError - if there is no memory of the specified type available.

RawMemoryFloatAccess

public RawMemoryFloatAccess(Object type,
                            long base,
                            long size)
                     throws SecurityException,
                            OffsetOutOfBoundsException,
                            SizeOutOfBoundsException,
                            UnsupportedPhysicalMemoryException,
                            MemoryTypeConflictException,
                            OutOfMemoryError

Constructor to create an instance of RawMemoryFloatAccess for the given parameters and make this memory accessible.

JamaicaVM currently does not support virtual memory, so no mapping of the specified memory will be performed by this constructor.

Parameters:
type - The type of the memory (e.g., PhysicalMemoryManager.DMA, etc). This may be an array of types if several type attributes are required. type may be null if any memory type is acceptable.
base - the base address of the range.
size - the size of the range.
Throws:
SecurityException - if the application is not allowed to access the specified range of memory or memory type.
SizeOutOfBoundsException - iff size is negative or base plus size extends into an illegal memory range.
OffsetOutOfBoundsException - iff base is invalid.
UnsupportedPhysicalMemoryException - if the specified memory type is not supported.
MemoryTypeConflictException - if the memory at the specified base address is incompatible with the attributes specified in the type parameter.
OutOfMemoryError - if there is no memory of the specified type available.
Method Detail

getDouble

public double getDouble(long offset)
                 throws OffsetOutOfBoundsException,
                        SizeOutOfBoundsException
getDouble reads a double from the given offset. The read may be not atomic.

Parameters:
offset - the offset of the first byte from the beginning of this memory range.
Returns:
the double read.
Throws:
SizeOutOfBoundsException - if this is not mapped or offset specifies an address in an invalid address range.
OffsetOutOfBoundsException - if offset is negative or greater than the size of the raw memory area.

getDoubles

public void getDoubles(long offset,
                       double[] doubles,
                       int low,
                       int number)
                throws OffsetOutOfBoundsException,
                       SizeOutOfBoundsException
getDoubles reads a number of doubles from the given offset. The reads may be not atomic.

Parameters:
offset - the offset of the doubles from the beginning of this memory range.
doubles - (out!) an array to hold the read doubles.
low - offset in doubles array where the first value is stored.
number - number of doubles to be read.
Throws:
SizeOutOfBoundsException - if this is not mapped or offset specifies an address in an invalid address range.
OffsetOutOfBoundsException - if offset is negative or greater than the size of the raw memory area.
ArrayIndexOutOfBoundsException - if low < 0 or (low + number) >= doubles.length or (low + number) < 0.
IllegalArgumentException - if doubles is null or number < 0.

getFloat

public float getFloat(long offset)
               throws OffsetOutOfBoundsException,
                      SizeOutOfBoundsException
getFloat reads a float from the given offset. If naturally aligned, the float is read in an atomic read operation. If not aligned, the read may be not atomic.

Parameters:
offset - the offset of the first byte from the beginning of this memory range.
Returns:
the float read.
Throws:
SizeOutOfBoundsException - if this is not mapped or offset specifies an address in an invalid address range.
OffsetOutOfBoundsException - if offset is negative or greater than the size of the raw memory area.

getFloats

public void getFloats(long offset,
                      float[] floats,
                      int low,
                      int number)
               throws OffsetOutOfBoundsException,
                      SizeOutOfBoundsException
getFloats reads a number of floats from the given offset. If naturally aligned, each float is read in an atomic read operation. If not aligned, the read may be not atomic.

Parameters:
offset - the offset of the floats from the beginning of this memory range.
floats - (out!) an array to hold the read floats.
low - offset in floats array where the first value is stored.
number - number of floats to be read.
Throws:
SizeOutOfBoundsException - if this is not mapped or offset specifies an address in an invalid address range.
OffsetOutOfBoundsException - if offset is negative or greater than the size of the raw memory area.
ArrayIndexOutOfBoundsException - if low < 0 or (low + number) >= floats.length or (low + number) < 0.
IllegalArgumentException - if floats is null or number < 0.

setFloat

public void setFloat(long offset,
                     float value)
              throws OffsetOutOfBoundsException,
                     SizeOutOfBoundsException
setFloat writes a float to the given offset. The write may be not atomic.

Parameters:
offset - the offset of the first byte from the beginning of this memory range.
value - the float to be written.
Throws:
SizeOutOfBoundsException - if this is not mapped or offset specifies an address in an invalid address range.
OffsetOutOfBoundsException - if offset is negative or greater than the size of the raw memory area.

setFloats

public void setFloats(long offset,
                      float[] floats,
                      int low,
                      int number)
               throws OffsetOutOfBoundsException,
                      SizeOutOfBoundsException
setFloats writes a number of floats to the given offset. The writes may be not atomic.

Parameters:
offset - the offset of the floats from the beginning of this memory range.
floats - an array that holds the floats to be written.
low - offset in floats array where the first value to be written will be taken from.
number - number of floats to be written.
Throws:
SizeOutOfBoundsException - if this is not mapped or offset specifies an address in an invalid address range.
OffsetOutOfBoundsException - if offset is negative or greater than the size of the raw memory area.
ArrayIndexOutOfBoundsException - if low < 0 or (low + number) >= floats.length or (low + number) < 0.
IllegalArgumentException - if floats is null or number < 0.

setDouble

public void setDouble(long offset,
                      double value)
               throws OffsetOutOfBoundsException,
                      SizeOutOfBoundsException
setDouble writes a double to the given offset. The write may be not atomic.

Parameters:
offset - the offset of the first byte from the beginning of this memory range.
value - the double to be written.
Throws:
SizeOutOfBoundsException - if this is not mapped or offset specifies an address in an invalid address range.
OffsetOutOfBoundsException - if offset is negative or greater than the size of the raw memory area.

setDoubles

public void setDoubles(long offset,
                       double[] doubles,
                       int low,
                       int number)
                throws OffsetOutOfBoundsException,
                       SizeOutOfBoundsException
setDoubles writes a number of doubles to the given offset. The writes may be not atomic.

Parameters:
offset - the offset of the doubles from the beginning of this memory range.
doubles - an array that holds the doubles to be written.
low - offset in doubles array where the first value to be written will be taken from.
number - number of doubles to be written.
Throws:
SizeOutOfBoundsException - if this is not mapped or offset specifies an address in an invalid address range.
OffsetOutOfBoundsException - if offset is negative or greater than the size of the raw memory area.
ArrayIndexOutOfBoundsException - if low < 0 or (low + number) >= doubles.length or (low + number) < 0.
IllegalArgumentException - if doubles is null or number < 0.

aicas logoJamaica 6.4 release 1

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