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

Corrected PyBind Enum Names #25

Merged
merged 1 commit into from
May 14, 2024

Conversation

aeoranday
Copy link
Member

This closes issue #11. Accessing the enums in python was tested as follows:

import trgdataformats
print(trgdataformats.TriggerActivityData.Algorithm.kPrescale.name)   # kPrescale
print(trgdataformats.TriggerActivityData.Algorithm.kPrescale.value)  # 2
print(trgdataformats.TriggerActivityData.Type.kTPC.name)   # kTPC
print(trgdataformats.TriggerActivityData.Type.kTPC.value)  # 1

This was repeated for trgdataformats.TriggerPrimitive and trgdataformats.TriggerCandidateData and various other types and algorithms. I also tested the functionality in trgtools and found that everything continued to work as expected.

@aeoranday aeoranday added the maintenance Addresses a user request or a change in another part of the system label May 10, 2024
@aeoranday aeoranday self-assigned this May 10, 2024
@jcfreeman2
Copy link
Contributor

If I use the original (patch/fddaq-v4.4.x) branch, then the enum value appears for only one of the class types, and that without any qualification. E.g., if I do

from trgdataformats import *
kChannelAdjacency

then I get <TriggerCandidateData::Algorithm.kChannelAdjacency: 12>...but have no way to get the enum of the same name for TriggerActivityData, thanks to the complications caused by the double colon.

On the other hand, if I use Alex's branch, I can do:

from trgdataformats import *
TriggerCandidateData.Algorithm.kChannelAdjacency

and get <Algorithm.kChannelAdjacency: 12>, but also TriggerActivityData.Algorithm.kChannelAdjacency and get <Algorithm.kChannelAdjacency: 10>.

@aeoranday aeoranday merged commit 7def7b3 into patch/fddaq-v4.4.x May 14, 2024
1 check passed
@aeoranday aeoranday deleted the aeoranday/pybind-enum-naming branch May 14, 2024 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Addresses a user request or a change in another part of the system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants