Skip to content

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.

@jbeilstenedmands jbeilstenedmands marked this pull request as draft May 9, 2025 09:39
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.

2 participants