Make possible parameters and commands into enumerations, use templates to map parameters to types.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Currently, with the way the API works, you need to know the string name of the endpoint in xspd. I.e. to get something like beam energy, you do:
float beamEnergy = pDetector->GetVar<float>("beam_energy");
It would be nicer/more user-friendly if this looked more like:
float beamEnergy = pDetector->GetVar<XSPD::BeamEnergy>();
The type deduction could be done via template structs, and that way you'd get a compile error if your type is incorrect, instead of a runtime error like you do now.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the xspd API's GetVar implementation and the existing string endpoint definitions. Review how parameters and commands are represented, then determine how enumerations and template structs can map them to types. Done means callers can use an XSPD parameter such as BeamEnergy without a string name and incorrect type usage fails at compile time.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100