@@ -254,11 +254,11 @@ class RFile final {
254254 friend TFile *Internal::GetRFileTFile (RFile &rfile);
255255
256256 // / Flags used in PutInternal()
257- enum PutFlags {
257+ enum EPutFlags {
258258 // / When encountering an object at the specified path, overwrite it with the new one instead of erroring out.
259- kPutAllowOverwrite = 0x1 ,
259+ kPutFlag_AllowOverwrite = 0x1 ,
260260 // / When overwriting an object, preserve the existing one and create a new cycle, rather than removing it.
261- kPutOverwriteKeepCycle = 0x2 ,
261+ kPutFlag_OverwriteKeepCycle = 0x2 ,
262262 };
263263
264264 std::unique_ptr<TFile> fFile ;
@@ -328,52 +328,59 @@ public:
328328 // / Retrieves an object from the file.
329329 // / `path` should be a string such that `IsValidPath(path) == true`, otherwise an exception will be thrown.
330330 // / See \ref ValidateAndNormalizePath() for info about valid path names.
331- // / If the object is not there returns a null pointer .
331+ // / \return A copy of the object at `path`, or `nullptr` if there is no object of type `T` at the specified path .
332332 template <typename T>
333333 std::unique_ptr<T> Get (std::string_view path) const
334334 {
335335 void *obj = GetUntyped (path, typeid (T));
336336 return std::unique_ptr<T>(static_cast <T *>(obj));
337337 }
338-
339- // / Puts an object into the file.
340- // / The application retains ownership of the object.
338+
339+ // / Puts object `obj` into the file.
340+ // / The object will be effectively copied into the file, so any further modifications won't be seen by the object
341+ // / inside the file.
342+ // / Note that the object is not necessarily written to storage until the RFile is closed or `Flush()` is called.
343+ // /
341344 // / `path` should be a string such that `IsValidPath(path) == true`, otherwise an exception will be thrown.
342345 // / See \ref ValidateAndNormalizePath() for info about valid path names.
343346 // /
344- // / Throws a RException if `path` already identifies a valid object or directory.
345- // / Throws a RException if the file was opened in read-only mode.
347+ // / \throws ROOT:: RException if `path` already identifies a valid object or directory.
348+ // / \throws ROOT:: RException if the file was opened in read-only mode.
346349 template <typename T>
347350 void Put (std::string_view path, const T &obj)
348351 {
349352 PutInternal (path, obj, /* flags = */ 0 );
350353 }
351354
352355 // / Puts an object into the file, overwriting any previously-existing object at that path.
353- // / The application retains ownership of the object .
356+ // / See Put for more details .
354357 // /
355- // / If an object already exists at that path, it is kept as a backup cycle unless `backupPrevious` is false.
356- // / Note that even if `backupPrevious` is false, any existing cycle except the latest will be preserved.
358+ // / If an object already exists at that path,AND it has type `T`, it is kept as a backup cycle
359+ // / unless `createNewCycle` is false.
360+ // / If the existing object's type differs from `T`, an exception is thrown.
361+ // / Note that even if `createNewCycle` is false only the *latest* cycle will be deleted.
357362 // /
358- // / Throws a RException if `path` is already the path of a directory.
359- // / Throws a RException if the file was opened in read-only mode.
363+ // / \throws ROOT:: RException if `path` is already the path of a directory.
364+ // / \throws ROOT:: RException if the file was opened in read-only mode.
360365 template <typename T>
361- void Overwrite (std::string_view path, const T &obj, bool backupPrevious = true )
366+ void Overwrite (std::string_view path, const T &obj, bool createNewCycle = true )
362367 {
363- std::uint32_t flags = kPutAllowOverwrite ;
364- flags |= backupPrevious * kPutOverwriteKeepCycle ;
368+ std::uint32_t flags = kPutFlag_AllowOverwrite ;
369+ flags |= createNewCycle * kPutFlag_OverwriteKeepCycle ;
365370 PutInternal (path, obj, flags);
366371 }
367372
368373 // / Writes all objects and the file structure to disk.
369- // / Returns the number of bytes written.
374+ // / \return the number of bytes written.
370375 size_t Flush ();
371376
372377 // / Flushes the RFile if needed and closes it, disallowing any further reading or writing.
373378 void Close ();
374379
375380 // / Returns an iterable over all keys of objects and/or directories written into this RFile starting at path
376381 // / `basePath` (defaulting to include the content of all subdirectories).
382+ // / The iterable yields values of type ROOT::Experimental::RKeyInfo.
383+ // /
377384 // / By default, keys referring to directories are not returned: only those referring to leaf objects are.
378385 // / If `basePath` is the path of a leaf object, only `basePath` itself will be returned.
379386 // / If `basePath` is the path of a directory, it won't appear in the listing.
@@ -386,17 +393,17 @@ public:
386393 // / Example usage:
387394 // / ~~~{.cpp}
388395 // / for (RKeyInfo key : file->ListKeys()) {
389- // / /* iterate over all objects in the RFile */
396+ // / // iterate over all objects in the RFile
390397 // / cout << key.GetPath() << ";" << key.GetCycle() << " of type " << key.GetClassName() << "\n";
391398 // / }
392399 // / for (RKeyInfo key : file->ListKeys("", kListDirs|kListObjects|kListRecursive)) {
393- // / /* iterate over all objects and directories in the RFile */
400+ // / // iterate over all objects and directories in the RFile
394401 // / }
395402 // / for (RKeyInfo key : file->ListKeys("a/b", kListObjects)) {
396- // / /* iterate over all objects that are immediate children of directory "a/b" */
403+ // / // iterate over all objects that are immediate children of directory "a/b"
397404 // / }
398405 // / for (RKeyInfo key : file->ListKeys("foo", kListDirs|kListRecursive)) {
399- // / /* iterate over all directories under directory "foo", recursively */
406+ // / // iterate over all directories under directory "foo", recursively
400407 // / }
401408 // / ~~~
402409 RFileKeyIterable ListKeys (std::string_view basePath = " " , std::uint32_t flags = kListObjects | kListRecursive ) const
0 commit comments