Package mpi
Class Struct
java.lang.Object
mpi.Struct
Base class for defining struct data types.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Base class for reading/writing data in a struct stored in a byte buffer. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal int
addByte()
Adds a byte field to this struct.final int
addByte
(int length) Adds a byte array to this struct.final int
addChar()
Adds a char field to this struct.final int
addChar
(int length) Adds a char array to this struct.final int
Adds a field of the specified data type.final int
Adds an array of the specified data type.final int
Adds a double field to this struct.final int
addDouble
(int length) Adds a double array to this struct.final int
addFloat()
Adds a float field to this struct.final int
addFloat
(int length) Adds a float array to this struct.final int
addInt()
Adds an int field to this struct.final int
addInt
(int length) Adds an int array to this struct.final int
addLong()
Adds a long field to this struct.final int
addLong
(int length) Adds a long array to this struct.final int
addShort()
Adds a short field to this struct.final int
addShort
(int length) Adds a short array to this struct.final int
Adds a struct field to this struct.final int
Adds an array of structs to this struct.final <T extends Struct.Data>
TgetData
(byte[] array) final <T extends Struct.Data>
TgetData
(byte[] array, int index) final <T extends Struct.Data>
TgetData
(ByteBuffer buffer) final <T extends Struct.Data>
TgetData
(ByteBuffer buffer, int index) final int
Returns the extent of the struct data type.final Datatype
getType()
Returns the data type of the struct.protected abstract Struct.Data
newData()
Creates a Data object.final Struct
setOffset
(int offset) Sets the offset of the next field.
-
Constructor Details
-
Struct
public Struct()
-
-
Method Details
-
getExtent
Returns the extent of the struct data type.- Returns:
- Extent of the struct data type.
- Throws:
MPIException
- Signals that an MPI exception of some sort has occurred.
-
getType
Returns the data type of the struct.- Returns:
- The data type of the struct.
- Throws:
MPIException
- Signals that an MPI exception of some sort has occurred.
-
newData
Creates a Data object.- Returns:
- New Data object.
-
getData
- Throws:
MPIException
-
getData
- Throws:
MPIException
-
getData
- Throws:
MPIException
-
getData
- Throws:
MPIException
-
setOffset
Sets the offset of the next field.The offset must be greater or equal to the accumulated extent.
- Parameters:
offset
- offset of the next field- Returns:
- this object in order to allow adding fields in a chained expression
-
addByte
public final int addByte()Adds a byte field to this struct.- Returns:
- Offset of the new field.
-
addByte
public final int addByte(int length) Adds a byte array to this struct.- Parameters:
length
- Length of the array.- Returns:
- Offset of the new field.
-
addChar
public final int addChar()Adds a char field to this struct.- Returns:
- Offset of the new field.
-
addChar
public final int addChar(int length) Adds a char array to this struct.- Parameters:
length
- Length of the array.- Returns:
- Offset of the new field.
-
addShort
public final int addShort()Adds a short field to this struct.- Returns:
- Offset of the new field.
-
addShort
public final int addShort(int length) Adds a short array to this struct.- Parameters:
length
- Length of the array.- Returns:
- Offset of the new field.
-
addInt
public final int addInt()Adds an int field to this struct.- Returns:
- Offset of the new field.
-
addInt
public final int addInt(int length) Adds an int array to this struct.- Parameters:
length
- Length of the array.- Returns:
- Offset of the new field.
-
addLong
public final int addLong()Adds a long field to this struct.- Returns:
- Offset of the new field.
-
addLong
public final int addLong(int length) Adds a long array to this struct.- Parameters:
length
- Length of the array.- Returns:
- Offset of the new field.
-
addFloat
public final int addFloat()Adds a float field to this struct.- Returns:
- Offset of the new field.
-
addFloat
public final int addFloat(int length) Adds a float array to this struct.- Parameters:
length
- Length of the array.- Returns:
- Offset of the new field.
-
addDouble
public final int addDouble()Adds a double field to this struct.- Returns:
- Offset of the new field.
-
addDouble
public final int addDouble(int length) Adds a double array to this struct.- Parameters:
length
- Length of the array.- Returns:
- Offset of the new field.
-
addStruct
Adds a struct field to this struct.- Parameters:
struct
- Type of the field.- Returns:
- Offset of the new field.
- Throws:
MPIException
- Signals that an MPI exception of some sort has occurred.
-
addStruct
Adds an array of structs to this struct.- Parameters:
struct
- Type of the array.length
- Length of the array.- Returns:
- Offset of the new field.
- Throws:
MPIException
- Signals that an MPI exception of some sort has occurred.
-
addData
Adds a field of the specified data type.- Parameters:
type
- Data type.- Returns:
- Offset of the new field.
- Throws:
MPIException
- Signals that an MPI exception of some sort has occurred.
-
addData
Adds an array of the specified data type.- Parameters:
type
- Data type.length
- Length of the array.- Returns:
- Offset of the new field.
- Throws:
MPIException
- Signals that an MPI exception of some sort has occurred.
-