Skip to content

Commit

Permalink
Merge pull request #148 from HDFGroup/hdf5-1.10.3
Browse files Browse the repository at this point in the history
HDF.PInvoke 1.10.3
  • Loading branch information
gheber authored Sep 28, 2018
2 parents 90b1c76 + fae9be0 commit cc64452
Show file tree
Hide file tree
Showing 20 changed files with 335 additions and 281 deletions.
47 changes: 47 additions & 0 deletions HDF5/H5Dpublic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using htri_t = System.Int32;
using size_t = System.IntPtr;
using ssize_t = System.IntPtr;
using uint32_t = System.UInt32;

#if HDF5_VER1_10
using hid_t = System.Int64;
Expand Down Expand Up @@ -599,6 +600,27 @@ public static extern herr_t read

#if HDF5_VER1_10

/// <summary>
/// Reads a raw data chunk directly from a dataset in a file into a buffer.
/// See https://support.hdfgroup.org/HDF5/doc/HL/RM_HDF5Optimized.html#H5DOread_chunk
/// </summary>
/// <param name="dset_id">Identifier for the dataset to be read</param>
/// <param name="dxpl_id">Transfer property list identifier for this
/// I/O operation</param>
/// <param name="filter_mask">Mask for identifying the filters used
/// with the chunk</param>
/// <param name="offset">Logical position of the chunk’s first element
/// in the dataspace</param>
/// <param name="buf">Buffer containing the chunk read from the dataset</param>
/// <returns>Returns a non-negative value if successful; otherwise
/// returns a negative value.</returns>
[DllImport(Constants.HLDLLFileName, EntryPoint = "H5Dread_chunk",
CallingConvention = CallingConvention.Cdecl),
SuppressUnmanagedCodeSecurity, SecuritySafeCritical]
public static extern herr_t read_chunk
(hid_t dset_id, hid_t dxpl_id, ref hsize_t offset,
ref uint32_t filter_mask, IntPtr buf);

/// <summary>
/// Refreshes all buffers associated with a dataset.
/// See https://www.hdfgroup.org/HDF5/docNewFeatures/FineTuneMDC/H5Drefresh.htm
Expand Down Expand Up @@ -720,5 +742,30 @@ public static extern herr_t vlen_reclaim
public static extern herr_t write
(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, IntPtr buf);

#if HDF5_VER1_10

/// <summary>
/// Writes a raw data chunk from a buffer directly to a dataset.
/// See https://www.hdfgroup.org/HDF5/doc/HL/RM_HDF5Optimized.html
/// </summary>
/// <param name="dset_id">Identifier for the dataset to write to</param>
/// <param name="dxpl_id">UNUSED</param>
/// <param name="filter_mask">Mask for identifying the filters in use</param>
/// <param name="offset">Logical position of the chunk’s first element
/// in the dataspace</param>
/// <param name="data_size">Size of the actual data to be written in
/// bytes</param>
/// <param name="buf">Buffer containing data to be written to the file</param>
/// <returns>Returns a non-negative value if successful; otherwise
/// returns a negative value.</returns>
[DllImport(Constants.HLDLLFileName, EntryPoint = "H5Dwrite_chunk",
CallingConvention = CallingConvention.Cdecl),
SuppressUnmanagedCodeSecurity, SecuritySafeCritical]
public static extern herr_t write_chunk
(hid_t dset_id, hid_t dxpl_id, uint32_t filter_mask,
ref hsize_t offset, size_t data_size, IntPtr buf);

#endif
}
}
196 changes: 196 additions & 0 deletions HDF5/H5Opublic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,114 @@ public extern static ssize_t get_comment_by_name
(hid_t loc_id, string name, [In][Out]StringBuilder comment, size_t size,
hid_t lapl_id = H5P.DEFAULT);

#if HDF5_VER1_10

/// <summary>
/// Retrieves the metadata for an object specified by an identifier.
/// See https://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
/// </summary>
/// <param name="loc_id">Identifier for object of type specified by
/// <code>H5O.type_t</code></param>
/// <param name="oinfo">Buffer in which to return object information</param>
/// <returns>Returns a non-negative value if successful; otherwise
/// returns a negative value.</returns>
[DllImport(Constants.DLLFileName, EntryPoint = "H5Oget_info1",
CallingConvention = CallingConvention.Cdecl),
SuppressUnmanagedCodeSecurity, SecuritySafeCritical]
public extern static herr_t get_info(hid_t loc_id, ref info_t oinfo);

/// <summary>
/// Retrieves the metadata for an object, identifying the object by an
/// index position.
/// See https://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfoByIdx
/// </summary>
/// <param name="loc_id">File or group identifier specifying location
/// of group in which object is located</param>
/// <param name="group_name">Name of group in which object is located</param>
/// <param name="idx_type">Index or field that determines the order</param>
/// <param name="order">Order within field or index</param>
/// <param name="n">Object for which information is to be returned</param>
/// <param name="oinfo">Buffer in which to return object information</param>
/// <param name="lapl_id">Link access property list</param>
/// <returns>Returns a non-negative value if successful; otherwise
/// returns a negative value.</returns>
[DllImport(Constants.DLLFileName, EntryPoint = "H5Oget_info_by_idx1",
CallingConvention = CallingConvention.Cdecl),
SuppressUnmanagedCodeSecurity, SecuritySafeCritical]
public extern static herr_t get_info_by_idx
(hid_t loc_id, byte[] group_name, H5.index_t idx_type,
H5.iter_order_t order, hsize_t n, ref info_t oinfo,
hid_t lapl_id = H5P.DEFAULT);

/// <summary>
/// Retrieves the metadata for an object, identifying the object by an
/// index position.
/// See https://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfoByIdx
/// </summary>
/// <param name="loc_id">File or group identifier specifying location
/// of group in which object is located</param>
/// <param name="group_name">Name of group in which object is located</param>
/// <param name="idx_type">Index or field that determines the order</param>
/// <param name="order">Order within field or index</param>
/// <param name="n">Object for which information is to be returned</param>
/// <param name="oinfo">Buffer in which to return object information</param>
/// <param name="lapl_id">Link access property list</param>
/// <returns>Returns a non-negative value if successful; otherwise
/// returns a negative value.</returns>
/// <remarks>ASCII strings ONLY!</remarks>
[DllImport(Constants.DLLFileName, EntryPoint = "H5Oget_info_by_idx1",
CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Ansi),
SuppressUnmanagedCodeSecurity, SecuritySafeCritical]
public extern static herr_t get_info_by_idx
(hid_t loc_id, string group_name, H5.index_t idx_type,
H5.iter_order_t order, hsize_t n, ref info_t oinfo,
hid_t lapl_id = H5P.DEFAULT);

/// <summary>
/// Retrieves the metadata for an object, identifying the object by
/// location and relative name.
/// See https://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfoByName
/// </summary>
/// <param name="loc_id">File or group identifier specifying location
/// of group in which object is located</param>
/// <param name="name">Name of object, relative to
/// <paramref name="loc_id"/></param>
/// <param name="oinfo">Buffer in which to return object information</param>
/// <param name="lapl_id">Link access property list</param>
/// <returns>Returns a non-negative value if successful; otherwise
/// returns a negative value.</returns>
[DllImport(Constants.DLLFileName, EntryPoint = "H5Oget_info_by_name1",
CallingConvention = CallingConvention.Cdecl),
SuppressUnmanagedCodeSecurity, SecuritySafeCritical]
public extern static herr_t get_info_by_name
(hid_t loc_id, byte[] name, ref info_t oinfo,
hid_t lapl_id = H5P.DEFAULT);

/// <summary>
/// Retrieves the metadata for an object, identifying the object by
/// location and relative name.
/// See https://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfoByName
/// </summary>
/// <param name="loc_id">File or group identifier specifying location
/// of group in which object is located</param>
/// <param name="name">Name of group, relative to
/// <paramref name="loc_id"/></param>
/// <param name="oinfo">Buffer in which to return object information</param>
/// <param name="lapl_id">Link access property list</param>
/// <returns>Returns a non-negative value if successful; otherwise
/// returns a negative value.</returns>
/// <remarks>ASCII strings ONLY!</remarks>
[DllImport(Constants.DLLFileName, EntryPoint = "H5Oget_info_by_name1",
CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Ansi),
SuppressUnmanagedCodeSecurity, SecuritySafeCritical]
public extern static herr_t get_info_by_name
(hid_t loc_id, string name, ref info_t oinfo,
hid_t lapl_id = H5P.DEFAULT);

#else

/// <summary>
/// Retrieves the metadata for an object specified by an identifier.
/// See https://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
Expand Down Expand Up @@ -691,6 +799,8 @@ public extern static herr_t get_info_by_name
(hid_t loc_id, string name, ref info_t oinfo,
hid_t lapl_id = H5P.DEFAULT);

#endif

/// <summary>
/// Increments an object's reference count.
/// See https://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-IncrRefCount
Expand Down Expand Up @@ -858,6 +968,89 @@ public extern static hid_t open_by_idx
(hid_t loc_id, string group_name, H5.index_t idx_type,
H5.iter_order_t order, hsize_t n, hid_t lapl_id = H5P.DEFAULT);

#if HDF5_VER1_10

/// <summary>
/// Recursively visits all objects accessible from a specified object.
/// See https://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-Visit
/// </summary>
/// <param name="obj_id">Identifier of the object at which the
/// recursive iteration begins.</param>
/// <param name="idx_type">Type of index</param>
/// <param name="order">Order in which index is traversed</param>
/// <param name="op">Callback function passing data regarding the
/// object to the calling application</param>
/// <param name="op_data">User-defined pointer to data required by the
/// application for its processing of the object</param>
/// <returns>On success, returns the return value of the first operator
/// that returns a positive value, or zero if all members were
/// processed with no operator returning non-zero. On failure, returns
/// a negative value if something goes wrong within the library, or the
/// first negative value returned by an operator.</returns>
[DllImport(Constants.DLLFileName, EntryPoint = "H5Ovisit1",
CallingConvention = CallingConvention.Cdecl),
SuppressUnmanagedCodeSecurity, SecuritySafeCritical]
public extern static herr_t visit
(hid_t obj_id, H5.index_t idx_type, H5.iter_order_t order,
iterate_t op, IntPtr op_data);

/// <summary>
/// Recursively visits all objects starting from a specified object.
/// See https://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-VisitByName
/// </summary>
/// <param name="loc_id">Identifier of a file or group</param>
/// <param name="obj_name">Name of the object, generally relative to
/// <paramref name="loc_id"/>, that will serve as root of the iteration</param>
/// <param name="idx_type">Type of index</param>
/// <param name="order">Order in which index is traversed</param>
/// <param name="op">Callback function passing data regarding the
/// object to the calling application</param>
/// <param name="op_data">User-defined pointer to data required by the
/// application for its processing of the object</param>
/// <param name="lapl_id">Link access property list identifier</param>
/// <returns>On success, returns the return value of the first operator
/// that returns a positive value, or zero if all members were
/// processed with no operator returning non-zero. On failure, returns
/// a negative value if something goes wrong within the library, or the
/// first negative value returned by an operator.</returns>
[DllImport(Constants.DLLFileName, EntryPoint = "H5Ovisit_by_name1",
CallingConvention = CallingConvention.Cdecl),
SuppressUnmanagedCodeSecurity, SecuritySafeCritical]
public extern static herr_t visit_by_name
(hid_t loc_id, byte[] obj_name, H5.index_t idx_type,
H5.iter_order_t order, iterate_t op, IntPtr op_data,
hid_t lapl_id = H5P.DEFAULT);

/// <summary>
/// Recursively visits all objects starting from a specified object.
/// See https://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-VisitByName
/// </summary>
/// <param name="loc_id">Identifier of a file or group</param>
/// <param name="obj_name">Name of the object, generally relative to
/// <paramref name="loc_id"/>, that will serve as root of the iteration</param>
/// <param name="idx_type">Type of index</param>
/// <param name="order">Order in which index is traversed</param>
/// <param name="op">Callback function passing data regarding the
/// object to the calling application</param>
/// <param name="op_data">User-defined pointer to data required by the
/// application for its processing of the object</param>
/// <param name="lapl_id">Link access property list identifier</param>
/// <returns>On success, returns the return value of the first operator
/// that returns a positive value, or zero if all members were
/// processed with no operator returning non-zero. On failure, returns
/// a negative value if something goes wrong within the library, or the
/// first negative value returned by an operator.</returns>
[DllImport(Constants.DLLFileName, EntryPoint = "H5Ovisit_by_name1",
CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Ansi),
SuppressUnmanagedCodeSecurity, SecuritySafeCritical]
public extern static herr_t visit_by_name
(hid_t loc_id, string obj_name, H5.index_t idx_type,
H5.iter_order_t order, iterate_t op, IntPtr op_data,
hid_t lapl_id = H5P.DEFAULT);

#else

/// <summary>
/// Recursively visits all objects accessible from a specified object.
/// See https://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-Visit
Expand Down Expand Up @@ -936,5 +1129,8 @@ public extern static herr_t visit_by_name
(hid_t loc_id, string obj_name, H5.index_t idx_type,
H5.iter_order_t order, iterate_t op, IntPtr op_data,
hid_t lapl_id = H5P.DEFAULT);

#endif

}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ of .NET bindings for HDF5, not the [LCM](https://en.wikipedia.org/wiki/Least_com
| HDF5 Release Version | Assembly Version | Assembly File Version | Git Tag |
| ---------------------------------------------------------------------- | ---------------- | --------------------------------------------------------------- | ------- |
| [1.8.20](https://portal.hdfgroup.org/display/support/Downloads) | 1.8.20.0 | [1.8.20.0](https://www.nuget.org/packages/HDF.PInvoke/1.8.20.0) | v1.8.20.0 |
| [1.10.2](https://portal.hdfgroup.org/display/support/Downloads) | 1.10.2.0 | [1.10.2.0](https://www.nuget.org/packages/HDF.PInvoke/1.10.2.0) | v1.10.2.0 |
| [1.10.3](https://portal.hdfgroup.org/display/support/Downloads) | 1.10.3.0 | [1.10.3.0](https://www.nuget.org/packages/HDF.PInvoke/1.10.3.0) | v1.10.3.0 |

[How "stuff" is versioned.](../../wiki/Versioning-and-Releases)

Expand All @@ -30,7 +30,7 @@ To install the latest HDF.PInvoke 1.8, run the following command in the
To install the latest HDF.PInvoke 1.10, run the following command in the
[Package Manager Console](https://docs.nuget.org/docs/start-here/using-the-package-manager-console)
```
Install-Package HDF.PInvoke -Version 1.10.2.0
Install-Package HDF.PInvoke -Version 1.10.3.0
```

# Prerequisites
Expand Down
6 changes: 6 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
##### 1.10.3.0
* Updated native dependencies (HDF5 1.10.3)
* API versioning for H5O[get_info*,visit*]
* Moved H5DO[read,write]_chunk to H5D[read,write]_chunk
* General performance improvements (native library)

##### 1.10.2.0
* Updated native dependencies (HDF5 1.10.2)
* VDS H5P.[g,s]et_virtual_prefix
Expand Down
Binary file modified images/The HDF Group.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/hdf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit cc64452

Please sign in to comment.