-
Notifications
You must be signed in to change notification settings - Fork 99
Improve adding container to the container factory #950
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
Improve adding container to the container factory #950
Conversation
|
Could you please check and merge. |
|
The need for this kind of checking add function is very worrisome. What does a return value |
This only tells the caller that the framework could not add the object to the internal TList because an object with the same name already exist in the list. This is completely independent from the question who is the owner. The current way which is used all over the place in FairRoot and any derrived project is directly access the Internal TList (which is public) and call TList->Add directly. This works since years until you do a stupid copy and paste error. To use internal data members is a very bad idea but since the code is heavily used we can' change it without breaking all existing code. I agree that passing the raw pointer is not the desired way. Since the function is not used anywhere yet I will try to implement a proper interface. |
True. Still, if it is possible that your calling code tries to add the same object (not by name but by reference) twice to the I do not object this PR, especially if you intend to have a |
2b21e88 to
1b47a32
Compare
dennisklein
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the comment to the new interface.
1b47a32 to
aee909e
Compare
Add a function to add a container to the factory that also checks if the container already exist. If the container already exist it is not added again and kFALSE is returned. Otherwise it is added and kTRUE is returned. The "normal" way to add containers is to use the TList data member directly which will not report any errors when adding the container. Only when the destructor of the runtime database is called one will see an error message Error in <TList::Delete>: A list is accessing an object (0x55d2e2220550) already deleted (list name = TList)
aee909e to
57ff172
Compare
Add a function to add a container to the factory that also checks if the
container already exist. If the container already exist it is not added
again and kFALSE is returned. Otherwise it is added and kTRUE is returned.
The "normal" way to add containers is to use the TList data member directly
which will not report any errors when adding the container. Only when the
destructor of the runtime database is called one will see an error message
Error in TList::Delete: A list is accessing an object (0x55d2e2220550)
already deleted (list name = TList)
Checklist:
devbranch