TProofOutputFile.h

Go to the documentation of this file.
00001 // @(#)root/proof:$Id: TProofOutputFile.h 31830 2009-12-11 08:54:32Z ganis $
00002 // Author: Long Tran-Thanh   14/09/07
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TProofOutputFile
00013 #define ROOT_TProofOutputFile
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TProofOutputFile                                                           //
00019 //                                                                      //
00020 // Small class to steer the merging of files produced on workers        //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TNamed
00025 #include "TNamed.h"
00026 #endif
00027 
00028 class TCollection;
00029 class TProofOutputFile;
00030 class TString;
00031 class TList;
00032 class TFile;
00033 class TFileCollection;
00034 class TFileMerger;
00035 
00036 class TProofOutputFile : public TNamed {
00037 
00038 friend class TProof;
00039 friend class TProofPlayer;
00040 
00041 public:
00042    enum ERunType {  kMerge        = 1,      // Type of run: merge or dataset creation
00043                     kDataset      = 2};
00044    enum ETypeOpt {  kRemote       = 1,      // Merge from original copies
00045                     kLocal        = 2,      // Make local copies before merging
00046                     kCreate       = 4,      // Create dataset
00047                     kRegister     = 8,      // Register dataset
00048                     kOverwrite    = 16,     // Force dataset replacement during registration
00049                     kVerify       = 32};    // Verify the registered dataset
00050 
00051 private:
00052    TProofOutputFile(const TProofOutputFile&); // Not implemented
00053    TProofOutputFile& operator=(const TProofOutputFile&); // Not implemented
00054 
00055    TString  fDir;            // name of the directory to be exported
00056    TString  fRawDir;         // name of the local directory where to create the file
00057    TString  fFileName;
00058    TString  fOptionsAnchor;  // options and anchor string including delimiters, e.g. "?myopts#myanchor"
00059    TString  fOutputFileName;
00060    TString  fWorkerOrdinal;
00061    TString  fLocalHost;      // Host where the file was created
00062    Bool_t   fIsLocal;     // kTRUE if the file is in the sandbox
00063    Bool_t   fMerged;
00064    ERunType fRunType;     // Type of run (see enum ERunType)
00065    UInt_t   fTypeOpt;     // Option (see enum ETypeOpt)
00066 
00067    TFileCollection *fDataSet;  // Instance of the file collection in 'dataset' mode
00068    TFileMerger *fMerger;  // Instance of the file merger in 'merge' mode
00069 
00070    void Init(const char *path, const char *dsname);
00071    void SetFileName(const char* name);
00072    void SetDir(const char* dir) { fDir = dir; }
00073    void SetWorkerOrdinal(const char* ordinal) { fWorkerOrdinal = ordinal; }
00074 
00075    void AddFile(TFileMerger *merger, const char *path);
00076    void NotifyError(const char *errmsg);
00077    void Unlink(const char *path);
00078 
00079 protected:
00080 
00081 public:
00082    TProofOutputFile() : fDir(), fRawDir(), fFileName(), fOptionsAnchor(), fOutputFileName(),
00083                         fWorkerOrdinal(), fLocalHost(), fIsLocal(kFALSE), fMerged(kFALSE),
00084                         fRunType(kMerge), fTypeOpt(kRemote), fDataSet(0), fMerger(0) { }
00085    TProofOutputFile(const char *path, const char *option = "M", const char *dsname = 0);
00086    TProofOutputFile(const char *path, ERunType type, UInt_t opt = kRemote, const char *dsname = 0);
00087    virtual ~TProofOutputFile();
00088 
00089    const char *GetDir(Bool_t raw = kFALSE) const { return (raw) ? fRawDir : fDir; }
00090    TFileCollection *GetFileCollection();
00091    TFileMerger *GetFileMerger(Bool_t local = kFALSE);
00092    const char *GetFileName() const { return fFileName; }
00093    const char *GetLocalHost() const { return fLocalHost; }
00094    const char *GetOptionsAnchor() const { return fOptionsAnchor; }
00095    const char *GetOutputFileName() const { return fOutputFileName; }
00096    const char *GetWorkerOrdinal() const { return fWorkerOrdinal; }
00097 
00098    ERunType    GetRunType() const { return fRunType; }
00099    UInt_t      GetTypeOpt() const { return fTypeOpt; }
00100    Bool_t      IsMerge() const { return (fRunType == kMerge) ? kTRUE : kFALSE; }
00101    Bool_t      IsMerged() const { return fMerged; }
00102    Bool_t      IsRegister() const { return ((fTypeOpt & kRegister) || (fTypeOpt & kVerify)) ? kTRUE : kFALSE; }
00103 
00104    Int_t AdoptFile(TFile *f);                    // Adopt a TFile already open
00105    TFile* OpenFile(const char *opt);             // Open a file with the specified name in fFileName1
00106    Long64_t Merge(TCollection *list);
00107    void Print(Option_t *option = "") const;
00108    void SetOutputFileName(const char *name);
00109    void ResetFileCollection() { fDataSet = 0; }
00110 
00111    ClassDef(TProofOutputFile,4) // Wrapper class to steer the merging of files produced on workers
00112 };
00113 
00114 #endif

Generated on Tue Jul 5 14:28:02 2011 for ROOT_528-00b_version by  doxygen 1.5.1