Use base class pointers rather than templating #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.