Logo ROOT   6.08/07
Reference Guide
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Rene Brun 02/09/2000
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
12 #ifndef ROOT_TFolder
13 #define ROOT_TFolder
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TFolder //
19 // //
20 // Describe a folder: a list of objects and folders //
21 // //
22 //////////////////////////////////////////////////////////////////////////
24 #ifndef ROOT_TNamed
25 #include "TNamed.h"
26 #endif
28 class TCollection;
29 class TBrowser;
32 class TFolder : public TNamed {
34 protected:
35  TCollection *fFolders; //pointer to the list of folders
36  Bool_t fIsOwner; //true if folder own its contained objects
38 private:
39  TFolder(const TFolder &folder); //folders cannot be copied
40  void operator=(const TFolder &);
42 public:
44  TFolder();
45  TFolder(const char *name, const char *title);
46  virtual ~TFolder();
47  virtual void Add(TObject *obj);
48  TFolder *AddFolder(const char *name, const char *title, TCollection *collection=0);
49  virtual void Browse(TBrowser *b);
50  virtual void Clear(Option_t *option="");
51  virtual void Copy(TObject &) const { MayNotUse("Copy(TObject &)"); }
52  virtual const char *FindFullPathName(const char *name) const;
53  virtual const char *FindFullPathName(const TObject *obj) const;
54  virtual TObject *FindObject(const char *name) const;
55  virtual TObject *FindObject(const TObject *obj) const;
56  virtual TObject *FindObjectAny(const char *name) const;
57  TCollection *GetListOfFolders() const { return fFolders; }
58  Bool_t IsFolder() const { return kTRUE; }
59  Bool_t IsOwner() const;
60  virtual void ls(Option_t *option="") const; // *MENU*
61  virtual Int_t Occurence(const TObject *obj) const;
62  virtual void RecursiveRemove(TObject *obj);
63  virtual void Remove(TObject *obj);
64  virtual void SaveAs(const char *filename="",Option_t *option="") const; // *MENU*
65  virtual void SetOwner(Bool_t owner=kTRUE);
67  ClassDef(TFolder,1) //Describe a folder: a list of objects and folders
68 };
70 #endif
virtual Int_t Occurence(const TObject *obj) const
Return occurence number of object in the list of objects of this folder.
Definition: TFolder.cxx:436
A TFolder object is a collection of objects and folders.
Definition: TFolder.h:32
Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects)...
Definition: TFolder.h:58
virtual void SetOwner(Bool_t owner=kTRUE)
Set ownership.
Definition: TFolder.cxx:492
const char Option_t
Definition: RtypesCore.h:62
virtual void Remove(TObject *obj)
Remove object from this folder. obj must be a TObject or a TFolder.
Definition: TFolder.cxx:466
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Default constructor used by the Input functions.
Definition: TFolder.cxx:108
virtual TObject * FindObjectAny(const char *name) const
Return a pointer to the first object with name starting at this folder.
Definition: TFolder.cxx:352
Bool_t fIsOwner
Definition: TFolder.h:36
#define ClassDef(name, id)
Definition: Rtypes.h:254
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
virtual void Add(TObject *obj)
Add object to this folder. obj must be a TObject or a TFolder.
Definition: TFolder.cxx:170
Bool_t IsOwner() const
Folder ownership has been set via.
Definition: TFolder.cxx:378
void MayNotUse(const char *method) const
Use this method to signal that a method (defined in a base class) may not be called in a derived clas...
Definition: TObject.cxx:978
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from a folder.
Definition: TFolder.cxx:458
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...
Definition: TFolder.cxx:186
TCollection * GetListOfFolders() const
Definition: TFolder.h:57
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
virtual void ls(Option_t *option="") const
List folder contents.
Definition: TFolder.cxx:397
TCollection * fFolders
Definition: TFolder.h:35
Collection abstract base class.
Definition: TCollection.h:48
void operator=(const TFolder &)
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save all objects in this folder in filename.
Definition: TFolder.cxx:477
virtual const char * FindFullPathName(const char *name) const
Return the full pathname corresponding to subpath name if the node is gROOT->GetRootFolder() and retu...
Definition: TFolder.cxx:235
virtual TObject * FindObject(const char *name) const
Search object identified by name in the tree of folders inside this folder.
Definition: TFolder.cxx:310
virtual ~TFolder()
Folder destructor.
Definition: TFolder.cxx:137
Mother of all ROOT objects.
Definition: TObject.h:37
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
virtual void Clear(Option_t *option="")
Delete all objects from a folder list.
Definition: TFolder.cxx:225
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void Copy(TObject &) const
Copy this to obj.
Definition: TFolder.h:51
char name[80]
Definition: TGX11.cxx:109
virtual void Browse(TBrowser *b)
Browse this folder.
Definition: TFolder.cxx:217