Ignore:
Timestamp:
14/04/09 18:56:40 (3 years ago)
Author:
Freddie Akeroyd
Message:

Merg in r1212:r1222 from trunk. Refs #115.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/include/napi.h

    r1206 r1230  
    2727/** \file  
    2828 * Documentation for the NeXus-API version 4.2 
    29  * 2000-2007, the NeXus group  
     29 * 2000-2007, the NeXus group 
     30 * \defgroup c_main C API  
     31 * \defgroup c_types Data Types 
     32 * \ingroup c_main 
     33 * \defgroup c_init General Initialisation and shutdown 
     34 * \ingroup c_main 
     35 * \defgroup c_readwrite Reading and Writing 
     36 * \ingroup c_main 
     37 * \defgroup c_metadata Meta data routines 
     38 * \ingroup c_main 
     39 * \defgroup c_linking Linking and Group hierarchy 
     40 * \ingroup c_main 
     41 * \defgroup c_memory Memory allocation 
     42 * \ingroup c_main 
     43 * \defgroup c_external External linking 
     44 * \ingroup c_main 
     45 * \defgroup cpp_main C++ API 
    3046 */ 
    3147   
     
    95111 
    96112/** \var NeXus data types 
     113 * \ingroup c_types 
    97114 * \li NX_FLOAT32     32 bit float 
    98115 * \li NX_FLOAT64     64 nit float == double 
     
    182199 
    183200#    define NXgetinfo           MANGLE(nxigetinfo) 
     201#    define NXgetrawinfo        MANGLE(nxigetrawinfo) 
    184202#    define NXgetnextentry      MANGLE(nxigetnextentry) 
    185203#    define NXgetdata           MANGLE(nxigetdata) 
     
    243261   * \param pHandle A file handle which will be initialized upon successfull completeion of NXopen. 
    244262   * \return NX_OK on success, NX_ERROR in the case of an error.    
     263   * \ingroup c_init 
    245264   */ 
    246265extern  NXstatus  NXopen(CONSTCHAR * filename, NXaccess access_method, NXhandle* pHandle); 
     266 
    247267  /** 
    248268   * close a NeXus file 
     
    250270   * call. 
    251271   * \return NX_OK on success, NX_ERROR in the case of an error.    
     272   * \ingroup c_init 
    252273   */ 
    253274extern  NXstatus  NXclose(NXhandle* pHandle); 
     275 
    254276  /** 
    255277   * flush data to disk 
    256278   * \param pHandle A NeXus file handle as initialized by NXopen.  
    257279   * \return NX_OK on success, NX_ERROR in the case of an error.    
     280   * \ingroup c_readwrite 
    258281   */ 
    259282extern  NXstatus  NXflush(NXhandle* pHandle); 
     
    266289   * \param NXclass the class name of the group. Should start with the prefix NX 
    267290   * \return NX_OK on success, NX_ERROR in the case of an error.    
     291   * \ingroup c_init 
    268292   */ 
    269293extern  NXstatus  NXmakegroup (NXhandle handle, CONSTCHAR *name, CONSTCHAR* NXclass); 
     294 
    270295  /** 
    271296   * Step into a group. All further access will be within the opened group. 
     
    274299   * \param NXclass the class name of the group. Should start with the prefix NX 
    275300   * \return NX_OK on success, NX_ERROR in the case of an error.    
     301   * \ingroup c_init 
    276302   */ 
    277303extern  NXstatus  NXopengroup (NXhandle handle, CONSTCHAR *name, CONSTCHAR* NXclass); 
     304 
    278305  /** 
    279306   * Open the NeXus object with the path specified 
     
    283310   * Example: /entry1/sample/name  
    284311   * \return NX_OK on success, NX_ERROR in the case of an error.    
     312   * \ingroup c_init 
    285313   */ 
    286314extern  NXstatus  NXopenpath (NXhandle handle, CONSTCHAR *path); 
     315 
    287316  /** 
    288317   * Opens the group in which the NeXus object with the specified path exists 
     
    292321   * Example: /entry1/sample/name  
    293322   * \return NX_OK on success, NX_ERROR in the case of an error.    
     323   * \ingroup c_readwrite 
    294324   */ 
    295325extern  NXstatus  NXopengrouppath (NXhandle handle, CONSTCHAR *path); 
     326 
    296327  /** 
    297328   * Closes the currently open group and steps one step down in the NeXus file  
    298329   * hierarchy. 
    299330   * \return NX_OK on success, NX_ERROR in the case of an error.    
     331   * \ingroup c_init 
    300332   */ 
    301333extern  NXstatus  NXclosegroup(NXhandle handle); 
     334 
    302335  /** 
    303336   * Create a multi dimensional data array or dataset. The dataset is NOT opened.  
     
    309342   * can be NX_UNLIMITED. Data can be appended to such a dimension using NXputslab.  
    310343   * \return NX_OK on success, NX_ERROR in the case of an error.    
     344   * \ingroup c_init 
    311345   */ 
    312346extern  NXstatus  NXmakedata (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int dim[]); 
     347 
    313348  /** 
    314349   * Create a compressed dataset. The dataset is NOT opened. Data from this set will automatically be compressed when  
     
    329364   * should be the same as the data dimension. If you write it in slabs, this is your preferred slab size.  
    330365   * \return NX_OK on success, NX_ERROR in the case of an error.    
     366   * \ingroup c_init 
    331367   */ 
    332368extern  NXstatus  NXcompmakedata (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int dim[], int comp_typ, int bufsize[]); 
     369 
    333370  /** 
    334371   * Switch compression on. This routine is superseeded by NXcompmakedata and thus  
     
    340377   * \li NX_COMP_RLE run length encoding (only HDF-4) 
    341378   * \li NX_COMP_HUF Huffmann encoding (only HDF-4) 
     379   * \ingroup c_init 
    342380   */ 
    343381extern  NXstatus  NXcompress (NXhandle handle, int compr_type); 
     382 
    344383  /** 
    345384   * Open access to a dataset. After this call it is possible to write and read data or  
     
    348387   * \param label The name of the dataset 
    349388   * \return NX_OK on success, NX_ERROR in the case of an error.    
     389   * \ingroup c_init 
    350390   */ 
    351391extern  NXstatus  NXopendata (NXhandle handle, CONSTCHAR* label); 
     392 
    352393  /** 
    353394   * Close access to a dataset.  
    354395   * \param handle A NeXus file handle as initialized by NXopen.  
    355396   * \return NX_OK on success, NX_ERROR in the case of an error.    
     397   * \ingroup c_readwrite 
    356398   */ 
    357399extern  NXstatus  NXclosedata(NXhandle handle); 
     400 
    358401  /** 
    359402   * Write data to a datset which has previouly been opened with NXopendata.  
     
    363406   * \param data Pointer to data to write. 
    364407   * \return NX_OK on success, NX_ERROR in the case of an error.    
     408   * \ingroup c_init 
    365409   */ 
    366410extern  NXstatus  NXputdata(NXhandle handle, void* data); 
     411 
    367412  /** 
    368413   * Write an attribute. The kind of attribute written depends on the   
     
    376421   * \param iType The NeXus data type of the attribute.  
    377422   * \return NX_OK on success, NX_ERROR in the case of an error.    
     423   * \ingroup c_readwrite 
    378424   */ 
    379425extern  NXstatus  NXputattr(NXhandle handle, CONSTCHAR* name, void* data, int iDataLen, int iType); 
     426 
    380427  /** 
    381428   * Write  a subset of a multi dimensional dataset. 
     
    385432   * \param size An array holding the size of the data subset to write in each dimension. 
    386433   * \return NX_OK on success, NX_ERROR in the case of an error.    
     434   * \ingroup c_readwrite 
    387435   */ 
    388436extern  NXstatus  NXputslab(NXhandle handle, void* data, int start[], int size[]);     
     437 
    389438  /** 
    390439   * Retrieve link data for a dataset. This link data can later on be used to link this  
     
    394443   * for linking.  
    395444   * \return NX_OK on success, NX_ERROR in the case of an error.    
     445   * \ingroup c_readwrite 
    396446   */ 
    397447extern  NXstatus  NXgetdataID(NXhandle handle, NXlink* pLink); 
     448 
    398449  /** 
    399450   * Create a link to the group or dataset described by pLink in the currently open  
     
    403454   * by either a call to NXgetdataID or NXgetgroupID. 
    404455   * \return NX_OK on success, NX_ERROR in the case of an error.    
     456   * \ingroup c_readwrite 
    405457   */ 
    406458extern  NXstatus  NXmakelink(NXhandle handle, NXlink* pLink); 
     459 
    407460  /** 
    408461   * Create a link to the group or dataset described by pLink in the currently open  
     
    413466   * by either a call to NXgetdataID or NXgetgroupID. 
    414467   * \return NX_OK on success, NX_ERROR in the case of an error.    
     468   * \ingroup c_linking 
    415469   */ 
    416470extern  NXstatus  NXmakenamedlink(NXhandle handle, CONSTCHAR* newname, NXlink* pLink); 
     471 
    417472  /** 
    418473   * Open the source group of a linked group or dataset. Returns an error when the item is  
     
    420475   * \param handle A NeXus file handle as initialized by NXopen. 
    421476   * \return NX_OK on success, NX_ERROR in the case of an error.    
     477   * \ingroup c_linking 
    422478   */ 
    423479extern  NXstatus  NXopensourcegroup(NXhandle handle); 
     480 
    424481  /** 
    425482   * Read a complete dataset from the currently open dataset into memory.  
     
    429486   * and unwelcome ways. 
    430487   * \return NX_OK on success, NX_ERROR in the case of an error.    
     488   * \ingroup c_readwrite 
    431489   */ 
    432490extern  NXstatus  NXgetdata(NXhandle handle, void* data); 
     491 
    433492  /** 
    434493   * Retrieve information about the curretly open dataset. 
     
    440499   * \param datatype A pointer to an integer which be set to the NeXus data type code for this dataset. 
    441500   * \return NX_OK on success, NX_ERROR in the case of an error.    
     501   * \ingroup c_metadata 
    442502   */ 
    443503extern  NXstatus  NXgetinfo(NXhandle handle, int* rank, int dimension[], int* datatype); 
     504 
    444505  /** 
    445506   * Get the next entry in the currently open group. This is for retrieving infromation about the  
     
    451512   * \param datatype The NeXus data type if the item is a SDS.  
    452513   * \return NX_OK on success, NX_ERROR in the case of an error, NX_EOD when there are no more items.    
     514   * \ingroup c_readwrite 
    453515   */ 
    454516extern  NXstatus  NXgetnextentry(NXhandle handle, NXname name, NXname nxclass, int* datatype); 
     517 
    455518  /** 
    456519   * Read a subset of data from file into memory.  
     
    461524   * \param size An array holding the size of the data subset to read for each dimension. 
    462525   * \return NX_OK on success, NX_ERROR in the case of an error.    
     526   * \ingroup c_readwrite 
    463527   */ 
    464528extern  NXstatus  NXgetslab(NXhandle handle, void* data, int start[], int size[]); 
     529 
    465530  /** 
    466531   * Iterate over global, group or dataset attributes depending on the currently open group or  
     
    472537   * \param iType A pointer to an integer which be set to the NeXus data type of the attribute. 
    473538   * \return NX_OK on success, NX_ERROR in the case of an error, NX_EOD when there are no more items.    
     539   * \ingroup c_readwrite 
    474540   */ 
    475541extern  NXstatus  NXgetnextattr(NXhandle handle, NXname pName, int *iLength, int *iType); 
     542 
    476543  /** 
    477544   * Read an attribute. 
     
    482549   * \param iType A pointer to an integer which will had been set to the NeXus data type of the attribute. 
    483550   * \return NX_OK on success, NX_ERROR in the case of an error.    
     551   * \ingroup c_readwrite 
    484552   */ 
    485553extern  NXstatus  NXgetattr(NXhandle handle, char* name, void* data, int* iDataLen, int* iType); 
     554 
    486555  /** 
    487556   * Get the count of attributes in the currently open dataset, group or global attributes when at root level. 
     
    489558   * \param no_items A pointer to an integer which be set to the number of attributes available. 
    490559   * \return NX_OK on success, NX_ERROR in the case of an error.    
     560   * \ingroup c_readwrite 
    491561   */ 
    492562extern  NXstatus  NXgetattrinfo(NXhandle handle, int* no_items); 
     563 
    493564  /** 
    494565   * Retrieve link data for the currently open group. This link data can later on be used to link this  
     
    498569   * for linking.  
    499570   * \return NX_OK on success, NX_ERROR in the case of an error.    
     571   * \ingroup c_readwrite 
    500572   */ 
    501573extern  NXstatus  NXgetgroupID(NXhandle handle, NXlink* pLink); 
     574 
    502575  /** 
    503576   * Retrieve information about the currently open group. 
     
    509582   * \param nxclass The NeXus class name of the group. 
    510583   * \return NX_OK on success, NX_ERROR in the case of an error.    
     584   * \ingroup c_readwrite 
    511585   */ 
    512586extern  NXstatus  NXgetgroupinfo(NXhandle handle, int* no_items, NXname name, NXname nxclass); 
     587 
    513588  /** 
    514589   * Tests if two link data structures describe the same item. 
     
    517592   * \param pSecondID The second link data structure. 
    518593   * \return NX_OK when both link data structures describe the same item, NX_ERROR else.    
     594   * \ingroup c_readwrite 
    519595   */ 
    520596extern  NXstatus  NXsameID(NXhandle handle, NXlink* pFirstID, NXlink* pSecondID); 
     
    524600   * \param handle A NeXus file handle as initialized by NXopen. 
    525601   * \return NX_OK on success, NX_ERROR in the case of an error.    
     602   * \ingroup c_readwrite 
    526603   */ 
    527604extern  NXstatus  NXinitgroupdir(NXhandle handle); 
     605 
    528606  /** 
    529607   * Resets a pending attribute search to the start again. To be called in a Nxgetnextattr loop when  
     
    531609   * \param handle A NeXus file handle as initialized by NXopen. 
    532610   * \return NX_OK on success, NX_ERROR in the case of an error.    
     611   * \ingroup c_readwrite 
    533612   */ 
    534613extern  NXstatus  NXinitattrdir(NXhandle handle); 
     614 
    535615  /** 
    536616   * Sets the format for number printing. This call has only an effect when using the XML physical file  
     
    540620   * \param format The C-language format string to use for this data type. 
    541621   * \return NX_OK on success, NX_ERROR in the case of an error.    
     622   * \ingroup c_readwrite 
    542623   */ 
    543624extern  NXstatus  NXsetnumberformat(NXhandle handle, int type, char *format); 
     625 
    544626  /** 
    545627   * Inquire the filename of the currently open file. FilenameBufferLength of the file name  
     
    549631   * \param  filenameBufferLength The length of the filename buffer. 
    550632   * \return NX_OK on success, NX_ERROR in the case of an error.    
     633   * \ingroup c_readwrite 
    551634   */ 
    552635extern  NXstatus  NXinquirefile(NXhandle handle, char *filename, int filenameBufferLength); 
     636 
    553637  /** 
    554638   * Test if a group is actually pointing to an external file. If so, retrieve the URL of the  
     
    560644   * \param urlLen The length of the Url buffer. At maximum urlLen bytes will be copied to url. 
    561645   * \return NX_OK when the group is pointing to an external file, NX_ERROR else. 
     646   * \ingroup c_readwrite 
    562647   */ 
    563648extern  NXstatus  NXisexternalgroup(NXhandle handle, CONSTCHAR *name, CONSTCHAR *nxclass, char *url, int urlLen);  
     649 
    564650  /** 
    565651   * Create a link to an external file. This works by creating a NeXus group under the current level in  
     
    572658   * path to the group in the external file which appears in the first file.   
    573659   * \return NX_OK on success, NX_ERROR in the case of an error.    
     660   * \ingroup c_readwrite 
    574661   */ 
    575662extern  NXstatus  NXlinkexternal(NXhandle handle, CONSTCHAR *name, CONSTCHAR *nxclass, CONSTCHAR *url); 
     663 
    576664  /** 
    577665   * Utility function which allocates a suitably sized memory area for the dataset characteristics specified. 
     
    581669   * \param datatype The NeXus data type of the data. 
    582670   * \return NX_OK when allocation succeeds, NX_ERROR in the case of an error.    
     671   * \ingroup c_memory 
    583672   */  
    584673extern  NXstatus  NXmalloc(void** data, int rank, int dimensions[], int datatype); 
     674 
    585675  /** 
    586676   * Utility function to release the memory for data. 
    587677   * \param data A pointer to a pointer to free. 
    588678   * \return NX_OK on success, NX_ERROR in the case of an error.    
     679   * \ingroup c_memory 
    589680   */ 
    590681extern  NXstatus  NXfree(void** data); 
     
    594685    NAPI internals  
    595686------------------------------------------------------------------------*/ 
     687  /** 
     688   * Retrieve information about the currently open dataset. In contrast to the main function below,  
     689   * this function does not try to find out about the size of strings properly.  
     690   * \param handle A NeXus file handle as initialized by NXopen. 
     691   * \param rank A pointer to an integer which will be filled with the rank of  
     692   * the dataset. 
     693   * \param dimension An array which will be initialized with the size of the dataset in any of its  
     694   * dimensions. The array must have at least the size of rank. 
     695   * \param datatype A pointer to an integer which be set to the NeXus data type code for this dataset. 
     696   * \return NX_OK on success, NX_ERROR in the case of an error.    
     697   * \ingroup c_metadata 
     698   */ 
     699extern  NXstatus  NXgetrawinfo(NXhandle handle, int* rank, int dimension[], int* datatype); 
     700 
    596701/** \typedef void (*ErrFunc)(void *data, char *text) 
    597702 * All NeXus error reporting happens through this special function, the  
     
    603708 */ 
    604709typedef void (*ErrFunc)(void *data, char *text); 
     710 
    605711  /** 
    606712   * Set an error function. 
     
    610716   */ 
    611717extern  void  NXMSetError(void *pData, ErrFunc newErr); 
     718 
    612719  /** 
    613720   * Retrieve the current error display function 
     
    615722   */ 
    616723extern ErrFunc NXMGetError(); 
     724 
    617725  /** 
    618726   * Suppress error reports from the NeXus-API 
    619727   */ 
    620728extern  void  NXMDisableErrorReporting(); 
     729 
    621730  /** 
    622731   * Enable error reports from the NeXus-API 
Note: See TracChangeset for help on using the changeset viewer.