Packet Table C++ Wrapper Reference Manual

HDF5 documents and links Introduction to HDF5 HDF5 User's Guide Other High-level API documents | In the HDF5 Reference Manual H5DS H5IM H5LT H5PT H5TB Optimized H5 H5A H5D H5E H5F H5G H5I H5L H5O H5P H5R H5S H5T H5Z Tools Datatypes Fortran

# H5PT: HDF5 Packet Table
C++ Wrappers

Classes:

- PacketTable - functions shared by all packet tables
- FL_PacketTable - a packet table storing fixed-length packets

Functions (none are static; all must be called on an object):

Packet Table:

Name: Null Constructor
Signature:
  PacketTable( )
Purpose:
  Creates an invalid packet table object.
Description:
  The object created with this call will return false if IsValid() is called on it. To create a valid packet table, use the FL_Packet_Table constructors. This function does not make any change to the underlying HDF5 file.

Name: "Open" Constructor
Signature:
  PacketTable(hid_t fileID, char* name)
Purpose:
  Opens an existing packet table.
Description:
  Opens an existing packet table, which can contain either fixed-length or variable-length packets.
Parameters:

hid_t fileID
  IN: file or group in which the packet table is located
char* name
  IN: the packet table's name

Name: Destructor
Signature:
  ~PacketTable()
Description:
  The destructor closes the packet table in the file, so a packet table created or opened with the C++ wrapper does not need to be closed manually.

Name: IsValid
Signature:
  bool IsValid()
Purpose:
  Determines if this is an valid packet table.
Description:
  This function is used to ensure that a PacketTable object corresponds to an open packet table in the file. It should be called after the constructor to check that there were no errors creating or opening the packet table.
Returns:
  Returns true if this is an open packet table, false otherwise.

Name: ResetIndex
Signature:
  void ResetIndex()
Purpose:
  Resets the packet table's index to point to the first packet.
Description:
  A packet table keeps track of the user's current location in the table so that the user can iterate through packets. This function should be called before using GetNextPacket.

Name: SetIndex
Signature:
  int SetIndex(hsize_t index);
Purpose:
  Sets a packet table's current index.
Description:
  This function allows the user to begin iterating through packets starting from any arbitrary index. Packet tables are zero-indexed, so packet 0 is the first packet.
Parameters:

hsize_t index
  IN: The value to which the packet table's index should be set

Returns:
  Returns non-negative on success, negative on error.

Name: GetIndex
Signature:
  hsize_t GetIndex(int& error);
Purpose:
  Returns the position of the current packet.
Description:
  This function allows the user to determine the position of the current packet.

  If `GetIndex` returns `0` (zero), you must then check the value of the parameter `error`. If `error` is negative, `GetIndex` has failed; if `error` is `0` (zero), the position of the current packet is `0` (zero).

Parameters:

int& error (optional)
  OUT: Non-negative if index was successfully retrieved, negative on failure.

Returns:
  Returns the position of the current packet on success, 0 (zero) on error.

Name: GetPacketCount
Signatures:
  hsize_t GetPacketCount()
  hsize_t GetPacketCount(int& error)
Purpose:
  Retrieves the number of packets in the packet table.
Description:
  This function is overloaded so that it can be called with or without returning an error value. If `error` is not supplied, any error value is ignored. Using this parameter allows the user to distinguish between an open packet table with 0 packets and an invalid packet table.
Parameters:

int& error (optional)
  OUT: Non-negative if packet count was successfully retrieved, negative if packet table is invalid.

Returns:
  Number of packets in packet table. Returns 0 if packet table contains zero packets or on error.

FL_Packet_Table:

Name: "Create" Constructor
Signature:
  FL_PacketTable(hid_t fileID, char* name, hid_t dtypeID, int chunkSize, int compression)
Purpose:
  Creates a new packet table for storing fixed-length packets.
Description:
  This constructor creates and opens a packet table in the file specified by `fileID` named `name`. Packets will be of the datatype specified by `dtypeID`.
Parameters:

hid_t fileID
  IN: Identifier of the file or group to create the table within.
const char * dset_name
  IN: The name of the packet table to create.
hid_t dtype_id
  IN: The datatype of a packet.
hsize_t chunkSize
  IN: The packet table uses HDF5 chunked storage to allow it to grow. This value allows the user to set the size of a chunk. The chunk size affects performance.
int compression
  IN: Desired compression level: `0` (zero) through `9,` or `-1` for no compression.

Name: "Open" Constructor
Signature:
  FL_PacketTable(hid_t fileID, char* name)
Purpose:
  Opens a fixed-length packet table.
Description:
  This constructor opens an existing packet table named `name` in the location `fileID`. This packet table must be fixed-length.
Parameters:

hid_t fileID
  IN: Identifier of the file or group containing the packet table.
const char * dset_name
  IN: The name of the packet table to open.

Name: AppendPacket / AppendPackets
Signature:
  int AppendPacket(void * data)
  int AppendPackets(size_t numPackets, void *data)
Purpose:
  Appends fixed-length packets to the packet table.
Description:
  This function writes packets to the end of the packet table. If only one argument is given, it is assumed that only a single packet is being written.
Parameters:

size_t numPackets (optional)
  IN: Number of packets to add. Default is one.
void * data:
  IN: Data to write. Must be a buffer of packets of the packet table's datatype.

Returns:
  Returns non-negative value on success, negative on error.

Name: GetPacket / GetPackets
Signatures:
  int GetPacket(hsize_t index, void * data)
  int GetPackets(hsize_t startIndex, hsize_t endIndex, void * data)
Purpose:
  Reads packets from the packet table.
Description:
  This function fills a buffer, `data`, with fixed-length packets from the packet table. The one-argument function can be called to retrieve a single packet at the given index, or the two-argument function used to read a range of packets (zero-indexed, inclusive).
Parameters:

hsize_t index (single packet)
  IN: Index of the single packet to be read
hsize_t startIndex (multiple packets)
  IN: Index at which to start reading packets
hsize_t endIndex (multiple packets)
  IN: Index at which to stop reading packets
void * data
  OUT: Buffer for packets being retrieved

Returns:
  Returns non-negative on success, negative on error.

Name: GetNextPacket / Get Next Packets
Signatures:
  int GetNextPacket(void * data)
  int GetNextPackets(size_t numPackets, void * data)
Purpose:
  Iterates through packets from the packet table.
Description:
  This function reads packets starting from the current index in the packet table and updates the index. It can be used with the ResetIndex and SetIndex functions to iterate through the packet table. There are versions of this function that can be called with or without the `numPackets` argument; if this argument is not supplied, it defaults to one.
Parameters:

size_t numPackets (optional)
  IN: How many packets to read. Defaults to one.
void * data
  OUT: Buffer to hold packets being read.

Returns:
  Returns non-negative on success, negative on error.

HDF5 documents and links Introduction to HDF5 HDF5 User's Guide Other High-level API documents | In the HDF5 Reference Manual H5DS H5IM H5LT H5PT H5TB Optimized H5 H5A H5D H5E H5F H5G H5I H5L H5O H5P H5R H5S H5T H5Z Tools Datatypes Fortran