Repository navigation
[rfile] Introduce special Put overload for TNamed - #23812
silverweed wants to merge 3 commits into
Conversation
Test Results 23 files 23 suites 3d 9h 35m 21s ⏱️ For more details on these failures, see this check. Results for commit 71d9768. ♻️ This comment has been updated with latest results. |
| enum EPutFlags { | ||
| /// When encountering an object at the specified path, overwrite it with the new one instead of erroring out. | ||
| kPutAllowOverwrite = 0x1, | ||
| kPutFlag_AllowOverwrite = 0x1, |
There was a problem hiding this comment.
Another option is to use a enum class ....
There was a problem hiding this comment.
That makes it more cumbersome though to use the constants in a bit mask.
| Int_t WriteTObject(const TObject *obj, const char *name=nullptr, Option_t *option="", Int_t bufsize=0) override; | ||
| Int_t WriteObjectAny(const void *obj, const char *classname, const char *name, Option_t *option="", Int_t bufsize=0) override; | ||
| Int_t WriteObjectAny(const void *obj, const TClass *cl, const char *name, Option_t *option="", Int_t bufsize=0) override; | ||
| Int_t WriteObjectAny(const void *obj, const char *title, const TClass *cl, const char *name, Option_t *option="", Int_t bufsize=0); |
There was a problem hiding this comment.
There was a problem hiding this comment.
I think it makes sense to use the std::pair argument, as this is not a method that's usually called by user code so the odd syntax shouldn't hurt.
There was a problem hiding this comment.
Done in the latest commit
| } | ||
|
|
||
| void RFile::PutUntyped(std::string_view pathSV, const std::type_info &type, const void *obj, std::uint32_t flags) | ||
| void RFile::Put(const TNamed &namedObj, std::string_view dirPath) |
There was a problem hiding this comment.
Is there a plan to allow the user to over-tide the name and title? For example
void RFile::Put(const TNamed &namedObj, std::string_view path, std::string_view title)
(with the unresolved question of being able or not of over-riding just the name and not the title).
There was a problem hiding this comment.
No, my idea behind this overload is to have the key information exactly match the TNamed's; if one wants to customize name and/or title they can always use the "regular" overload.
Plus, I want to keep this as simple as possible and avoid extra optional parameters (I'm already a bit on the fence about this whole overload as-is)
6e2da24 to
353010e
Compare
This will automatically call Put(obj.GetName(), obj, obj.GetTitle()). Added a pythonization as well.
353010e to
71d9768
Compare
This Pull request:
depends on #23811.
Adds an overload of Put that allows calling
Put(tnamedObj)instead ofPut(obj.GetName(), obj, obj.GetTitle()). To be seen if we want the same for Overwrite.