Skip to content

NXDL: Common base class for NXroot and NXobject #1672

Open

Description

@woutdenolf

Problem

NXroot is the only base class that does not extend NXobject. This is on purpose: NXobject declares items the root must not have:

  • NeXus groups: NXcollection, NXdata, NXlog, NXnote, NXparameters, GROUPNAME_log;
  • NeXus fields: FIELDNAME_set, FIELDNAME_errors, FIELDNAME_weights, FIELDNAME_mask, identifierNAME.

But NXobject is also where NeXus declares what applies to every NeXus group and field (#1668, #1669). Since NXroot does not extend it, none of that reaches NXroot:

  • @NX_class is declared twice: required in NXobject and again in NXroot.
  • @default is declared twice: once in NXobject and once in NXroot, each with its own documentation.
  • The fieldAttributes of NXobject (@target, @units, @long_name, …) are copied into NXroot; a test keeps both copies the same.
  • Anything added to NXobject for every NeXus group and field later on has to be copied to NXroot by hand, or the root silently misses it.

Proposal

Add a new base class (name to be decided, e.g. NXnode) that holds only what applies to every NeXus group and field, the root included:

  • NeXus attributes of every NeXus group: @NX_class (required, valueFrom="class"), @default;
  • fieldAttributes: @target, @units, @long_name, …

Then:

  • NXobject extends it, adds the NeXus groups and fields listed above, and adds @target for groups;
  • NXroot extends it and adds the NeXus attributes of the root (file_name, file_time, NeXus_release, …).

Each shared item is then declared once, and NXroot picks up future additions automatically.

@target for groups stays in NXobject: the root cannot be a content link.

Questions for the NIAC

  • The name of the new class.
  • Should @default move to the common class, keeping the NXroot documentation (which says it points to an NXentry) as a refinement?
  • Does any tool assume that NXobject is the top of every inheritance chain, or that NXroot has no extends?

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions