-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
add a method to handle optional produces()
#46960
Comments
assign core |
New categories assigned: core @Dr15Jones,@makortel,@smuzaffar you have been requested to review this Pull request/Issue and eventually sign? Thanks |
cms-bot internal usage |
A new Issue was created by @fwyzard. @Dr15Jones, @antoniovilela, @makortel, @mandrenguyen, @rappoccio, @sextonkennedy, @smuzaffar can you please review it and eventually sign/assign? Thanks. cms-bot commands are listed here |
Passing the output data product type to the recHitsTokenEE_{isPhase2_ ? device::EDPutToken<OutputProduct>{} : produces<OutputProduct>(ps.getParameter<std::string>("recHitsLabelEE"))} I acknowledge that suggestion sort of defeats the purpose of the non-typed We prefer to have this kind functionality in a standalone function rather than extending the interface of recHitsTokenEE_{produces_if(not isPhase2_, producesCollector(), ps.getParameter<std::string>("recHitsLabelEE"))} The same pattern should be extended to ED consumes (in ED modules) and ES consumes (in ED and ES modules). (Just to note that |
Mhm, the form you propose
is more verbose than
and also requires people to learn about What is the advantage of implementing the former instead of the latter ? |
After some further thought we should be able to make the following syntax to work recHitsTokenEE_{if_(isPhase2_, produces(ps.getParameter<std::string>("recHitsLabelEE")))} This approach would be even more composable and likely simpler to implement than the alternative. |
(inspired by #46453, but encountered a few times already)
Currently it's hard to initialise a token with
produces()
if the call is optional, for example controlled by another parameter.It can be done in the body of the constructor, but that prevents the use of
const
for the token data member:Ideally we could use something like this in the initialiser list:
but the type returned by
produces()
is aProducerBaseAdaptor
, not anEDPutToken
, so it doesn't work.Can we add a method like
does_not_produce()
to be used like?
Or even better a method like
produces_if()
to be used like?
The text was updated successfully, but these errors were encountered: