Warning, file /include/root/TDirectoryFile.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TDirectoryFile
0013 #define ROOT_TDirectoryFile
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "Compression.h"
0025 #include "TDirectory.h"
0026 #include "TDatime.h"
0027 #include "TList.h"
0028
0029 class TKey;
0030 class TFile;
0031
0032 class TDirectoryFile : public TDirectory {
0033
0034 protected:
0035 Bool_t fModified{kFALSE};
0036 Bool_t fWritable{kFALSE};
0037 TDatime fDatimeC;
0038 TDatime fDatimeM;
0039 Int_t fNbytesKeys{0};
0040 Int_t fNbytesName{0};
0041 Int_t fBufferSize{0};
0042 Long64_t fSeekDir{0};
0043 Long64_t fSeekParent{0};
0044 Long64_t fSeekKeys{0};
0045 TFile *fFile{nullptr};
0046 TList *fKeys{nullptr};
0047
0048 void CleanTargets();
0049 void InitDirectoryFile(TClass *cl = nullptr);
0050 void BuildDirectoryFile(TFile* motherFile, TDirectory* motherDir);
0051
0052 private:
0053 TDirectoryFile(const TDirectoryFile &directory) = delete;
0054 void operator=(const TDirectoryFile &) = delete;
0055
0056 public:
0057
0058 enum EStatusBits { kCloseDirectory = BIT(7) };
0059
0060 TDirectoryFile();
0061 TDirectoryFile(const char *name, const char *title, Option_t *option="", TDirectory* motherDir = nullptr);
0062 ~TDirectoryFile() override;
0063
0064 void Append(TObject *obj, Bool_t replace = kFALSE) override;
0065 void Add(TObject *obj, Bool_t replace = kFALSE) override { Append(obj,replace); }
0066 Int_t AppendKey(TKey *key) override;
0067 void Browse(TBrowser *b) override;
0068 void Build(TFile* motherFile = nullptr, TDirectory* motherDir = nullptr) override { BuildDirectoryFile(motherFile, motherDir); }
0069 TObject *CloneObject(const TObject *obj, Bool_t autoadd = kTRUE) override;
0070 void Close(Option_t *option="") override;
0071 void Copy(TObject &) const override { MayNotUse("Copy(TObject &)"); }
0072 Bool_t cd() override;
0073 Bool_t cd(const char *path) override;
0074 void Delete(const char *namecycle="") override;
0075 void FillBuffer(char *&buffer) override;
0076 TKey *FindKey(const char *keyname) const override;
0077 TKey *FindKeyAny(const char *keyname) const override;
0078 TObject *FindObjectAny(const char *name) const override;
0079 TObject *FindObjectAnyFile(const char *name) const override;
0080 TObject *Get(const char *namecycle) override;
0081
0082 template <class T> inline T* Get(const char* namecycle)
0083 {
0084 return TDirectory::Get<T>(namecycle);
0085 }
0086 TDirectory *GetDirectory(const char *apath, Bool_t printError = false, const char *funcname = "GetDirectory") override;
0087 void *GetObjectChecked(const char *namecycle, const char* classname) override;
0088 void *GetObjectChecked(const char *namecycle, const TClass* cl) override;
0089 void *GetObjectUnchecked(const char *namecycle) override;
0090 Int_t GetBufferSize() const override;
0091 const TDatime &GetCreationDate() const { return fDatimeC; }
0092 TFile *GetFile() const override { return fFile; }
0093 TKey *GetKey(const char *name, Short_t cycle=9999) const override;
0094 TList *GetListOfKeys() const override { return fKeys; }
0095 const TDatime &GetModificationDate() const { return fDatimeM; }
0096 Int_t GetNbytesKeys() const override { return fNbytesKeys; }
0097 Int_t GetNkeys() const override { return fKeys->GetSize(); }
0098 Long64_t GetSeekDir() const override { return fSeekDir; }
0099 Long64_t GetSeekParent() const override { return fSeekParent; }
0100 Long64_t GetSeekKeys() const override { return fSeekKeys; }
0101 Bool_t IsModified() const override { return fModified; }
0102 Bool_t IsWritable() const override { return fWritable; }
0103 void ls(Option_t *option="") const override;
0104 TDirectory *mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory = kFALSE) override;
0105 TFile *OpenFile(const char *name, Option_t *option= "",
0106 const char *ftitle = "", Int_t compress = ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault,
0107 Int_t netopt = 0) override;
0108 void Purge(Short_t nkeep=1) override;
0109 void ReadAll(Option_t *option="") override;
0110 Int_t ReadKeys(Bool_t forceRead=kTRUE) override;
0111 Int_t ReadTObject(TObject *obj, const char *keyname) override;
0112 virtual void ResetAfterMerge(TFileMergeInfo *);
0113 void rmdir(const char *name) override;
0114 void Save() override;
0115 void SaveSelf(Bool_t force = kFALSE) override;
0116 Int_t SaveObjectAs(const TObject *obj, const char *filename="", Option_t *option="") const override;
0117 void SetBufferSize(Int_t bufsize) override;
0118 void SetModified() override {fModified = kTRUE;}
0119 void SetSeekDir(Long64_t v) override { fSeekDir = v; }
0120 void SetTRefAction(TObject *ref, TObject *parent) override;
0121 void SetWritable(Bool_t writable=kTRUE) override;
0122 Int_t Sizeof() const override;
0123 Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsize=0) override;
0124 Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsize=0) const override;
0125 Int_t WriteTObject(const TObject *obj, const char *name=nullptr, Option_t *option="", Int_t bufsize=0) override;
0126 Int_t WriteObjectAny(const void *obj, const char *classname, const char *name, Option_t *option="", Int_t bufsize=0) override;
0127 Int_t WriteObjectAny(const void *obj, const TClass *cl, const char *name, Option_t *option="", Int_t bufsize=0) override;
0128 void WriteDirHeader() override;
0129 void WriteKeys() override;
0130
0131 ClassDefOverride(TDirectoryFile,5)
0132 };
0133
0134 #endif