H5Spublic.h

00001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00002  * Copyright by The HDF Group.                                               *
00003  * Copyright by the Board of Trustees of the University of Illinois.         *
00004  * All rights reserved.                                                      *
00005  *                                                                           *
00006  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
00007  * terms governing use, modification, and redistribution, is contained in    *
00008  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
00009  * of the source code distribution tree; Copyright.html can be found at the  *
00010  * root level of an installed copy of the electronic HDF5 document set and   *
00011  * is linked from the top-level documents page.  It can also be found at     *
00012  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
00013  * access to either file, you may request a copy from help@hdfgroup.org.     *
00014  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00015 
00016 /*
00017  * This file contains public declarations for the H5S module.
00018  */
00019 #ifndef _H5Spublic_H
00020 #define _H5Spublic_H
00021 
00022 /* Public headers needed by this file */
00023 #include "H5public.h"
00024 #include "H5Ipublic.h"
00025 
00026 /* Define atomic datatypes */
00027 #define H5S_ALL         0
00028 #define H5S_UNLIMITED   ((hsize_t)(hssize_t)(-1))
00029 
00030 /* Define user-level maximum number of dimensions */
00031 #define H5S_MAX_RANK    32
00032 
00033 /* Different types of dataspaces */
00034 typedef enum H5S_class_t {
00035     H5S_NO_CLASS         = -1,  /*error                                      */
00036     H5S_SCALAR           = 0,   /*scalar variable                            */
00037     H5S_SIMPLE           = 1,   /*simple data space                          */
00038     H5S_NULL             = 2    /*null data space                            */
00039 } H5S_class_t;
00040 
00041 /* Different ways of combining selections */
00042 typedef enum H5S_seloper_t {
00043     H5S_SELECT_NOOP      = -1,  /* error                                     */
00044     H5S_SELECT_SET       = 0,   /* Select "set" operation                    */
00045     H5S_SELECT_OR,              /* Binary "or" operation for hyperslabs
00046                                  * (add new selection to existing selection)
00047                                  * Original region:  AAAAAAAAAA
00048                                  * New region:             BBBBBBBBBB
00049                                  * A or B:           CCCCCCCCCCCCCCCC
00050                                  */
00051     H5S_SELECT_AND,             /* Binary "and" operation for hyperslabs
00052                                  * (only leave overlapped regions in selection)
00053                                  * Original region:  AAAAAAAAAA
00054                                  * New region:             BBBBBBBBBB
00055                                  * A and B:                CCCC
00056                                  */
00057     H5S_SELECT_XOR,             /* Binary "xor" operation for hyperslabs
00058                                  * (only leave non-overlapped regions in selection)
00059                                  * Original region:  AAAAAAAAAA
00060                                  * New region:             BBBBBBBBBB
00061                                  * A xor B:          CCCCCC    CCCCCC
00062                                  */
00063     H5S_SELECT_NOTB,            /* Binary "not" operation for hyperslabs
00064                                  * (only leave non-overlapped regions in original selection)
00065                                  * Original region:  AAAAAAAAAA
00066                                  * New region:             BBBBBBBBBB
00067                                  * A not B:          CCCCCC
00068                                  */
00069     H5S_SELECT_NOTA,            /* Binary "not" operation for hyperslabs
00070                                  * (only leave non-overlapped regions in new selection)
00071                                  * Original region:  AAAAAAAAAA
00072                                  * New region:             BBBBBBBBBB
00073                                  * B not A:                    CCCCCC
00074                                  */
00075     H5S_SELECT_APPEND,          /* Append elements to end of point selection */
00076     H5S_SELECT_PREPEND,         /* Prepend elements to beginning of point selection */
00077     H5S_SELECT_INVALID          /* Invalid upper bound on selection operations */
00078 } H5S_seloper_t;
00079 
00080 /* Enumerated type for the type of selection */
00081 typedef enum {
00082     H5S_SEL_ERROR       = -1,   /* Error                        */
00083     H5S_SEL_NONE        = 0,    /* Nothing selected             */
00084     H5S_SEL_POINTS      = 1,    /* Sequence of points selected  */
00085     H5S_SEL_HYPERSLABS  = 2,    /* "New-style" hyperslab selection defined      */
00086     H5S_SEL_ALL         = 3,    /* Entire extent selected       */
00087     H5S_SEL_N                   /*THIS MUST BE LAST             */
00088 }H5S_sel_type;
00089 
00090 #ifdef __cplusplus
00091 extern "C" {
00092 #endif
00093 
00094 /* Functions in H5S.c */
00095 H5_DLL hid_t H5Screate(H5S_class_t type);
00096 H5_DLL hid_t H5Screate_simple(int rank, const hsize_t dims[],
00097                                const hsize_t maxdims[]);
00098 H5_DLL herr_t H5Sset_extent_simple(hid_t space_id, int rank,
00099                                     const hsize_t dims[],
00100                                     const hsize_t max[]);
00101 H5_DLL hid_t H5Scopy(hid_t space_id);
00102 H5_DLL herr_t H5Sclose(hid_t space_id);
00103 H5_DLL herr_t H5Sencode(hid_t obj_id, void *buf, size_t *nalloc);
00104 H5_DLL hid_t H5Sdecode(const void *buf);
00105 H5_DLL hssize_t H5Sget_simple_extent_npoints(hid_t space_id);
00106 H5_DLL int H5Sget_simple_extent_ndims(hid_t space_id);
00107 H5_DLL int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[],
00108                                       hsize_t maxdims[]);
00109 H5_DLL htri_t H5Sis_simple(hid_t space_id);
00110 H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
00111 H5_DLL herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op,
00112                                    const hsize_t start[],
00113                                    const hsize_t _stride[],
00114                                    const hsize_t count[],
00115                                    const hsize_t _block[]);
00116 /* #define NEW_HYPERSLAB_API */
00117 #ifdef NEW_HYPERSLAB_API
00118 H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op,
00119                                    const hsize_t start[],
00120                                    const hsize_t _stride[],
00121                                    const hsize_t count[],
00122                                    const hsize_t _block[]);
00123 H5_DLL herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op,
00124                                   hid_t space2_id);
00125 H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
00126                                   hid_t space2_id);
00127 #endif /* NEW_HYPERSLAB_API */
00128 H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
00129     size_t num_elem, const hsize_t *coord);
00130 H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
00131 H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
00132 H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id);
00133 H5_DLL htri_t H5Sextent_equal(hid_t sid1, hid_t sid2);
00134 H5_DLL herr_t H5Sselect_all(hid_t spaceid);
00135 H5_DLL herr_t H5Sselect_none(hid_t spaceid);
00136 H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
00137 H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
00138 H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
00139 H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
00140 H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
00141     hsize_t numblocks, hsize_t buf[/*numblocks*/]);
00142 H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
00143     hsize_t numpoints, hsize_t buf[/*numpoints*/]);
00144 H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[],
00145     hsize_t end[]);
00146 H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
00147 
00148 #ifdef __cplusplus
00149 }
00150 #endif
00151 #endif /* _H5Spublic_H */
00152