File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ class TMemFile : public TFile {
105105 void ResetErrno () const override ;
106106
107107 void Print (Option_t *option=" " ) const override ;
108+ void DumpBin (FILE *out) const ;
108109
109110 ClassDefOverride (TMemFile, 0 ) // A ROOT file that reads/writes on a chunk of memory
110111};
Original file line number Diff line number Diff line change @@ -312,6 +312,26 @@ void TMemFile::Print(Option_t *option /* = "" */) const
312312 }
313313}
314314
315+ // //////////////////////////////////////////////////////////////////////////////
316+ // / Writes the contents of the TMemFile to the given file. This is meant to be
317+ // / used mostly for debugging, as it dumps the current file's content as-is with
318+ // / no massaging (meaning the content might not be a valid ROOT file): for regular use cases, use Cp().
319+ // / Example usage:
320+ // / ~~~ {.cpp}
321+ // / FILE *out = fopen("memfile.root", "wb");
322+ // / memFile->DumpBin(out);
323+ // / fclose(out);
324+ // / ~~~
325+ void TMemFile::DumpBin (FILE *out) const
326+ {
327+ const auto *cur = &fBlockList ;
328+ while (cur) {
329+ fwrite (cur->fBuffer , cur->fSize , 1 , out);
330+ cur = cur->fNext ;
331+ }
332+ fflush (out);
333+ }
334+
315335// //////////////////////////////////////////////////////////////////////////////
316336// / Wipe all the data from the permanent buffer but keep, the in-memory object
317337// / alive.
You can’t perform that action at this time.
0 commit comments