class TFolder: public TNamed


 A TFolder object is a collection of objects and folders.
 Folders have a name and a title and are identified in the folder hierarchy
 by a "Unix-like" naming mechanism. The root of all folders is //root.
 New folders can be dynamically added or removed to/from a folder.
 The folder hierarchy can be visualized via the TBrowser.

 The Root folders hierarchy can be seen as a whiteboard where objects
 are posted. Other classes/tasks can access these objects by specifying
 only a string pathname. This whiteboard facility greatly improves the
 modularity of an application, minimizing the class relationship problem
 that penalizes large applications.

 Pointers are efficient to communicate between classes.
 However, one has interest to minimize direct coupling between classes
 in the form of direct pointers. One better uses the naming and search
 service provided by the Root folders hierarchy. This makes the classes
 loosely coupled and also greatly facilitates I/O operations.
 In a client/server environment, this mechanism facilitates the access
 to any kind of object in //root stores running on different processes.

 A TFolder is created by invoking the TFolder constructor. It is placed
 inside an existing folder via the TFolder::AddFolder method.
 One can search for a folder or an object in a folder using the FindObject
 method. FindObject analyzes the string passed as its argument and searches
 in the hierarchy until it finds an object or folder matching the name.

 When a folder is deleted, its reference from the parent folder and
 possible other folders is deleted.

 If a folder has been declared the owner of its objects/folders via
 TFolder::SetOwner, then the contained objects are deleted when the
 folder is deleted. By default, a folder does not own its contained objects.
 NOTE that folder ownership can be set
   - via TFolder::SetOwner
   - or via TCollection::SetOwner on the collection specified to TFolder::AddFolder

 Standard Root objects are automatically added to the folder hierarchy.
 For example, the following folders exist:
   //root/Files      with the list of currently connected Root files
   //root/Classes    with the list of active classes
   //root/Geometries with active geometries
   //root/Canvases   with the list of active canvases
   //root/Styles     with the list of graphics styles
   //root/Colors     with the list of active colors

 For example, if a file "myFile.root" is added to the list of files, one can
 retrieve a pointer to the corresponding TFile object with a statement like:
   TFile *myFile = (TFile*)gROOT->FindObject("//root/Files/myFile.root");
 The above statement can be abbreviated to:
   TFile *myFile = (TFile*)gROOT->FindObject("/Files/myFile.root");
 or even to:
   TFile *myFile = (TFile*)gROOT->FindObjectAny("myFile.root");
 In this last case, the TROOT::FindObjectAny function will scan the folder hierarchy
 starting at //root and will return the first object named "myFile.root".

 Because a string-based search mechanism is expensive, it is recommended
 to save the pointer to the object as a class member or local variable
 if this pointer is used frequently or inside loops.


/* */

Function Members (Methods)

public:
TFolder()
TFolder(const char* name, const char* title)
virtual~TFolder()
voidTObject::AbstractMethod(const char* method) const
virtual voidAdd(TObject* obj)
TFolder*AddFolder(const char* name, const char* title, TCollection* collection = 0)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidBrowse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidClear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidCopy(TObject&) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual const char*FindFullPathName(const char* name) const
virtual const char*FindFullPathName(const TObject* obj) const
virtual TObject*FindObject(const char* name) const
virtual TObject*FindObject(const TObject* obj) const
virtual TObject*FindObjectAny(const char* name) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
TCollection*GetListOfFolders() const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tIsFolder() const
Bool_tTObject::IsOnHeap() const
Bool_tIsOwner() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidls(Option_t* option = "*") constMENU
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
virtual Int_tOccurence(const TObject* obj) const
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidRecursiveRemove(TObject* obj)
virtual voidRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidSaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetOwner(Bool_t owner = kTRUE)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
private:
TFolder(const TFolder& folder)
voidoperator=(const TFolder&)

Data Members

public:
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TCollection*fFolderspointer to the list of folders
Bool_tfIsOwnertrue if folder own its contained objects
TStringTNamed::fNameobject identifier
TStringTNamed::fTitleobject title

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TFolder(const TFolder& folder)
 Default constructor used by the Input functions.

 This constructor should not be called by a user directly.
 The normal way to create a folder is by calling TFolder::AddFolder.
TFolder(const char* name, const char* title)
 Create a normal folder.
 Use Add or AddFolder to add objects or folders to this folder.
TFolder(const TFolder& folder)
 Copy constructor.
~TFolder()
 Folder destructor. Remove all objects from its lists and delete
 all its sub folders.
void Add(TObject* obj)
 Add object to this folder. obj must be a TObject or a TFolder.
TFolder * AddFolder(const char* name, const char* title, TCollection* collection = 0)
 Create a new folder and add it to the list of folders of this folder,
 return a pointer to the created folder.
 Note that a folder can be added to several folders.

 If collection is non NULL, the pointer fFolders is set to the existing
 collection, otherwise a default collection (Tlist) is created.
 Note that the folder name cannot contain slashes.
void Browse(TBrowser* b)
 Browse this folder.
void Clear(Option_t* option = "")
 Delete all objects from a folder list.
const char * FindFullPathName(const char *name)
 Return the full pathname corresponding to subpath name.
 The returned path will be re-used by the next call to GetPath().
const char * FindFullPathName(const TObject *)
 Return the full pathname corresponding to subpath name.
 The returned path will be re-used by the next call to GetPath().
TObject * FindObject(const TObject *)
 Find object in an folder.
TObject * FindObject(const char *name)
 Search object identified by name in the tree of folders inside
 this folder.
 Name may be of the forms:
   A, Specify a full pathname starting at the top ROOT folder
     //root/xxx/yyy/name

   B, Specify a pathname starting with a single slash. //root is assumed
     /xxx/yyy/name

   C, Specify a pathname relative to this folder
     xxx/yyy/name
     name
TObject * FindObjectAny(const char* name) const
 Return a pointer to the first object with name starting at this folder.
Bool_t IsOwner()
 Folder ownership has been set via
   - TFolder::SetOwner
   - TCollection::SetOwner on the collection specified to TFolder::AddFolder
void ls(Option_t* option = "*") const
 List folder contents
   If option contains "dump",  the Dump function of contained objects is called.
   If option contains "print", the Print function of contained objects is called.
   By default the ls function of contained objects is called.
  Indentation is used to identify the folder tree.

  The <regexp> will be used to match the name of the objects.
Int_t Occurence(const TObject* obj) const
 Return occurence number of object in the list of objects of this folder.
 The function returns the number of objects with the same name as object
 found in the list of objects in this folder before object itself.
 If only one object is found, return 0.
void RecursiveRemove(TObject* obj)
 Recursively remove object from a folder.
void Remove(TObject* obj)
 Remove object from this folder. obj must be a TObject or a TFolder.
void SaveAs(const char* filename = "", Option_t* option = "") const
 Save all objects in this folder in filename.
 Each object in this folder will have a key in the file where the name of
 the key will be the name of the object.
void SetOwner(Bool_t owner = kTRUE)
 Set ownership.
 If the folder is declared owner, when the folder is deleted, all
 the objects added via TFolder::Add are deleted via TObject::Delete,
 otherwise TObject::Clear is called.

 NOTE that folder ownership can be set:
   - via TFolder::SetOwner
   - or via TCollection::SetOwner on the collection specified to TFolder::AddFolder
void operator=(const TFolder& )
void Copy(TObject& ) const
{ MayNotUse("Copy(TObject &)"); }
TCollection * GetListOfFolders()
{ return fFolders; }
Bool_t IsFolder()
{ return kTRUE; }

Author: Rene Brun 02/09/2000
Last change: root/base:$Id: TFolder.h 20877 2007-11-19 11:17:07Z rdm $
Last generated: 2008-06-25 08:39
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *

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.