Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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#include "TObject.h"
26#include "TString.h"
27
28
29class TNamed : public TObject {
30
31protected:
32 TString fName; //object identifier
33 TString fTitle; //object title
34
35public:
36 TNamed(): fName(), fTitle() { }
37 TNamed(const char *name, const char *title) : fName(name), fTitle(title) { }
38 TNamed(const TString &name, const TString &title) : fName(name), fTitle(title) { }
39 TNamed(const TNamed &named);
40 TNamed& operator=(const TNamed& rhs);
41 virtual ~TNamed();
42 void Clear(Option_t *option ="") override;
43 TObject *Clone(const char *newname="") const override;
44 Int_t Compare(const TObject *obj) const override;
45 void Copy(TObject &named) const override;
46 virtual void FillBuffer(char *&buffer);
47 const char *GetName() const override { return fName; }
48 const char *GetTitle() const override { return fTitle; }
49 ULong_t Hash() const override { return fName.Hash(); }
50 Bool_t IsSortable() const override { return kTRUE; }
51 virtual void SetName(const char *name); // *MENU*
52 virtual void SetNameTitle(const char *name, const char *title);
53 virtual void SetTitle(const char *title=""); // *MENU*
54 void ls(Option_t *option="") const override;
55 void Print(Option_t *option="") const override;
56 virtual Int_t Sizeof() const;
57
58 ClassDefOverride(TNamed,1) //The basis for a named object (name, title)
59};
60
61#endif
int Int_t
Definition RtypesCore.h:45
unsigned long ULong_t
Definition RtypesCore.h:55
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t option
char name[80]
Definition TGX11.cxx:110
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Bool_t IsSortable() const override
Definition TNamed.h:50
virtual void FillBuffer(char *&buffer)
Encode TNamed into output buffer.
Definition TNamed.cxx:104
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
Definition TNamed.cxx:74
TNamed(const char *name, const char *title)
Definition TNamed.h:37
void Copy(TObject &named) const override
Copy this to obj.
Definition TNamed.cxx:94
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:164
virtual ~TNamed()
TNamed destructor.
Definition TNamed.cxx:42
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
TNamed(const TString &name, const TString &title)
Definition TNamed.h:38
TString fTitle
Definition TNamed.h:33
TNamed()
Definition TNamed.h:36
void Print(Option_t *option="") const override
Print TNamed name and title.
Definition TNamed.cxx:128
TString fName
Definition TNamed.h:32
void Clear(Option_t *option="") override
Set name and title to empty strings ("").
Definition TNamed.cxx:64
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
ULong_t Hash() const override
Return hash value for this object.
Definition TNamed.h:49
Int_t Compare(const TObject *obj) const override
Compare two TNamed objects.
Definition TNamed.cxx:85
virtual Int_t Sizeof() const
Return size of the TNamed part of the TObject.
Definition TNamed.cxx:173
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition TNamed.cxx:51
void ls(Option_t *option="") const override
List TNamed name and title.
Definition TNamed.cxx:113
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Definition TNamed.cxx:154
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:139
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition TString.cxx:677