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

Use templated wrappers #30

Open
kwabenantim opened this issue Mar 20, 2024 · 1 comment
Open

Use templated wrappers #30

kwabenantim opened this issue Mar 20, 2024 · 1 comment
Assignees

Comments

@kwabenantim
Copy link
Member

Description

Use templating to reduce number of generated wrapper files. Many wrappers only vary in template arguments and the rest of the code is exactly the same.

For example, the aim would be to refactor this

register_AbstractCellPopulation2_2_class(m);
register_AbstractCellPopulation3_3_class(m);

into this:

register_AbstractCellPopulation_class<2, 2>(m);
register_AbstractCellPopulation_class<3, 3>(m);

The first requires separate wrappers to be created for AbstractCellPopulation2_2 and AbstractCellPopulation3_3. Counting hpp and cpp, this generates 4 files.

The second requires a single templated wrapper to be created for AbstractCellPopulation. This would only generate 2 files regardless of the number of different sets of template arguments required. This approach would only need each set of arguments to be explicitly instantiated.

@kwabenantim
Copy link
Member Author

kwabenantim commented Sep 24, 2024

This doesn't seem trivial as CastXML does not support uninstantiated templates https://github.com/CastXML/CastXML/blob/v0.3.4/doc/manual/castxml.1.rst#why-dont-i-see-templates-in-the-output.

This was referenced Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant