#ifndef ROOT_TProofOutputFile
#define ROOT_TProofOutputFile
#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
class TCollection;
class TString;
class TList;
class TFile;
class TFileCollection;
class TFileMerger;
class TProofOutputFile : public TNamed {
friend class TProof;
friend class TProofPlayer;
friend class TProofPlayerRemote;
public:
enum ERunType { kMerge = 1,
kDataset = 2};
enum ETypeOpt { kRemote = 1,
kLocal = 2,
kCreate = 4,
kRegister = 8,
kOverwrite = 16,
kVerify = 32};
private:
TProofOutputFile(const TProofOutputFile&);
TProofOutputFile& operator=(const TProofOutputFile&);
TString fDir;
TString fRawDir;
TString fFileName;
TString fOptionsAnchor;
TString fOutputFileName;
TString fWorkerOrdinal;
TString fLocalHost;
Bool_t fIsLocal;
Bool_t fMerged;
ERunType fRunType;
UInt_t fTypeOpt;
Bool_t fMergeHistosOneGo;
TFileCollection *fDataSet;
TFileMerger *fMerger;
void Init(const char *path, const char *dsname);
void SetFileName(const char* name) { fFileName = name; }
void SetDir(const char* dir, Bool_t raw = kFALSE) { if (raw) { fRawDir = dir; } else { fDir = dir; } }
void SetMerged(Bool_t merged = kTRUE) { fMerged = merged; }
void SetWorkerOrdinal(const char* ordinal) { fWorkerOrdinal = ordinal; }
void AddFile(TFileMerger *merger, const char *path);
void NotifyError(const char *errmsg);
void Unlink(const char *path);
protected:
public:
enum EStatusBits {
kOutputFileNameSet = BIT(16),
kRetrieve = BIT(17),
kSwapFile = BIT(18)
};
TProofOutputFile() : fDir(), fRawDir(), fFileName(), fOptionsAnchor(), fOutputFileName(),
fWorkerOrdinal(), fLocalHost(), fIsLocal(kFALSE), fMerged(kFALSE),
fRunType(kMerge), fTypeOpt(kRemote), fMergeHistosOneGo(kFALSE),
fDataSet(0), fMerger(0) { }
TProofOutputFile(const char *path, const char *option = "M", const char *dsname = 0);
TProofOutputFile(const char *path, ERunType type, UInt_t opt = kRemote, const char *dsname = 0);
virtual ~TProofOutputFile();
const char *GetDir(Bool_t raw = kFALSE) const { return (raw) ? fRawDir : fDir; }
TFileCollection *GetFileCollection();
TFileMerger *GetFileMerger(Bool_t local = kFALSE);
const char *GetFileName() const { return fFileName; }
const char *GetLocalHost() const { return fLocalHost; }
const char *GetOptionsAnchor() const { return fOptionsAnchor; }
const char *GetOutputFileName() const { return fOutputFileName; }
const char *GetWorkerOrdinal() const { return fWorkerOrdinal; }
ERunType GetRunType() const { return fRunType; }
UInt_t GetTypeOpt() const { return fTypeOpt; }
Bool_t IsMerge() const { return (fRunType == kMerge) ? kTRUE : kFALSE; }
Bool_t IsMerged() const { return fMerged; }
Bool_t IsRegister() const { return ((fTypeOpt & kRegister) || (fTypeOpt & kVerify)) ? kTRUE : kFALSE; }
Bool_t IsRetrieve() const { return (TestBit(TProofOutputFile::kRetrieve)) ? kTRUE : kFALSE; }
void SetRetrieve(Bool_t on = kTRUE) { if (on) { SetBit(TProofOutputFile::kRetrieve);
} else { ResetBit(TProofOutputFile::kRetrieve); }}
Int_t AdoptFile(TFile *f);
TFile* OpenFile(const char *opt);
Long64_t Merge(TCollection *list);
void Print(Option_t *option = "") const;
void SetOutputFileName(const char *name);
void ResetFileCollection() { fDataSet = 0; }
static Int_t AssertDir(const char *dirpath);
ClassDef(TProofOutputFile,5)
};
#endif