Ray Osborn ROsborn at anl.gov
Fri Jun 25 21:18:59 BST 1999

>    Ray,
>    NXgetgroupID returns exactly the pair you mentioned because this is the
>    data needed by NXlink to do a link. Same for NXgetdataID. So we would need
>    to change NXlink as well in order to get the necessary stuff for linking
>    back again. THe point is the NXget*ID pair and NXlink were created in
>    order to do the linking in one editing session. Are there any other uses
>    for these ID's?
>                                Mark

I've done some very quick tests, and I don't think that the present NAPI
works even with NXmakelink.  As I understand it, the Vgroup ID is created by
Vattach but becomes unusable after a Vdetach.  When I want to insert one
group into a second group, I do the following logical sequence

 NXopengroup [first group]
 NXgetgroupID [first group]
 NXclosegroup [first group]
 NXopengroup [second group]
 NXmakelink [link to first group]
 NXclosegroup [second group]

However, by the time I'm in the second group, I've already detached from the
first one, so the ID is a meaningless number.  The only permanent reference
to the first group is its tag/reference pair.  Following Mark's reply, I
checked that it's perfectly possible to use Vaddtagref, which uses the
tag/ref pair to identify the linked group, instead of Vinsert, which uses
the Vgroup ID.  Indeed, the Vinsert version failed to do the requested link,
whereas the Vaddtagref worked fine.

Therefore, in addition to the change I suggested before we need to amend
NXmakelink to the following :

  NXmakelink (NXhandle fid, NXlink* sLink)
    pNexusFile pFile;

    pFile = NXIassert (fid);

    if (pFile->iCurrentVG == 0) { /* root level, can not link here */
      return NX_ERROR;
    Vaddtagref (pFile->iCurrentVG, sLink->iTag, sLink->iRef);
    return NX_OK;

i.e. use Vaddtagref for both Vgroups and SDSs.  It's allowed by HDF.

Does this affect anyone's existing programs?  I guess that linking groups is
not as common as linking data items, so perhaps it's never come up before.

By the way, if the NAPI mailing list is agreed to this change, I will send a
message to the NeXus mailing list.  There are some very experienced users on
that list, whose opinion we had better obtain first.  If some of you still
don't agree, then I suggest we transfer the debate to the other list.

Dr Ray Osborn                Tel: +1 (630) 252-9011
Materials Science Division   Fax: +1 (630) 252-7777
Argonne National Laboratory  E-mail: ROsborn at anl.gov
Argonne, IL 60439-4845

More information about the NeXus-developers mailing list