12 #ifndef ROOT_TFileMerger 
   13 #define ROOT_TFileMerger 
   30 class TFileMerger : 
public TObject {
 
   32    using TIOFeatures = ROOT::TIOFeatures;
 
   34    TFileMerger(
const TFileMerger&) = 
delete;
 
   35    TFileMerger& operator=(
const TFileMerger&) = 
delete;
 
   40    TFile         *fOutputFile{
nullptr};       
 
   41    TString        fOutputFilename;            
 
   42    Bool_t         fFastMethod{kTRUE};         
 
   43    Bool_t         fNoTrees{kFALSE};           
 
   44    Bool_t         fExplicitCompLevel{kFALSE}; 
 
   45    Bool_t         fCompressionChange{kFALSE}; 
 
   47    TString        fMergeOptions;              
 
   48    TIOFeatures   *fIOFeatures{
nullptr};       
 
   49    TString        fMsgPrefix{
"TFileMerger"};  
 
   51    Int_t          fMaxOpenedFiles;            
 
   58    Bool_t         OpenExcessFiles();
 
   59    virtual Bool_t AddFile(TFile *source, Bool_t own, Bool_t cpProgress);
 
   60    virtual Bool_t MergeRecursive(TDirectory *target, TList *sourcelist, Int_t type = kRegular | kAll);
 
   64    enum EPartialMergeType {
 
   66       kIncremental  = BIT(1),        
 
   68       kNonResetable = BIT(3),        
 
   71       kAllIncremental = kIncremental | kAll, 
 
   75       kKeepCompression= BIT(6)         
 
   78    TFileMerger(Bool_t isLocal = kTRUE, Bool_t histoOneGo = kTRUE);
 
   79    virtual ~TFileMerger();
 
   81    Int_t       GetPrintLevel()
 const { 
return fPrintLevel; }
 
   82    void        SetPrintLevel(Int_t level) { fPrintLevel = level; }
 
   83    Bool_t      HasCompressionChange()
 const { 
return fCompressionChange; }
 
   84    const char *GetOutputFileName()
 const { 
return fOutputFilename; }
 
   85    TList      *GetMergeList() { 
return &fMergeList; }
 
   86    TFile      *GetOutputFile()
 const { 
return fOutputFile; }
 
   87    Int_t       GetMaxOpenedFiles()
 const { 
return fMaxOpenedFiles; }
 
   88    void        SetMaxOpenedFiles(Int_t newmax);
 
   89    const char *GetMsgPrefix()
 const { 
return fMsgPrefix; }
 
   90    void        SetMsgPrefix(
const char *prefix);
 
   91    const char *GetMergeOptions() { 
return fMergeOptions; }
 
   92    void        SetMergeOptions(
const TString &options) { fMergeOptions = options; }
 
   93    void        SetMergeOptions(
const std::string_view &options) { fMergeOptions = options; }
 
   94    void        SetIOFeatures(ROOT::TIOFeatures &features) { fIOFeatures = &features; }
 
   95    void        AddObjectNames(
const char *name) {fObjectNames += name; fObjectNames += 
" ";}
 
   96    const char *GetObjectNames()
 const {
return fObjectNames.Data();}
 
   97    void        ClearObjectNames() {fObjectNames.Clear();}
 
  100    virtual Bool_t SetCWD(
const char * ) { MayNotUse(
"SetCWD"); 
return kFALSE; }
 
  101    virtual const char *GetCWD() { MayNotUse(
"GetCWD"); 
return 0; }
 
  104    virtual void   Reset();
 
  105    virtual Bool_t AddFile(
const char *url, Bool_t cpProgress = kTRUE);
 
  106    virtual Bool_t AddFile(TFile *source, Bool_t cpProgress = kTRUE);
 
  107    virtual Bool_t AddAdoptFile(TFile *source, Bool_t cpProgress = kTRUE);
 
  108    virtual Bool_t OutputFile(
const char *url, Bool_t force);
 
  109    virtual Bool_t OutputFile(
const char *url, Bool_t force, Int_t compressionLevel);
 
  110    virtual Bool_t OutputFile(
const char *url, 
const char *mode = 
"RECREATE");
 
  111    virtual Bool_t OutputFile(
const char *url, 
const char *mode, Int_t compressionLevel);
 
  112    virtual Bool_t OutputFile(std::unique_ptr<TFile> file);
 
  113    virtual void   PrintFiles(Option_t *options);
 
  114    virtual Bool_t Merge(Bool_t = kTRUE);
 
  115    virtual Bool_t PartialMerge(Int_t type = kAll | kIncremental);
 
  116    virtual void   SetFastMethod(Bool_t fast=kTRUE)  {fFastMethod = fast;}
 
  117    virtual void   SetNotrees(Bool_t notrees=kFALSE) {fNoTrees = notrees;}
 
  118    virtual void        RecursiveRemove(TObject *obj);
 
  120    ClassDef(TFileMerger, 6)