#ifndef ROOT_TFileInfo
#define ROOT_TFileInfo
#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
#ifndef ROOT_Turl
#include "TUrl.h"
#endif
#ifndef ROOT_TUUID
#include "TUUID.h"
#endif
#ifndef ROOT_TMD5
#include "TMD5.h"
#endif
#ifndef ROOT_TObjString
#include "TObjString.h"
#endif
#ifndef ROOT_TList
#include "TList.h"
#endif
class TFileInfoMeta;
class TFileInfo : public TNamed {
private:
TUrl *fCurrentUrl;
TList *fUrlList;
Long64_t fSize;
TUUID *fUUID;
TMD5 *fMD5;
TList *fMetaDataList;
Int_t fIndex;
void ParseInput(const char *in);
TFileInfo& operator=(const TFileInfo&);
public:
enum EStatusBits {
kStaged = BIT(15),
kCorrupted = BIT(16),
kSortWithIndex = BIT(17)
};
TFileInfo(const char *url = 0, Long64_t size = -1, const char *uuid = 0,
const char *md5 = 0, TObject *meta = 0);
TFileInfo(const TFileInfo &);
virtual ~TFileInfo();
void ResetUrl() { fCurrentUrl = (TUrl*)fUrlList->First(); }
TUrl *NextUrl();
TUrl *GetCurrentUrl() const;
TUrl *GetFirstUrl() const { return (TUrl*)fUrlList->First(); }
TUrl *GetUrlAt(Int_t i) const { return (TUrl*)fUrlList->At(i); }
Bool_t RemoveUrlAt(Int_t i);
Int_t GetNUrls() const { return fUrlList->GetEntries(); }
Bool_t SetCurrentUrl(const char *url);
Bool_t SetCurrentUrl(TUrl *url);
Long64_t GetSize() const { return fSize; }
TUUID *GetUUID() const { return fUUID; }
TMD5 *GetMD5() const { return fMD5; }
TList *GetMetaDataList() const { return fMetaDataList; }
TFileInfoMeta *GetMetaData(const char *meta = 0) const;
void SetSize(Long64_t size) { fSize = size; }
void SetUUID(const char *uuid);
TUrl *FindByUrl(const char *url, Bool_t withDeflt = kFALSE);
Bool_t AddUrl(const char *url, Bool_t infront = kFALSE);
Bool_t RemoveUrl(const char *url);
Bool_t AddMetaData(TObject *meta);
Bool_t RemoveMetaData(const char *meta = 0);
Bool_t IsSortable() const { return kTRUE; }
Int_t Compare(const TObject *obj) const;
Int_t GetIndex() const { return fIndex; }
void SetIndex(Int_t idx) { fIndex = idx; }
void Print(Option_t *options="") const;
ClassDef(TFileInfo,4)
};
class TFileInfoMeta : public TNamed {
private:
Long64_t fEntries;
Long64_t fFirst;
Long64_t fLast;
Bool_t fIsTree;
Long64_t fTotBytes;
Long64_t fZipBytes;
TFileInfoMeta& operator=(const TFileInfoMeta&);
public:
enum EStatusBits { kExternal = BIT(15) };
TFileInfoMeta() : fEntries(-1), fFirst(0), fLast(-1),
fIsTree(kFALSE), fTotBytes(-1), fZipBytes(-1)
{ ResetBit(TFileInfoMeta::kExternal); }
TFileInfoMeta(const char *objPath, const char *objClass = "TTree",
Long64_t entries = -1, Long64_t first = 0, Long64_t last = -1,
Long64_t totbytes = -1, Long64_t zipbytes = -1);
TFileInfoMeta(const char *objPath, const char *objDir,
const char *objClass, Long64_t entries = -1,
Long64_t first = 0, Long64_t last = -1,
Long64_t totbytes = -1, Long64_t zipbytes = -1);
TFileInfoMeta(const TFileInfoMeta &m);
virtual ~TFileInfoMeta() { }
const char *GetObject() const;
const char *GetClass() const { return GetTitle(); }
const char *GetDirectory() const;
Long64_t GetEntries() const { return fEntries; }
Long64_t GetFirst() const { return fFirst; }
Long64_t GetLast() const { return fLast; }
Bool_t IsTree() const { return fIsTree; }
Long64_t GetTotBytes() const { return fTotBytes; }
Long64_t GetZipBytes() const { return fZipBytes; }
void SetEntries(Long64_t entries) { fEntries = entries; }
void SetFirst(Long64_t first) { fFirst = first; }
void SetLast(Long64_t last) { fLast = last; }
void SetTotBytes(Long64_t tot) { fTotBytes = tot; }
void SetZipBytes(Long64_t zip) { fZipBytes = zip; }
void Print(Option_t *options="") const;
ClassDef(TFileInfoMeta,2)
};
#endif