Module org.hdfgroup.object
Package hdf.object

# Interface CompoundDataFormat

All Superinterfaces:
  `DataFormat`

All Known Implementing Classes:
  `Attribute`, `CompoundDS`, `H4Attribute`, `H4Vdata`, `H5Attribute`, `H5CompoundDS`, `NC2Attribute`

public interface CompoundDataFormat extends DataFormat
An interface that provides general operations for data with a Compound datatype. For example, getting the names, dataspaces or datatypes of the members of the Compound datatype.

Version:
  1.0 5/3/2018
Author:
  Jordan T. Henderson
See Also:
  `HObject`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getMemberCount()`
  Returns the number of members of the compound data object.
  `int[]`
  `getMemberDims​(int i)`
  Returns the dimension sizes of the i-th member.
  `String[]`
  `getMemberNames()`
  Returns the names of the members of the compound data object.
  `int[]`
  `getMemberOrders()`
  Returns array containing the total number of elements of the members of the compound data object.
  `Datatype[]`
  `getMemberTypes()`
  Returns an array of datatype objects of the compound members.
  `int`
  `getSelectedMemberCount()`
  Returns the number of selected members of the compound data object.
  `String[]`
  `getSelectedMemberNames()`
  Returns an array of the names of the selected compound members.
  `int[]`
  `getSelectedMemberOrders()`
  Returns array containing the total number of elements of the selected members of the compound data object.
  `Datatype[]`
  `getSelectedMemberTypes()`
  Returns an array of datatype objects of the selected compound members.
  `boolean`
  `isMemberSelected​(int idx)`
  Checks if a member of the compound data object is selected for read/write.
  `void`
  `selectMember​(int idx)`
  Selects the i-th member for read/write.
  `void`
  `setAllMemberSelection​(boolean selectAll)`
  Selects/deselects all members.

  ### Methods inherited from interface hdf.object.DataFormat

  `clearData, convertFromUnsignedC, convertToUnsignedC, getCompression, getData, getDatatype, getDims, getFillValue, getHeight, getOriginalClass, getRank, getSelectedDims, getSelectedIndex, getStartDims, getStride, getWidth, init, isInited, read, setData, write, write`

- ## Method Details

  - ### getMemberCount

    int getMemberCount()
    Returns the number of members of the compound data object.
    Returns:
      the number of members of the compound data object.

  - ### getSelectedMemberCount

    int getSelectedMemberCount()
    Returns the number of selected members of the compound data object. Selected members are the compound fields which are selected for read/write.

    For example, in a compound datatype of {int A, float B, char[] C}, users can choose to retrieve only {A, C} from the data object. In this case, getSelectedMemberCount() returns two.

    Returns:
      the number of selected members.

  - ### getMemberNames

    String[] getMemberNames()
    Returns the names of the members of the compound data object. The names of compound members are stored in an array of Strings.

    For example, for a compound datatype of {int A, float B, char[] C} getMemberNames() returns ["A", "B", "C"}.

    Returns:
      the names of compound members.

  - ### getSelectedMemberNames

    String[] getSelectedMemberNames()
    Returns an array of the names of the selected compound members.
    Returns:
      an array of the names of the selected compound members.

  - ### isMemberSelected

    boolean isMemberSelected​(int idx)
    Checks if a member of the compound data object is selected for read/write.
    Parameters:
      `idx` - the index of compound member.
    Returns:
      true if the i-th memeber is selected; otherwise returns false.

  - ### selectMember

    void selectMember​(int idx)
    Selects the i-th member for read/write.
    Parameters:
      `idx` - the index of compound member.

  - ### setAllMemberSelection

    void setAllMemberSelection​(boolean selectAll)
    Selects/deselects all members.
    Parameters:
      `selectAll` - The indicator to select or deselect all members. If true, all members are selected for read/write. If false, no member is selected for read/write.

  - ### getMemberOrders

    int[] getMemberOrders()
    Returns array containing the total number of elements of the members of the compound data object.

    For example, a compound dataset COMP has members of A, B and C as

             COMP {
                 int A;
                 float B[5];
                 double C[2][3];
             }

    getMemberOrders() will return an integer array of {1, 5, 6} to indicate that member A has one element, member B has 5 elements, and member C has 6 elements.
    Returns:
      the array containing the total number of elements of the members of the compound data object.

  - ### getSelectedMemberOrders

    int[] getSelectedMemberOrders()
    Returns array containing the total number of elements of the selected members of the compound data object.

    For example, a compound dataset COMP has members of A, B and C as

             COMP {
                 int A;
                 float B[5];
                 double C[2][3];
             }

    If A and B are selected, getSelectedMemberOrders() returns an array of {1, 5}
    Returns:
      array containing the total number of elements of the selected members of the compound data object.

  - ### getMemberDims

    int[] getMemberDims​(int i)
    Returns the dimension sizes of the i-th member.

    For example, a compound dataset COMP has members of A, B and C as

             COMP {
                 int A;
                 float B[5];
                 double C[2][3];
             }

    getMemberDims(2) returns an array of {2, 3}, while getMemberDims(1) returns an array of {5}, and getMemberDims(0) returns null.
    Parameters:
      `i` - the i-th member
    Returns:
      the dimension sizes of the i-th member, null if the compound member is not an array.

  - ### getMemberTypes

    Datatype[] getMemberTypes()
    Returns an array of datatype objects of the compound members.

    Each member of a compound data object has its own datatype. The datatype of a member can be atomic or other compound datatype (nested compound). The datatype objects are setup at init().

    Returns:
      the array of datatype objects of the compound members.

  - ### getSelectedMemberTypes

    Datatype[] getSelectedMemberTypes()
    Returns an array of datatype objects of the selected compound members.
    Returns:
      an array of datatype objects of the selected compound members.