TDirectory


class description - source file - inheritance tree

class TDirectory : public TNamed

    private:
TDirectory TDirectory(const TDirectory& directory) void operator=(const TDirectory&) protected:
Bool_t cd1(const Text_t* path) Bool_t Cd1(const Text_t* path) public:
TDirectory TDirectory() TDirectory TDirectory(const Text_t* name, const Text_t* title, Option_t* option) virtual void ~TDirectory() virtual void Append(TObject* obj) Int_t AppendKey(TKey* key) virtual void Browse(TBrowser* b) void Build() virtual Bool_t cd(const Text_t* path = 0) Bool_t Cd(const Text_t* path) TClass* Class() virtual void Clear(Option_t* option) virtual void Close(Option_t* option) virtual void Copy(TObject&) void DecodeNameCycle(const Text_t* namecycle, Text_t* name, Short_t& cycle) virtual void Delete(const Text_t* namecycle) virtual void DeleteAll(Option_t* option) virtual void Draw(Option_t* option) void EncodeNameCycle(Text_t* buffer, const Text_t* name, Short_t cycle) virtual void FillBuffer(char*& buffer) virtual TObject* Get(const Text_t* namecycle) virtual TFile* GetFile() virtual TKey* GetKey(const Text_t* name, const Short_t cycle = 9999) TList* GetList() const TList* GetListOfKeys() const TObject* GetMother() const virtual Int_t GetNkeys() virtual const char* GetPath() const virtual Seek_t GetSeekDir() virtual Seek_t GetSeekKeys() virtual Seek_t GetSeekParent() virtual TClass* IsA() const virtual Bool_t IsFolder() virtual Bool_t IsModified() Bool_t IsWritable() virtual void ls(Option_t* option) virtual TDirectory* mkdir(const Text_t* name, const Text_t* title) virtual void Paint(Option_t* option) virtual void Print(Option_t* option) virtual void Purge(Short_t nkeep = 1) virtual void pwd() const virtual void ReadAll(Option_t* option) virtual void ReadKeys() virtual void RecursiveRemove(TObject* obj) virtual void Save() virtual void SaveSelf(Bool_t force = kFALSE) void SetModified() void SetMother(TObject* mother) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual Int_t Sizeof() const virtual void Streamer(TBuffer& b) virtual void Write(const Text_t* name = 0, Int_t opt = 0, Int_t bufsiz = 0) virtual void WriteDirHeader() virtual void WriteKeys()

Data Members

protected:
Bool_t fModified true if directory has been modified Bool_t fWritable true if directory is writable TDatime fDatimeC Date and time when directory is created TDatime fDatimeM Date and time of last modification Int_t fNbytesKeys Number of bytes for the keys Int_t fNbytesName Number of bytes in TNamed at creation time Seek_t fSeekDir Location of directory on file Seek_t fSeekParent Location of parent directory on file Seek_t fSeekKeys Location of Keys record on file TFile* fFile pointer to current file in memory TObject* fMother pointer to mother of the directory TList* fList Pointer to objects list in memory TList* fKeys Pointer to keys list in memory


See also

TFile, TROOT

Class Description

/*

*/


TDirectory() : TNamed()
*-*-*-*-*-*-*-*-*-*-*-*Directory default constructor-*-*-*-*-*-*-*-*-*-*-*-*
*-*                    =============================

TDirectory(const Text_t *name, const Text_t *title, Option_t *classname) : TNamed(name, title)
*-*-*-*-*-*-*-*-*-*-*-* Create a new Directory *-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                     ======================
  A new directory with name,title is created in the current directory
  The directory header information is immediatly saved on the file
  A new key is added in the parent directory

  When this constructor is called from a class directly derived
  from TDirectory, the third argument classname MUST be specified.
  In this case, classname must be the name of the derived class.

  Note that the directory name cannot contain slashes.


TDirectory(const TDirectory &directory)

~TDirectory()
*-*-*-*-*-*-*-*-*-*-*-*Directory destructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                    ====================

void Append(TObject *obj)
 Append object to current directory.

Int_t AppendKey(TKey *key)
*-*-*-*-*-*-*Insert key in the linked list of keys of this directory*-*-*-*
*-*          =======================================================

void Browse(TBrowser *b)

void Build()
*-*-*-*-*-*-*-*-*-*-*-*Initialise directory to defaults*-*-*-*-*-*-*-*-*-*
*-*                    ================================

Bool_t cd(const Text_t *path)
 Change current directory to "this" directory . Using path one can
 change the current directory to "path". The absolute path syntax is:
 file.root:/dir1/dir2
 where file.root is the file and /dir1/dir2 the desired subdirectory
 in the file. Relative syntax is relative to "this" directory. E.g:
 ../aa. Returns kTRUE in case of success.

Bool_t cd1(const Text_t *path)
 Change current directory to "this" directory . Using path one can
 change the current directory to "path". The absolute path syntax is:
 file.root:/dir1/dir2
 where file.root is the file and /dir1/dir2 the desired subdirectory
 in the file. Relative syntax is relative to "this" directory. E.g:
 ../aa. Returns kFALSE in case path does not exist.

Bool_t Cd(const Text_t *path)
 Change current directory to "path". The absolute path syntax is:
 file.root:/dir1/dir2
 where file.root is the file and /dir1/dir2 the desired subdirectory
 in the file. Relative syntax is relative to the current directory
 gDirectory, e.g.: ../aa. Returns kTRUE in case of success.

Bool_t Cd1(const Text_t *path)
 Change current directory to "path". The path syntax is:
 file.root:/dir1/dir2
 where file.root is the file and /dir1/dir2 the desired subdirectory
 in the file. Returns kFALSE in case path does not exist.

void Clear(Option_t *)
*-*-*-*Delete all objects from a Directory list-*-*-*-*-*
*-*    =======================================

void Close(Option_t *)
*-*-*-*Delete all objects from memory and directory structure itself-*-*-*-*
       ============================================================

void DeleteAll(Option_t *)
*-*-*-*-*-*-*-*-*Delete all objects from memory*-*-*-*-*-*-*-*-*-*
                 ==============================

void Delete(const Text_t *namecycle)
*-*-*-*-*-*-*-* Delete Objects or/and keys in a directory *-*-*-*-*-*-*-*
*-*             =========================================
   namecycle has the format name;cycle
   namecycle = "" same as namecycle ="T*"
   name  = * means all
   cycle = * means all cycles (memory and keys)
   cycle = "" or cycle = 9999 ==> apply to a memory object
   When name=* use T* to delete subdirectories also

   To delete one directory, you must specify the directory cycle,
      eg.  file.Delete("dir1;1");

   examples:
     foo   : delete object named foo in memory
     foo;1 : delete cycle 1 of foo on file
     foo;* : delete all cycles of foo on file and also from memory
     *;2   : delete all objects on file having the cycle 2
     *;*   : delete all objects from memory and file
    T*;*   : delete all objects from memory and file and all subdirectories


void Draw(Option_t *option)
*-*-*-*-*-*-*-*-*-*-*-*Fill Graphics Structure and Paint*-*-*-*-*-*-*-*-*-*
*-*                    =================================
 Loop on all objects (memory or file) and all subdirectories


void FillBuffer(char *&buffer)
*-*-*-*-*-*-*-*-*-*-*-*Encode directory header into output buffer*-*-*-*-*-*
*-*                    =========================================

TObject* Get(const Text_t *namecycle)
*-*-*-*-*-*-*-* return pointer to object identified by namecycle*-*-*-*-*-*
*-*             ================================================
   namecycle has the format name;cycle
   name  = * is illegal, cycle = * is illegal
   cycle = "" or cycle = 9999 ==> apply to a memory object

   examples:
     foo   : get object named foo in memory
             if object is not in memory, try with highest cycle from file
     foo;1 : get cycle 1 of foo on file

 WARNING: Never use TDirectory::Get when namecycle is a directory itself.

TKey* GetKey(const Text_t *name, const Short_t cycle)
*-*-*-*-*-*-*-*-*-*-*Return pointer to key with name,cycle*-*-*-*-*-*-*-*
*-*                  =====================================
  if cycle = 9999 returns highest cycle


const char* GetPath() const
 Returns the full path of the directory. E.g. file:/dir1/dir2.
 The returned path will be re-used by the next call to GetPath().

TDirectory* mkdir(const Text_t *name, const Text_t *title)
 Create a sub-directory and return a pointer to the created directory.
 Returns 0 in case of error.
 Note that the directory name cannot contain slashes.

void ls(Option_t *option)
*-*-*-*-*-*-*-*-*-*-*-*List Directory contents*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                    =======================
  Indentation is used to identify the directory tree
  Subdirectories are listed first, then objects in memory, then objects on the file

  The option can has the following format:
     [-d |-m][<regexp>]
  Option -d means: only list objects in the file
         -m means: only list objects in memory
  The <regexp> will be used to match the name of the objects.
  By default memory and disk objects are listed.


void Paint(Option_t *option)
*-*-*-*-*-*-*-*-*-*-*-*Paint all objects in the directory *-*-*-*-*-*-*-*
*-*                    ==================================
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void Print(Option_t *option)
*-*-*-*-*-*-*-*-*-*-*-*Print all objects in the directory *-*-*-*-*-*-*-*
*-*                    ==================================


void Purge(Short_t)
 Purge lowest key cycles in a directory.
 By default, only the highest cycle of a key is kept. Keys for which
 the "KEEP" flag has been set are not removed. See TKey::Keep().

void pwd() const
 Print the path of the directory.

void ReadAll(Option_t *)
 Read objects from a ROOT db file directory into memory.
 If an object is already in memory, the memory copy is deleted
 and the object is again read from the file.

void ReadKeys()
*-*-*-*-*-*-*-*-*-*-*-*-*Read the KEYS linked list*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                      =========================
  Every directory has a linked list (fKeys). This linked list has been
  written on the file via WriteKeys as a single data record.

  It is interesting to call this function in the following situation.
  Assume another process1 is connecting this directory in Update mode
    -Process1 is adding/updating objects in this directory
    -You want to see the latest status from process1.
  Example Process1:
    obj1.Write();
    obj2.Write();
    gDirectory->SaveSelf();

  Example Process2
    gDirectory->ReadKeys();
    obj1->Draw();

  This is an efficient way (without opening/closing files) to view
  the latest updates of a file being modified by another process
  as it is typically the case in a data acquisition system.

void RecursiveRemove(TObject *obj)
*-*-*-*-*-*-*-*Recursively remove object from a Directory*-*-*-*-*-*-*-*
*-*            =========================================

void Save()
*-*-*-*-*-*-*-*-*-*Save recursively all directory keys and headers-*-*-*-*-*
*-*                ===============================================

void SaveSelf(Bool_t force)
*-*-*-*-*-*-*-*-*-*Save Directory keys and header*-*-*-*-*-*-*-*-*-*-*-*
*-*                ==============================
  If the directory has been modified (fModified set), write the keys
  and the directory header. This function assumes the cd is correctly set.

  It is recommended to use this function in the following situation:
  Assume a process1 using a directory in Update mode
    -New objects or modified objects have been written to the directory
    -You do not want to close the file
    -You want your changes be visible from another process2 already connected
     to this directory in read mode
    -Call this function
    -In process2, use TDirectory::ReadKeys to refresh the directory

Int_t Sizeof() const
*-*-*-*-*-*-*Return the size in bytes of the directory header*-*-*-*-*-*-*
*-*          ================================================

void Streamer(TBuffer &b)
*-*-*-*-*-*-*-*-*Stream a class object*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*              =========================================

void Write(const Text_t *, Int_t opt, Int_t bufsiz)
 Write all objects in memory to disk.
 Loop on all objects in memory (including subdirectories).
 A new key is created in the KEYS linked list for each object.
 For allowed options see TObject::Write().
 The directory header info is rewritten on the directory header record

void WriteDirHeader()
*-*-*-*-*-*-*-*-*-*-*Overwrite the Directory header record*-*-*-*-*-*-*-*-*
*-*                  =====================================

void WriteKeys()
*-*-*-*-*-*-*-*-*-*-*-*Write KEYS linked list on the file *-*-*-*-*-*-*-*
*-*                    ==================================
  The linked list of keys (fKeys) is written as a single data record


void EncodeNameCycle(Text_t *buffer, const Text_t *name, Short_t cycle)
 Encode the name and cycle into buffer like: "aap;2".

void DecodeNameCycle(const Text_t *buffer, Text_t *name, Short_t &cycle)
 Decode a namecycle "aap;2" into name "aap" and cycle "2".



Inline Functions


               void operator=(const TDirectory&)
               void Copy(TObject&)
             TFile* GetFile()
             TList* GetList() const
             TList* GetListOfKeys() const
           TObject* GetMother() const
              Int_t GetNkeys()
             Seek_t GetSeekDir()
             Seek_t GetSeekParent()
             Seek_t GetSeekKeys()
             Bool_t IsFolder()
             Bool_t IsModified()
             Bool_t IsWritable()
               void SetModified()
               void SetMother(TObject* mother)
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)


Author: Rene Brun 28/11/94
Last update: 2.23/05 18/10/99 20.16.37 by Fons Rademakers
Copyright (c) 1995-1999, The ROOT System, All rights reserved. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.