ROOT  6.06/09
Reference Guide
TNamed.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Rene Brun 26/12/94
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_TNamed
13 #define ROOT_TNamed
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TNamed //
19 // //
20 // The basis for a named object (name, title). //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 
25 #ifndef ROOT_TObject
26 #include "TObject.h"
27 #endif
28 #ifndef ROOT_TString
29 #include "TString.h"
30 #endif
31 
32 
33 class TNamed : public TObject {
34 
35 protected:
36  TString fName; //object identifier
37  TString fTitle; //object title
38 
39 public:
40  TNamed(): fName(), fTitle() { }
41  TNamed(const char *name, const char *title) : fName(name), fTitle(title) { }
42  TNamed(const TString &name, const TString &title) : fName(name), fTitle(title) { }
43  TNamed(const TNamed &named);
44  TNamed& operator=(const TNamed& rhs);
45  virtual ~TNamed() { }
46  virtual void Clear(Option_t *option ="");
47  virtual TObject *Clone(const char *newname="") const;
48  virtual Int_t Compare(const TObject *obj) const;
49  virtual void Copy(TObject &named) const;
50  virtual void FillBuffer(char *&buffer);
51  virtual const char *GetName() const { return fName; }
52  virtual const char *GetTitle() const { return fTitle; }
53  virtual ULong_t Hash() const { return fName.Hash(); }
54  virtual Bool_t IsSortable() const { return kTRUE; }
55  virtual void SetName(const char *name); // *MENU*
56  virtual void SetNameTitle(const char *name, const char *title);
57  virtual void SetTitle(const char *title=""); // *MENU*
58  virtual void ls(Option_t *option="") const;
59  virtual void Print(Option_t *option="") const;
60  virtual Int_t Sizeof() const;
61 
62  ClassDef(TNamed,1) //The basis for a named object (name, title)
63 };
64 
65 #endif
TString fTitle
Definition: TNamed.h:37
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
TNamed(const TString &name, const TString &title)
Definition: TNamed.h:42
virtual ~TNamed()
Definition: TNamed.h:45
const char Option_t
Definition: RtypesCore.h:62
virtual ULong_t Hash() const
Return hash value for this object.
Definition: TNamed.h:53
virtual void SetName(const char *name)
Change (i.e.
Definition: TNamed.cxx:128
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
virtual void FillBuffer(char *&buffer)
Encode TNamed into output buffer.
Definition: TNamed.cxx:93
bool Bool_t
Definition: RtypesCore.h:59
virtual void SetNameTitle(const char *name, const char *title)
Change (i.e. set) all the TNamed parameters (name and title).
Definition: TNamed.cxx:142
virtual void Clear(Option_t *option="")
Set name and title to empty strings ("").
Definition: TNamed.cxx:53
#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 Copy(TObject &named) const
Copy this to obj.
Definition: TNamed.cxx:83
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition: TNamed.cxx:63
virtual void ls(Option_t *option="") const
List TNamed name and title.
Definition: TNamed.cxx:102
virtual Int_t Compare(const TObject *obj) const
Compare two TNamed objects.
Definition: TNamed.cxx:74
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition: TNamed.cxx:40
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual void Print(Option_t *option="") const
Print TNamed name and title.
Definition: TNamed.cxx:117
TString fName
Definition: TNamed.h:36
TNamed()
Definition: TNamed.h:40
unsigned long ULong_t
Definition: RtypesCore.h:51
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual Bool_t IsSortable() const
Definition: TNamed.h:54
virtual Int_t Sizeof() const
Return size of the TNamed part of the TObject.
Definition: TNamed.cxx:161
Mother of all ROOT objects.
Definition: TObject.h:58
TNamed(const char *name, const char *title)
Definition: TNamed.h:41
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Definition: TNamed.cxx:152
TObject * obj
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition: TString.cxx:605