Skip to content

Use base class pointers rather than templating #7

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jbeilstenedmands
Copy link
Contributor

After considering how to best to allow runtime polymorphism as part of model creation during serialization, I think we should not use templates in the experiment class, rather use shared pointers to a base class.
So far I have only implemented a beam class hierarchy, but I think we will need the same for scan, detector and perhaps others too (templating on all these would become cumbersome). The shared pointer is a similar approach to the existing dxtbx experiment code.

An example of how the usage changes in the indexer code is here: DiamondLightSource/fast-feedback-service@main...dx2_used_shared_ptrs
This then allows dynamic creation at runtime, an in application code the correct type is checked after a dynamic_cast at the start of the program.

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

Successfully merging this pull request may close these issues.

1 participant