Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid use of "magic numbers", especially when deciding behavior based on version numbers #40

Open
eflumerf opened this issue Oct 6, 2022 · 0 comments

Comments

@eflumerf
Copy link
Member

eflumerf commented Oct 6, 2022

When looking at the changes in PR #38 , I noticed a lot of if(version >= 3) constructs, and was wondering if it might be better to have a HDF5FileVersion.h or similar which:

  • defines the current version as a C++ constand
  • contains a set of "feature flags" which can be checked in code (e.g. FormatContainsGeoIDs, FormatContainsSourceIDs), with a constructor that takes a given version number to set them appropriately
  • Uses pybind to expose these constants/flags to hdf5_dump.py to avoid having things explicitly coded there (such as detdataformats::DetID::Subdetector)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant