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
34
35
36
37
38
39
40
 int
 saf_read_alternate_indexspec(SAF_ParMode pmode,         /* The parallel mode. */
                              SAF_AltIndexSpec *aspec,   /* The alternate index spec handle to read. */
                              void **buf                 /* The buffer to be filled in with the data. */
                              )
 {
     SAF_ENTER(saf_read_alternate_indexspec, SAF_PRECONDITION_ERROR);
     double              timer_start=0;
     ss_collection_t     coll=SS_COLLECTION_NULL;

     SAF_REQUIRE(_saf_valid_pmode(pmode), SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
                 _saf_errmsg("PMODE must be valid"));
     if (!_saf_is_participating_proc(pmode)) SAF_RETURN(-1);

     SAF_REQUIRE(SS_INDEXSPEC(aspec), SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
                 _saf_errmsg("ASPEC must be a valid alt index spec handle"));
     SAF_REQUIRE(buf, SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
                 _saf_errmsg("BUF cannot be null"));

     /* Start the timer. */
     if (_SAF_GLOBALS.p.TraceTimes)
         timer_start = _saf_wall_clock(false);

     /* Obtain the collection record. */
     coll = SS_INDEXSPEC(aspec)->coll;
     if (!SS_COLLECTION(&coll))
         SAF_ERROR(SAF_FILE_ERROR, _saf_errmsg("unable to obtain collection record"));

     /* Read in the buf data. */
     if (SS_PERS_ISNULL(SS_INDEXSPEC_P(aspec,blob)))
         SAF_ERROR(SAF_FILE_ERROR, _saf_errmsg("attempt to read non-existent blob; there is no data for the alternate index spec"));
     if (NULL==(*buf=ss_blob_read1(SS_INDEXSPEC_P(aspec,blob), (hsize_t)0, (hsize_t)SS_COLLECTION(&coll)->count, 0U, NULL)))
         SAF_ERROR(SAF_FILE_ERROR, _saf_errmsg("unable to read buf alt index spec data"));

     /* Accumulate times */
     if (_SAF_GLOBALS.p.TraceTimes)
         _SAF_GLOBALS.CummReadTime += (_saf_wall_clock(false) - timer_start);

     SAF_LEAVE(SAF_SUCCESS);
 }