Logo ROOT   6.12/07
Reference Guide
TFolder.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Rene Brun 02/09/2000
3 
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  *************************************************************************/
11 
12 #ifndef ROOT_TFolder
13 #define ROOT_TFolder
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TFolder //
19 // //
20 // Describe a folder: a list of objects and folders //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "TNamed.h"
25 
26 class TCollection;
27 class TBrowser;
28 
29 
30 class TFolder : public TNamed {
31 
32 protected:
33  TCollection *fFolders; //pointer to the list of folders
34  Bool_t fIsOwner; //true if folder own its contained objects
35 
36 private:
37  TFolder(const TFolder &folder); //folders cannot be copied
38  void operator=(const TFolder &);
39 
40 public:
41 
42  TFolder();
43  TFolder(const char *name, const char *title);
44  virtual ~TFolder();
45  virtual void Add(TObject *obj);
46  TFolder *AddFolder(const char *name, const char *title, TCollection *collection=0);
47  virtual void Browse(TBrowser *b);
48  virtual void Clear(Option_t *option="");
49  virtual void Copy(TObject &) const { MayNotUse("Copy(TObject &)"); }
50  virtual const char *FindFullPathName(const char *name) const;
51  virtual const char *FindFullPathName(const TObject *obj) const;
52  virtual TObject *FindObject(const char *name) const;
53  virtual TObject *FindObject(const TObject *obj) const;
54  virtual TObject *FindObjectAny(const char *name) const;
55  TCollection *GetListOfFolders() const { return fFolders; }
56  Bool_t IsFolder() const { return kTRUE; }
57  Bool_t IsOwner() const;
58  virtual void ls(Option_t *option="") const; // *MENU*
59  virtual Int_t Occurence(const TObject *obj) const;
60  virtual void RecursiveRemove(TObject *obj);
61  virtual void Remove(TObject *obj);
62  virtual void SaveAs(const char *filename="",Option_t *option="") const; // *MENU*
63  virtual void SetOwner(Bool_t owner=kTRUE);
64 
65  ClassDef(TFolder,1) //Describe a folder: a list of objects and folders
66 };
67 
68 #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:30
Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects)...
Definition: TFolder.h:56
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
TFolder()
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:34
#define ClassDef(name, id)
Definition: Rtypes.h:320
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
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:933
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:55
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
virtual void ls(Option_t *option="") const
List folder contents.
Definition: TFolder.cxx:397
TCollection * fFolders
Definition: TFolder.h:33
Collection abstract base class.
Definition: TCollection.h:63
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
virtual void Copy(TObject &) const
Copy this to obj.
Definition: TFolder.h:49
const Bool_t kTRUE
Definition: RtypesCore.h:87
char name[80]
Definition: TGX11.cxx:109
virtual void Browse(TBrowser *b)
Browse this folder.
Definition: TFolder.cxx:217