[rfile] Allow setting object titles when writing - #22898
Conversation
Test Results 20 files 20 suites 3d 9h 4m 35s ⏱️ For more details on these failures, see this check. Results for commit c1f3eb3. ♻️ This comment has been updated with latest results. |
dadb182 to
4741af9
Compare
jblomer
left a comment
There was a problem hiding this comment.
I am actually more in favor of special behavior for TObject arguments that understands/uses their title member. We can discuss.
Then call it from the current WriteObjectAny
4741af9 to
48895a6
Compare
I tend to lean towards bespoke code. Should we discuss this in a (zoom) meeting with a few people? |
To be clear:
// since a title wasn't passed to `Put`, the object key's title is implicitly set to `myTNamed.GetTitle()`
rfile->Put("myTNamed", myTNamed);
TNamed myTNamed;
// `myTNamed`'s title gets set to `"my title"`
rfile->Put("myTNamed", myTNamed, "my title");This is because Disadvantage of implementing 1: if we want a concise way to tell rfile "ignore this object's title and save it without title" for EDIT: for reference, see latest commit. |
This Pull request:
Adds the ability of storing object titles when writing objects to RFile.
CAVEATS/to be discussed:
rfile->Put("obj", obj, obj->GetTitle()));rfile->Put("obj", myTObject, "My Title")will not setmyTObject's title, but only its key's. This means that this potentially unexpected behavior will occur:In order to retrieve the object's title you'd need to do it from the key:
To be discussed: are we ok with this behavior or do we want bespoke TObject/TNamed code in the implementation to mitigate these pitfalls?