Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
35 void SavePrimitiveNameTitle(std::ostream &out, const char *variable_name);
36
37public:
38 TNamed(): fName(), fTitle() { } // NOLINT: not allowed to use = default because of TObject::kIsOnHeap detection, see ROOT-10300
39 TNamed(const char *name, const char *title) : fName(name), fTitle(title) { }
40 TNamed(const TString &name, const TString &title) : fName(name), fTitle(title) { }
41 TNamed(const TNamed &named);
42 TNamed& operator=(const TNamed& rhs);
43 virtual ~TNamed();
44 void Clear(Option_t *option ="") override;
45 TObject *Clone(const char *newname="") const override;
46 Int_t Compare(const TObject *obj) const override;
47 void Copy(TObject &named) const override;
48 virtual void FillBuffer(char *&buffer);
49 const char *GetName() const override { return fName; }
50 const char *GetTitle() const override { return fTitle; }
51 ULong_t Hash() const override { return fName.Hash(); }
52 Bool_t IsSortable() const override { return kTRUE; }
53 virtual void SetName(const char *name); // *MENU*
54 virtual void SetNameTitle(const char *name, const char *title);
55 virtual void SetTitle(const char *title=""); // *MENU*
56 void ls(Option_t *option="") const override;
57 void Print(Option_t *option="") const override;
58 virtual Int_t Sizeof() const;
59
60 ClassDefOverride(TNamed,1) //The basis for a named object (name, title)
61};
62
63#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:52
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:39
void SavePrimitiveNameTitle(std::ostream &out, const char *variable_name)
Save object name and title into the output stream "out".
Definition TNamed.cxx:136
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:174
virtual ~TNamed()
TNamed destructor.
Definition TNamed.cxx:42
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
TNamed(const TString &name, const TString &title)
Definition TNamed.h:40
TString fTitle
Definition TNamed.h:33
TNamed()
Definition TNamed.h:38
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:150
ULong_t Hash() const override
Return hash value for this object.
Definition TNamed.h:51
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:183
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:164
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