Skip to content

[rfile] Allow setting object titles when writing#22898

Open
silverweed wants to merge 4 commits into
root-project:masterfrom
silverweed:rfile_cleanups
Open

[rfile] Allow setting object titles when writing#22898
silverweed wants to merge 4 commits into
root-project:masterfrom
silverweed:rfile_cleanups

Conversation

@silverweed

Copy link
Copy Markdown
Contributor

This Pull request:

Adds the ability of storing object titles when writing objects to RFile.

CAVEATS/to be discussed:

  • TObjects are not treated specially, meaning that if your TObject has a title it won't be used automatically when storing the object (for that you need an explicit rfile->Put("obj", obj, obj->GetTitle()));
  • Doing a rfile->Put("obj", myTObject, "My Title") will not set myTObject's title, but only its key's. This means that this potentially unexpected behavior will occur:
rfile->Put("myobj", myobj, "obj title");
auto myobj2 = rfile->Get<MyTObj>("myobj");
cout << myobj2->GetTitle() << "\n";  // prints ""

In order to retrieve the object's title you'd need to do it from the key:

auto keyInfo = rfile->GetKeyInfo("myobj").value();
cout << keyInfo.GetTitle() << "\n"; // prints "obj title"

To be discussed: are we ok with this behavior or do we want bespoke TObject/TNamed code in the implementation to mitigate these pitfalls?

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 14h 48m 1s ⏱️
 3 873 tests  3 817 ✅ 0 💤 56 ❌
76 034 runs  75 977 ✅ 1 💤 56 ❌

For more details on these failures, see this check.

Results for commit 4741af9.

♻️ This comment has been updated with latest results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant