1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 void *
 ss_blob_bound_m1(ss_blob_t *blob,               /* Blob to query. */
                  hid_t *mtype,                  /* OUT: Optional pointer for memory datatype, duplicated from that stored in
                                                  * the blob. */
                  hsize_t *size                  /* OUT: Optional pointer to receive the number of elements pointed to by the
                                                  * memory bound to the blob. The extent and selection must be identical. */
                  )
 {
     SS_ENTER(ss_blob_bound_m1, voidP);
     void        *retval=NULL;
     hid_t       type=-1;
     int         ndims;
     hsize_t     start, count;

     SS_ASSERT_MEM(blob, ss_blob_t);

     if (NULL==(retval=SS_BLOB(blob)->m.mem)) SS_ERROR_FMT(USAGE, ("blob is not bound to memory"));
     if (mtype && (*mtype = type = H5Tcopy(SS_BLOB(blob)->m.mtype))<0) SS_ERROR(HDF5);

     if (size) {
         if ((ndims=ss_blob_ckspace(SS_BLOB(blob)->m.mspace, 1, size, &start, &count, NULL))<0) SS_ERROR(FAILED);
         if (0==ndims) {
             *size = 1;
         } else {
             if (start) SS_ERROR_FMT(USAGE, ("memory selection has non-zero offset"));
             if (count!=*size) SS_ERROR_FMT(USAGE, ("memory selection is not all elements of extent"));
         }
     }

  SS_CLEANUP:
     if (type>0) H5Tclose(type);
     SS_LEAVE(retval);
 }