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

Restructure headers. #872

Open
1uc opened this issue Nov 27, 2023 · 0 comments
Open

Restructure headers. #872

1uc opened this issue Nov 27, 2023 · 0 comments
Labels
v3 Anything that needs to be resolved before `v3`.

Comments

@1uc
Copy link
Collaborator

1uc commented Nov 27, 2023

Headers currently follow the pattern:

// file: H5*.hpp

// A carefully curated list of HighFive includes.

namespace HighFive {
// declarations.
}

// All definitions go here:
#include "bits/H5*_misc.hpp"

This has certain consequences, such as a not entirely obvious include graph and users can't just include what they need. Users that would like to reduce compilation times would need to be able to pick between declarations and definitions.

The structure I'd like to move towards is that for every public class we have the following files:

  • One file for forward declarations *_fwd.hpp
  • One file for declarations *_decl.hpp
  • One file for non-template definitions *_defn.hpp
  • One file for template definitions *_tmpl.hpp
  • One file without suffix that includes the previous four.

Not very picky users would include either highfive/highfive.hpp or highfive/H5{File,Group,Attribute,...}.hpp.

Since we now split decl from defn we can include at the top the declarations or forward declarations we need. There's no need for including at the end of the file anymore. As a consequence the correct ordering of which file to include when happens automatically.

Moreover, this should allow users to compile HighFive and only expose the declarations (and template definitions) in their headers.

This would not cause (m)any change to existing code that include highfive/H5File,Group,...}.hpp carefully and no changes to code that include highfive/highfive.hpp.

@1uc 1uc added the v3 Anything that needs to be resolved before `v3`. label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 Anything that needs to be resolved before `v3`.
Projects
None yet
Development

No branches or pull requests

1 participant