Repository Public License
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : ORIX Convert9// File : Packages/EngineScientific/Sources/CHDF5Shim/include/CHDF5Shim.h10// Module : CHDF5Shim11// Repository : https://git.spboucher.ai/orix-convert12// Created : 2026-11-2113// Last Modified : 2026-11-2114//15// =============================================================================16// AUTHOR & PROFESSIONAL AFFILIATION17// =============================================================================18//19// Author : Simon-Pierre Boucher20// Position : Professor of Finance21// Institution : Université du Québec en Outaouais (UQO)22// Department : Département des sciences administratives23// Organization : SP Boucher24//25// Website : https://spboucher.ai26// Git : https://git.spboucher.ai27//28// =============================================================================29// OFFICIAL CONTACT DIRECTORY30// =============================================================================31//32// General : info@spboucher.ai33// Professional : contact@spboucher.ai34// Direct : simon@spboucher.ai35// Research : research@spboucher.ai36// Development : dev@spboucher.ai37// Support : support@spboucher.ai38// Security/Admin : admin@spboucher.ai39// Notifications : notifications@spboucher.ai40//41// Preferred Contact: support@spboucher.ai42//43// =============================================================================44// COPYRIGHT & INTELLECTUAL PROPERTY45// =============================================================================46//47// Copyright (c) 202648// Simon-Pierre Boucher49//50// All rights reserved where applicable.51//52// This file is governed by the applicable project license,53// copyright notices, institutional agreements and relevant law.54//55// Unless expressly authorized by the applicable license or56// rights holder, copying, redistribution, sublicensing,57// publication and commercial exploitation are not permitted.58//59// Existing third-party rights and notices remain unaffected.60//61// =============================================================================62// CONFIDENTIALITY & SECURITY63// =============================================================================64//65// Classification : Public66// Distribution : Public repository; use is governed by the project license67// Security Contact : admin@spboucher.ai68//69// Access to this source does not independently grant permission70// to redistribute or disclose confidential materials.71//72// Do not embed credentials, private keys, access tokens,73// certificates or confidential personal information.74//75// =============================================================================76// LICENSE & MAINTENANCE77// =============================================================================78//79// License : Proprietary, all rights reserved (see license file)80// License File : LICENSE81// Maintainer : Simon-Pierre Boucher82// Technical Contact: dev@spboucher.ai83//84// =============================================================================85// END OF SP BOUCHER SOURCE HEADER86// =============================================================================8788// ORIX Convert — Packages/EngineScientific/Sources/CHDF5Shim/include/CHDF5Shim.h89// Description: C shim over the HDF5 API for what Swift cannot import: macro identifiers (native types, property-list90// classes), the error stack, callbacks (external-link refusal, dimension-scale iteration) and the91// one-time hardening of the library (no plug-in loading).92// Author: Simon-Pierre Boucher — contact@spboucher.ai93#ifndef ORIX_CHDF5_SHIM_H94#define ORIX_CHDF5_SHIM_H9596#include <stddef.h>97#include <stdint.h>98#include <hdf5.h>99100/// Initialises the library once: plug-in loading disabled and the search path emptied, driver / VOL connector101/// environment overrides removed, automatic error printing turned off. Returns 0 on success.102int orix_h5_init(void);103104/// 1 when dynamic plug-in loading is disabled and the plug-in search table is empty.105int orix_h5_plugins_disabled(void);106107/// Copies the innermost message of the current error stack into `buffer` and clears the stack.108void orix_h5_last_error(char *buffer, size_t capacity);109110/// Native memory types.111typedef enum {112 ORIX_T_INT8, ORIX_T_UINT8, ORIX_T_INT16, ORIX_T_UINT16, ORIX_T_INT32, ORIX_T_UINT32, ORIX_T_INT64, ORIX_T_UINT64,113 ORIX_T_FLOAT, ORIX_T_DOUBLE, ORIX_T_C_S1, ORIX_T_STD_REF_OBJ, ORIX_T_IEEE_F32BE, ORIX_T_NATIVE_HBOOL,114 ORIX_T_STD_REF, ORIX_T_FLOAT16, ORIX_T_STD_B8LE, ORIX_T_UNIX_D32LE115} orix_type_t;116hid_t orix_h5_type(orix_type_t type);117118/// Property-list classes.119typedef enum {120 ORIX_P_FILE_ACCESS, ORIX_P_FILE_CREATE, ORIX_P_DATASET_CREATE, ORIX_P_DATASET_ACCESS, ORIX_P_DATASET_XFER,121 ORIX_P_LINK_ACCESS, ORIX_P_LINK_CREATE, ORIX_P_GROUP_CREATE, ORIX_P_ATTRIBUTE_CREATE, ORIX_P_DATATYPE_CREATE,122 ORIX_P_GROUP_ACCESS, ORIX_P_DATATYPE_ACCESS123} orix_plist_t;124hid_t orix_h5_plist_class(orix_plist_t cls);125126/// File-access property list for untrusted files: no file locking, strong close degree; for writing, format bounds127/// pinned to the 1.8 file format so every HDF5 / netCDF-4 reader can open the result.128hid_t orix_h5_fapl(int forWriting);129130/// Link-access property list whose external-link callback refuses every traversal.131hid_t orix_h5_lapl_no_external(void);132133/// Access property list of the given class (link, dataset, group or datatype access) whose external-link callback134/// refuses every traversal. Every open-by-path on an untrusted file must use one of these.135hid_t orix_h5_safe_access_plist(orix_plist_t cls);136137/// 1 when the library's external-link class has been replaced by one whose traversal always fails, so that no138/// external link can be followed whatever property list a call uses.139int orix_h5_external_links_disabled(void);140141/// Number of external-link traversals refused since start (for tests).142long orix_h5_external_refusals(void);143144/// Path of the first dimension scale attached to dimension `index` of a dataset. Returns the number of scales145/// attached (0 when none), or a negative value on error. `buffer` receives an empty string when there is none.146int orix_h5_scale_path(hid_t dataset, unsigned index, char *buffer, size_t capacity);147148/// H5S_UNLIMITED.149hsize_t orix_h5_unlimited(void);150151/// H5T_VARIABLE.152size_t orix_h5_variable(void);153154/// Library version as "major.minor.release".155void orix_h5_version(char *buffer, size_t capacity);156157#endif158