javax.realtime
Class RawMemoryFloatAccess

java.lang.Object
  |
  +--javax.realtime.RawMemoryAccess
        |
        +--javax.realtime.RawMemoryFloatAccess

public class RawMemoryFloatAccess
extends RawMemoryAccess

This class holds methods for accessing a raw memory area by float and double types. Implementations are required to implement this class if and only if the underlying Java Virtual Machine supports floating point data types.

Many of the constructors and methods in this class throw OffsetOutOfBoundsException. This exception means that the value given in the offset parameter is either negative or outside the memory area.

Many of the constructors and methods in this class throw SizeOutOfBoundsException. This exception means that the value given in the size parameter is either negative, larger than an allowable range, or would cause an accessor method to access an address outside of the memory area.


Field Summary
private  long base
           
private  java.lang.Runnable logic
           
private  long size
           
 
Constructor Summary
protected RawMemoryFloatAccess(long base, long size)
           
  RawMemoryFloatAccess(java.lang.Object type, long size)
          Create a RawMemoryFloatAccess object using the given parameters.
  RawMemoryFloatAccess(java.lang.Object type, long base, long size)
          Create a RawMemoryFloatAccess object using the given parameters.
protected RawMemoryFloatAccess(javax.realtime.RawMemoryAccess memory, long base, long size)
          Constructor reserved for use by the memory object factory.
 
Method Summary
static javax.realtime.RawMemoryFloatAccess createFloatAccess(java.lang.Object type, long size)
          type - An object representing the type of the memory required (dma, shared) - used to define the base address and control the mapping.
static javax.realtime.RawMemoryFloatAccess createFloatAccess(java.lang.Object type, long base, long size)
          type - An object representing the type of the memory required (dma, shared) - used to define the base address and control the mapping.
 double getDouble(long offset)
          Gets the double at the given offset.
 void getDoubles(long offset, double[] doubles, int low, int number)
          Gets number double values starting at the given offset in this, and assigns them into the double array starting at position low.
 float getFloat(long offset)
          Gets the float at the given offset.
 void getFloats(long offset, float[] floats, int low, int number)
          Gets number float values sstarting at the give offset in this, and assign them into the byte array starting at position low.
 void setDouble(long offset, double value)
          Sets the double at the given offset.
 void setDoubles(long offset, double[] doubles, int low, int number)
          Sets number double values starting at the given offset in this from the double array starting at position low.
 void setFloat(long offset, float value)
          Sets the float at the given offset.
 void setFloats(long offset, float[] floats, int low, int number)
          Set number float values starting at the given offset in this from the float array starting at position low.
 
Methods inherited from class javax.realtime.RawMemoryAccess
create, create, getByte, getBytes, getInt, getInts, getLong, getLongs, getMappedAddress, getShort, getShorts, map, map, map, setByte, setBytes, setInt, setInts, setLong, setLongs, setShort, setShorts, subregion, unmap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

base

private long base

size

private long size

logic

private java.lang.Runnable logic
Constructor Detail

RawMemoryFloatAccess

public RawMemoryFloatAccess(java.lang.Object type,
                            long size)
                     throws java.lang.SecurityException,
                            OffsetOutOfBoundsException,
                            SizeOutOfBoundsException,
                            UnsupportedPhysicalMemoryException,
                            MemoryTypeConflictException
Create a RawMemoryFloatAccess object using the given parameters.

Parameters:
type - An Object representing the type of memory required (e.g., dma, shared) - used to define the base address and control the mapping.
size - The size of the area in bytes.
Throws:
java.lang.SecurityException - The application doesn't have permissions to access physical memory or the given type of memory.
OffsetOutOfBoundsException - The address is invalid.
SizeOutOfBoundsException - The size is negative or extends into an invalid range of memory.
UnsupportedPhysicalMemoryException - Thrown if the underlying hardware does not support the given type.
MemoryTypeConflictException - The specified base does not point to memory that matches the request type, or if type specifies attributes with a conflict.

RawMemoryFloatAccess

public RawMemoryFloatAccess(java.lang.Object type,
                            long base,
                            long size)
                     throws java.lang.SecurityException,
                            OffsetOutOfBoundsException,
                            SizeOutOfBoundsException,
                            UnsupportedPhysicalMemoryException,
                            MemoryTypeConflictException
Create a RawMemoryFloatAccess object using the given parameters.

Parameters:
type - An Object representing the type of memory required (e.g., dma, shared) - used to define the base address and control the mapping.
base - The physical memory address of the area.
size - The size of the area in bytes.
Throws:
java.lang.SecurityException - The application doesn't have permissions to access physical memory or the given type of memory.
OffsetOutOfBoundsException - The address is invalid.
SizeOutOfBoundsException - The size is negative or extends into an invalid range of memory.
UnsupportedPhysicalMemoryException - Thrown if the underlying hardware does not support the given type.
MemoryTypeConflictException - The specified base does not point to memory that matches the request type, or if type specifies attributes with a conflict.

RawMemoryFloatAccess

protected RawMemoryFloatAccess(long base,
                               long size)

RawMemoryFloatAccess

protected RawMemoryFloatAccess(javax.realtime.RawMemoryAccess memory,
                               long base,
                               long size)
Constructor reserved for use by the memory object factory.

Method Detail

createFloatAccess

public static javax.realtime.RawMemoryFloatAccess createFloatAccess(java.lang.Object type,
                                                                    long size)
                                                             throws java.lang.SecurityException,
                                                                    OffsetOutOfBoundsException,
                                                                    SizeOutOfBoundsException,
                                                                    UnsupportedPhysicalMemoryException
type - An object representing the type of the memory required (dma, shared) - used to define the base address and control the mapping. size - the size of the area in bytes.

java.lang.SecurityException
OffsetOutOfBoundsException
SizeOutOfBoundsException
UnsupportedPhysicalMemoryException

createFloatAccess

public static javax.realtime.RawMemoryFloatAccess createFloatAccess(java.lang.Object type,
                                                                    long base,
                                                                    long size)
                                                             throws java.lang.SecurityException,
                                                                    OffsetOutOfBoundsException,
                                                                    SizeOutOfBoundsException,
                                                                    UnsupportedPhysicalMemoryException
type - An object representing the type of the memory required (dma, shared) - used to define the base address and control the mapping. base - The physical memory address of the area. size - the size of the area in bytes.

java.lang.SecurityException
OffsetOutOfBoundsException
SizeOutOfBoundsException
UnsupportedPhysicalMemoryException

getDouble

public double getDouble(long offset)
                 throws OffsetOutOfBoundsException,
                        SizeOutOfBoundsException
Gets the double at the given offset.

Parameters:
offset - The offset t which to write the value.
Returns:
The double value.
Throws:
OffsetOutOfBoundsException - The address is invalid.
SizeOutOfBoundsException - The size is negative or extends into an invalid range of memory.

getDoubles

public void getDoubles(long offset,
                       double[] doubles,
                       int low,
                       int number)
                throws OffsetOutOfBoundsException,
                       SizeOutOfBoundsException
Gets number double values starting at the given offset in this, and assigns them into the double array starting at position low.

Parameters:
offset - The offset at which to start reading.
doubles - The array into which the read items are placed.
low - The offset which is the starting point in the given array for the read items to be placed.
number - The number of items to read.
Throws:
OffsetOutOfBoundsException - The address is invalid.
SizeOutOfBoundsException - The size is negative or extends into an invalid range of memory.

getFloat

public float getFloat(long offset)
               throws OffsetOutOfBoundsException,
                      SizeOutOfBoundsException
Gets the float at the given offset.

Parameters:
offset - The offset at which to get the value.
Returns:
The float value.
Throws:
OffsetOutOfBoundsException - The address is invalid.
SizeOutOfBoundsException - The size is negative or extends into an invalid range or memory.

getFloats

public void getFloats(long offset,
                      float[] floats,
                      int low,
                      int number)
               throws OffsetOutOfBoundsException,
                      SizeOutOfBoundsException
Gets number float values sstarting at the give offset in this, and assign them into the byte array starting at position low.

Parameters:
offset - The offset at which to start reading.
floats - The array into which the read items are placed.
low - The offset which is the starting point in the given array for the read items to be placed.
number - The number of items to read.
Throws:
OffsetOutOfBoundsException - The address is invalid.
SizeOutOfBoundsException - The size is negative or extends into an invalid range of memory.

setDouble

public void setDouble(long offset,
                      double value)
               throws OffsetOutOfBoundsException,
                      SizeOutOfBoundsException
Sets the double at the given offset.

Parameters:
offset - The offset at which to set the value.
value - The value which will be written.
Throws:
OffsetOutOfBoundsException - The address is invalid.
SizeOutOfBoundsException - The size is negative or extends into an invalid range of memory.

setDoubles

public void setDoubles(long offset,
                       double[] doubles,
                       int low,
                       int number)
                throws OffsetOutOfBoundsException,
                       SizeOutOfBoundsException
Sets number double values starting at the given offset in this from the double array starting at position low.

Parameters:
offset - The offset at which to start writing.
doubles - The array from which the items are obtained.
low - The offset which is the starting point in the given array for the items to be obtained.
number - The number of items to write.
Throws:
OffsetOutOfBoundsException - The address is invalid.
SizeOutOfBoundsException - The size is negative or extends into an invalid range of memory.

setFloat

public void setFloat(long offset,
                     float value)
              throws OffsetOutOfBoundsException,
                     SizeOutOfBoundsException
Sets the float at the given offset.

Parameters:
offset - The offset at which to write the value.
value - The value which will be written.
Throws:
OffsetOutOfBoundsException - The address is invalid.
SizeOutOfBoundsException - The size is negative or extends into an invalid range of memory.

setFloats

public void setFloats(long offset,
                      float[] floats,
                      int low,
                      int number)
               throws OffsetOutOfBoundsException,
                      SizeOutOfBoundsException
Set number float values starting at the given offset in this from the float array starting at position low.

Parameters:
offset - The offset at which to start writing.
floats - The array from which the items are obtained.
low - The offset which is the starting poing in the given array for the items to be obtained.
number - The number of items to write.
Throws:
OffsetOutOfBoundsException - The address is invalid.
SizeOutOfBoundsException - The size is negative or extends into an invalid range of memory.