@@ -336,8 +336,8 @@ public:
336336 void *obj = GetUntyped (path, typeid (T));
337337 return std::unique_ptr<T>(static_cast <T *>(obj));
338338 }
339-
340- // / Puts object `obj` into the file.
339+
340+ // / Puts object `obj` into the file, optionally giving it a title .
341341 // / The object will be effectively copied into the file, so any further modifications won't be seen by the object
342342 // / inside the file.
343343 // / Note that the object is not necessarily written to storage until the RFile is closed or `Flush()` is called.
@@ -348,9 +348,9 @@ public:
348348 // / \throws ROOT::RException if `path` already identifies a valid object or directory.
349349 // / \throws ROOT::RException if the file was opened in read-only mode.
350350 template <typename T>
351- void Put (std::string_view path, const T &obj)
351+ void Put (std::string_view path, const T &obj, std::string_view title = " " )
352352 {
353- PutInternal (path, obj, /* flags = */ 0 );
353+ PutInternal (path, obj, /* flags = */ 0 , title );
354354 }
355355
356356 // / Puts an object into the file, overwriting any previously-existing object at that path.
@@ -365,10 +365,17 @@ public:
365365 // / \throws ROOT::RException if the file was opened in read-only mode.
366366 template <typename T>
367367 void Overwrite (std::string_view path, const T &obj, bool createNewCycle = true )
368+ {
369+ Overwrite (path, obj, " " , createNewCycle);
370+ }
371+
372+ // / Like Overwrite(std::string_view, const T&, bool) but allows giving a title to the object.
373+ template <typename T>
374+ void Overwrite (std::string_view path, const T &obj, std::string_view title, bool createNewCycle = true )
368375 {
369376 std::uint32_t flags = kPutFlag_AllowOverwrite ;
370377 flags |= createNewCycle * kPutFlag_OverwriteKeepCycle ;
371- PutInternal (path, obj, flags);
378+ PutInternal (path, obj, flags, title );
372379 }
373380
374381 // / Writes all objects and the file structure to disk.
0 commit comments