#ifndef ROOT_TFileMerger
#define ROOT_TFileMerger
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_TStopwatch
#include "TStopwatch.h"
#endif
class TList;
class TFile;
class TDirectory;
class TFileMerger : public TObject {
private:
TFileMerger(const TFileMerger&);
TFileMerger& operator=(const TFileMerger&);
protected:
TStopwatch fWatch;
TList *fFileList;
TFile *fOutputFile;
TString fOutputFilename;
Bool_t fFastMethod;
Bool_t fNoTrees;
Bool_t fExplicitCompLevel;
Bool_t fCompressionChange;
Int_t fPrintLevel;
TString fMsgPrefix;
Int_t fMaxOpenedFiles;
Bool_t fLocal;
Bool_t fHistoOneGo;
TList *fMergeList;
TList *fExcessFiles;
Bool_t OpenExcessFiles();
virtual Bool_t AddFile(TFile *source, Bool_t own, Bool_t cpProgress);
virtual Bool_t MergeRecursive(TDirectory *target, TList *sourcelist, Int_t type = kRegular | kAll);
public:
enum EPartialMergeType {
kRegular = 0,
kIncremental = BIT(1),
kResetable = BIT(2),
kNonResetable = BIT(3),
kAll = BIT(2)|BIT(3),
kAllIncremental = kIncremental | kAll
};
TFileMerger(Bool_t isLocal = kTRUE, Bool_t histoOneGo = kTRUE);
virtual ~TFileMerger();
Int_t GetPrintLevel() const { return fPrintLevel; }
void SetPrintLevel(Int_t level) { fPrintLevel = level; }
Bool_t HasCompressionChange() const { return fCompressionChange; }
const char *GetOutputFileName() const { return fOutputFilename; }
TList *GetMergeList() const { return fMergeList; }
TFile *GetOutputFile() const { return fOutputFile; }
Int_t GetMaxOpenedFies() const { return fMaxOpenedFiles; }
void SetMaxOpenedFiles(Int_t newmax);
const char *GetMsgPrefix() const { return fMsgPrefix; }
void SetMsgPrefix(const char *prefix);
virtual Bool_t SetCWD(const char * ) { MayNotUse("SetCWD"); return kFALSE; }
virtual const char *GetCWD() { MayNotUse("GetCWD"); return 0; }
virtual void Reset();
virtual Bool_t AddFile(const char *url, Bool_t cpProgress = kTRUE);
virtual Bool_t AddFile(TFile *source, Bool_t cpProgress = kTRUE);
virtual Bool_t AddAdoptFile(TFile *source, Bool_t cpProgress = kTRUE);
virtual Bool_t OutputFile(const char *url, Bool_t force);
virtual Bool_t OutputFile(const char *url, Bool_t force, Int_t compressionLevel);
virtual Bool_t OutputFile(const char *url, const char *mode = "RECREATE");
virtual Bool_t OutputFile(const char *url, const char *mode, Int_t compressionLevel);
virtual void PrintFiles(Option_t *options);
virtual Bool_t Merge(Bool_t = kTRUE);
virtual Bool_t PartialMerge(Int_t type = kAll | kIncremental);
virtual void SetFastMethod(Bool_t fast=kTRUE) {fFastMethod = fast;}
virtual void SetNotrees(Bool_t notrees=kFALSE) {fNoTrees = notrees;}
virtual void RecursiveRemove(TObject *obj);
ClassDef(TFileMerger,4)
};
#endif