|
| 1 | +/*--------------------------------------------------------------------------- |
| 2 | + NeXus - Neutron & X-ray Common Data Format |
| 3 | + |
| 4 | + Application Program Interface Header File |
| 5 | + |
| 6 | + Copyright (C) 2015 NeXus International Advisory Committee |
| 7 | + |
| 8 | + This library is free software; you can redistribute it and/or |
| 9 | + modify it under the terms of the GNU Lesser General Public |
| 10 | + License as published by the Free Software Foundation; either |
| 11 | + version 2 of the License, or (at your option) any later version. |
| 12 | + |
| 13 | + This library is distributed in the hope that it will be useful, |
| 14 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | + Lesser General Public License for more details. |
| 17 | + |
| 18 | + You should have received a copy of the GNU Lesser General Public |
| 19 | + License along with this library; if not, write to the Free Software |
| 20 | + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | + |
| 22 | + For further information, see <http://www.nexusformat.org> |
| 23 | + |
| 24 | + ----------------------------------------------------------------------------*/ |
| 25 | + |
| 26 | +#ifndef NEXUS_INTERNAL_API |
| 27 | +#define NEXUS_INTERNAL_API |
| 28 | + |
| 29 | +#include <napi.h> |
| 30 | + |
| 31 | +/*----------------------------------------------------------------------- |
| 32 | + NAPI internals |
| 33 | +------------------------------------------------------------------------*/ |
| 34 | + |
| 35 | +#ifdef __cplusplus |
| 36 | +extern "C" { |
| 37 | +#endif /* __cplusplus */ |
| 38 | + |
| 39 | + /** |
| 40 | + * Retrieve information about the currently open dataset. In contrast to the main function below, |
| 41 | + * this function does not try to find out about the size of strings properly. |
| 42 | + * \param handle A NeXus file handle as initialized by NXopen. |
| 43 | + * \param rank A pointer to an integer which will be filled with the rank of |
| 44 | + * the dataset. |
| 45 | + * \param dimension An array which will be initialized with the size of the dataset in any of its |
| 46 | + * dimensions. The array must have at least the size of rank. |
| 47 | + * \param datatype A pointer to an integer which be set to the NeXus data type code for this dataset. |
| 48 | + * \return NX_OK on success, NX_ERROR in the case of an error. |
| 49 | + * \ingroup c_metadata |
| 50 | + */ |
| 51 | +extern NXstatus NXgetrawinfo(NXhandle handle, int* rank, int dimension[], int* datatype); |
| 52 | + |
| 53 | + /** |
| 54 | + * @copydoc NXgetrawinfo |
| 55 | + */ |
| 56 | +extern NXstatus NXgetrawinfo64(NXhandle handle, int* rank, int64_t dimension[], int* datatype); |
| 57 | + |
| 58 | +/** \typedef void (*ErrFunc)(void *data, char *text) |
| 59 | + * All NeXus error reporting happens through this special function, the |
| 60 | + * ErrFunc. The NeXus-API allows to replace this error reporting function |
| 61 | + * through a user defined implementation. The default error function prints to stderr. User |
| 62 | + * defined ones may pop up dialog boxes or whatever. |
| 63 | + * \param data A pointer to some user defined data structure |
| 64 | + * \param text The text of the error message to display. |
| 65 | + */ |
| 66 | +typedef void (*ErrFunc)(void *data, char *text); |
| 67 | + |
| 68 | + /** |
| 69 | + * Set a global error function. |
| 70 | + * Not threadsafe. |
| 71 | + * \param pData A pointer to a user defined data structure which be passed to |
| 72 | + * the error display function. |
| 73 | + * \param newErr The new error display function. |
| 74 | + */ |
| 75 | +extern void NXMSetError(void *pData, ErrFunc newErr); |
| 76 | + |
| 77 | + /** |
| 78 | + * Set an error function for the current thread. |
| 79 | + * When used this overrides anything set in NXMSetError (for the current thread). |
| 80 | + * Use this method in threaded applications. |
| 81 | + * \param pData A pointer to a user defined data structure which be passed to |
| 82 | + * the error display function. |
| 83 | + * \param newErr The new error display function. |
| 84 | + */ |
| 85 | +extern void NXMSetTError(void *pData, ErrFunc newErr); |
| 86 | + |
| 87 | + /** |
| 88 | + * Retrieve the current error display function |
| 89 | + * \return The current error display function. |
| 90 | + */ |
| 91 | +extern ErrFunc NXMGetError(); |
| 92 | + |
| 93 | + /** |
| 94 | + * Suppress error reports from the NeXus-API |
| 95 | + */ |
| 96 | +extern void NXMDisableErrorReporting(); |
| 97 | + |
| 98 | + /** |
| 99 | + * Enable error reports from the NeXus-API |
| 100 | + */ |
| 101 | +extern void NXMEnableErrorReporting(); |
| 102 | + |
| 103 | + /** |
| 104 | + * Dispatches the error message to the error function defined by NXMSetTError |
| 105 | + */ |
| 106 | +extern void NXReportError(char *text); |
| 107 | + |
| 108 | + /** |
| 109 | + * Do not use, first parameter should be set by NXMSetTError |
| 110 | + */ |
| 111 | +extern void NXIReportError(void *pData,char *text); |
| 112 | +/* extern void *NXpData; */ |
| 113 | +extern char *NXIformatNeXusTime(); |
| 114 | + |
| 115 | +/** |
| 116 | + * A function for setting the default cache size for HDF-5 |
| 117 | + * \ingroup c_init |
| 118 | + */ |
| 119 | +extern NXstatus NXsetcache(long newVal); |
| 120 | + |
| 121 | + typedef struct { |
| 122 | + NXhandle pNexusData; |
| 123 | + NXstatus ( *nxreopen)(NXhandle pOrigHandle, NXhandle* pNewHandle); |
| 124 | + NXstatus ( *nxclose)(NXhandle* pHandle); |
| 125 | + NXstatus ( *nxflush)(NXhandle* pHandle); |
| 126 | + NXstatus ( *nxmakegroup) (NXhandle handle, CONSTCHAR *name, CONSTCHAR* NXclass); |
| 127 | + NXstatus ( *nxopengroup) (NXhandle handle, CONSTCHAR *name, CONSTCHAR* NXclass); |
| 128 | + NXstatus ( *nxclosegroup)(NXhandle handle); |
| 129 | + NXstatus ( *nxmakedata64) (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int64_t dim[]); |
| 130 | + NXstatus ( *nxcompmakedata64) (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int64_t dim[], int comp_typ, int64_t bufsize[]); |
| 131 | + NXstatus ( *nxcompress) (NXhandle handle, int compr_type); |
| 132 | + NXstatus ( *nxopendata) (NXhandle handle, CONSTCHAR* label); |
| 133 | + NXstatus ( *nxclosedata)(NXhandle handle); |
| 134 | + NXstatus ( *nxputdata)(NXhandle handle, const void* data); |
| 135 | + NXstatus ( *nxputattr)(NXhandle handle, CONSTCHAR* name, const void* data, int iDataLen, int iType); |
| 136 | + NXstatus ( *nxputattra)(NXhandle handle, CONSTCHAR* name, const void* data, const int rank, const int dim[], const int iType); |
| 137 | + NXstatus ( *nxputslab64)(NXhandle handle, const void* data, const int64_t start[], const int64_t size[]); |
| 138 | + NXstatus ( *nxgetdataID)(NXhandle handle, NXlink* pLink); |
| 139 | + NXstatus ( *nxmakelink)(NXhandle handle, NXlink* pLink); |
| 140 | + NXstatus ( *nxmakenamedlink)(NXhandle handle, CONSTCHAR *newname, NXlink* pLink); |
| 141 | + NXstatus ( *nxgetdata)(NXhandle handle, void* data); |
| 142 | + NXstatus ( *nxgetinfo64)(NXhandle handle, int* rank, int64_t dimension[], int* datatype); |
| 143 | + NXstatus ( *nxgetnextentry)(NXhandle handle, NXname name, NXname nxclass, int* datatype); |
| 144 | + NXstatus ( *nxgetslab64)(NXhandle handle, void* data, const int64_t start[], const int64_t size[]); |
| 145 | + NXstatus ( *nxgetnextattr)(NXhandle handle, NXname pName, int *iLength, int *iType); |
| 146 | + NXstatus ( *nxgetnextattra)(NXhandle handle, NXname pName, int *rank, int dim[], int *iType); |
| 147 | + NXstatus ( *nxgetattr)(NXhandle handle, char* name, void* data, int* iDataLen, int* iType); |
| 148 | + NXstatus ( *nxgetattra)(NXhandle handle, char* name, void* data); |
| 149 | + NXstatus ( *nxgetattrainfo)(NXhandle handle, NXname pName, int *rank, int dim[], int *iType); |
| 150 | + NXstatus ( *nxgetattrinfo)(NXhandle handle, int* no_items); |
| 151 | + NXstatus ( *nxgetgroupID)(NXhandle handle, NXlink* pLink); |
| 152 | + NXstatus ( *nxgetgroupinfo)(NXhandle handle, int* no_items, NXname name, NXname nxclass); |
| 153 | + NXstatus ( *nxsameID)(NXhandle handle, NXlink* pFirstID, NXlink* pSecondID); |
| 154 | + NXstatus ( *nxinitgroupdir)(NXhandle handle); |
| 155 | + NXstatus ( *nxinitattrdir)(NXhandle handle); |
| 156 | + NXstatus ( *nxsetnumberformat)(NXhandle handle, int type, char *format); |
| 157 | + NXstatus ( *nxprintlink)(NXhandle handle, NXlink* link); |
| 158 | + NXstatus ( *nxnativeexternallink)(NXhandle handle, CONSTCHAR* name, CONSTCHAR* externalfile, CONSTCHAR* remotetarget); |
| 159 | + NXstatus ( *nxnativeinquirefile)(NXhandle handle, char* externalfile, const int filenamelength); |
| 160 | + NXstatus ( *nxnativeisexternallink)(NXhandle handle, CONSTCHAR* name, char* url, int urllen); |
| 161 | + int stripFlag; |
| 162 | + int checkNameSyntax; |
| 163 | + } NexusFunction, *pNexusFunction; |
| 164 | + /*---------------------*/ |
| 165 | + extern long nx_cacheSize; |
| 166 | + |
| 167 | +#ifdef __cplusplus |
| 168 | +}; |
| 169 | +#endif /* __cplusplus */ |
| 170 | + |
| 171 | +#endif /* NEXUS_INTERNAL_API */ |
0 commit comments