TClass
class description - source file - inheritance tree
private:
TMethod* GetClassMethod(Long_t faddr)
TMethod* GetClassMethod(const char* name, const char* signature)
void Init(const char* name, Version_t cversion, const type_info* info, IsAFunc_t isa, ShowMembersFunc_t showmember, const char* dfil, const char* ifil, Int_t dl, Int_t il)
void SetClassVersion(Version_t version)
public:
TClass()
TClass(const char* name)
TClass(const char* name, Version_t cversion, const char* dfil = "0", const char* ifil = "0", Int_t dl = 0, Int_t il = 0)
TClass(const char* name, Version_t cversion, const type_info& info, IsAFunc_t isa, ShowMembersFunc_t showmember, const char* dfil, const char* ifil, Int_t dl, Int_t il)
TClass(const TClass&)
virtual ~TClass()
void AddImplFile(const char* filename, int line)
void AddInstance(Bool_t heap = kFALSE)
static Int_t AutoBrowse(TObject* obj, TBrowser* browser)
virtual void Browse(TBrowser* b)
void BuildRealData(void* pointer = 0)
void BuildRealDataFake(const char* name, Int_t offset, TClass* cl)
Bool_t CanIgnoreTObjectStreamer()
static TClass* Class()
void Destructor(void* obj, Bool_t dtorOnly = kFALSE)
virtual void Draw(const Option_t* option)
void* DynamicCast(const TClass* base, void* obj, Bool_t up = kTRUE)
char* EscapeChars(char* text) const
TClass* GetActualClass(const void* object) const
TClass* GetBaseClass(const char* classname)
TClass* GetBaseClass(const TClass* base)
Int_t GetBaseClassOffset(const TClass* base)
TClass* GetBaseDataMember(const char* datamember)
UInt_t GetCheckSum(UInt_t code = 0) const
G__ClassInfo* GetClassInfo() const
Version_t GetClassVersion() const
TDataMember* GetDataMember(const char* datamember) const
Int_t GetDataMemberOffset(const char* membername) const
Short_t GetDeclFileLine() const
const char* GetDeclFileName() const
ROOT::DelFunc_t GetDelete() const
ROOT::DelArrFunc_t GetDeleteArray() const
ROOT::DesFunc_t GetDestructor() const
UInt_t GetHeapInstanceCount() const
Short_t GetImplFileLine() const
const char* GetImplFileName() const
UInt_t GetInstanceCount() const
TList* GetListOfAllPublicDataMembers()
TList* GetListOfAllPublicMethods()
TList* GetListOfBases()
TList* GetListOfDataMembers()
TList* GetListOfMethods()
TList* GetListOfRealData() const
void GetMenuItems(TList* listitems)
TList* GetMenuList() const
TMethod* GetMethod(const char* method, const char* params)
TMethod* GetMethodAllAny(const char* method)
TMethod* GetMethodAny(const char* method)
TMethod* GetMethodWithPrototype(const char* method, const char* proto)
Int_t GetNdata()
ROOT::NewFunc_t GetNew() const
ROOT::NewArrFunc_t GetNewArray() const
Int_t GetNmethods()
TRealData* GetRealData(const char* name) const
ShowMembersFunc_t GetShowMembersWrapper()
TStreamerInfo* GetStreamerInfo(Int_t version = 0)
TObjArray* GetStreamerInfos() const
const type_info* GetTypeInfo() const
void IgnoreTObjectStreamer(Bool_t ignore = kTRUE)
virtual Bool_t InheritsFrom(const char* cl) const
virtual Bool_t InheritsFrom(const TClass* cl) const
virtual TClass* IsA() const
static TClass::ENewType IsCallingNew()
virtual Bool_t IsFolder() const
Bool_t IsForeign() const
Bool_t IsLoaded() const
Bool_t IsTObject() const
static TClass* Load(TBuffer& b)
void MakeCustomMenuList()
void* New(TClass::ENewType defConstructor = kClassNew)
void* New(void* arena, TClass::ENewType defConstructor = kClassNew)
virtual Long_t Property() const
Int_t ReadBuffer(TBuffer& b, void* pointer, Int_t version, UInt_t start, UInt_t count)
Int_t ReadBuffer(TBuffer& b, void* pointer)
void ResetInstanceCount()
void ResetMenuList()
void SetDelete(ROOT::DelFunc_t deleteFunc)
void SetDeleteArray(ROOT::DelArrFunc_t deleteArrayFunc)
void SetDestructor(ROOT::DesFunc_t destructorFunc)
void SetNew(ROOT::NewFunc_t newFunc)
void SetNewArray(ROOT::NewArrFunc_t newArrayFunc)
void SetStreamer(const char* name, Streamer_t p)
TStreamerInfo* SetStreamerInfo(Int_t version, const char* info)
void SetUnloaded()
virtual void ShowMembers(TMemberInspector& insp, char* parent)
Int_t Size() const
void Store(TBuffer& b) const
void Streamer(void* object, TBuffer& b)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
Int_t WriteBuffer(TBuffer& b, void* pointer, const char* info)
private:
TObjArray* fStreamerInfo Array of TStreamerInfo
TList* fRealData linked list for persistent members including base classes
TList* fBase linked list for base classes
TList* fData linked list for data members
TList* fMethod linked list for methods
TList* fAllPubData all public data members (including from base classes)
TList* fAllPubMethod all public methods (including from base classes)
const char* fDeclFileName name of class declaration file
const char* fImplFileName name of class implementation file
Short_t fDeclFileLine line of class declaration
Short_t fImplFileLine line of class implementation
UInt_t fInstanceCount number of instances of this class
UInt_t fOnHeap number of instances on heap
UInt_t fCheckSum checksum of data members and base classes
Version_t fClassVersion Class version Identifier
G__ClassInfo* fClassInfo pointer to CINT class info class
TList* fClassMenuList list of class menu items
const type_info* fTypeInfo pointer to the C++ type information.
ShowMembersFunc_t fShowMembers pointer to the class's ShowMembers function
IsAFunc_t fIsA pointer to the class's IsA function.
void* fNew pointer to a function newing one object.
void* fNewArray pointer to a function newing an array of objects.
void* fDelete pointer to a function deleting one object.
void* fDeleteArray pointer to a function deleting an array of objects.
void* fDestructor pointer to a function call an object's destructor.
Bool_t fVersionUsed !Indicates whether GetClassVersion has been called
Long_t fProperty !Property
void* fInterStreamer !saved info to call Streamer
Long_t fOffsetStreamer !saved info to call Streamer
static TClass::ENewType fgCallingNew Intent of why/how TClass::New() is called
static Int_t fgClassCount provides unique id for a each class
public:
static const enum TClass:: kClassSaved
static const enum TClass:: kIgnoreTObjectStreamer
static const enum TClass:: kUnloaded
static const enum TClass:: kIsTObject
static const enum TClass:: kIsForeign
static const enum TClass:: kIsEmulation
static const TClass::ENewType kRealNew
static const TClass::ENewType kClassNew
static const TClass::ENewType kDummyNew
static const enum TClass:: kLoading
See also
-
TQClass
The ROOT global object gROOT contains a list of all defined
classes. This list is build when a reference to a class dictionary
is made. When this happens, the static "class"::Dictionary()
function is called to create a TClass object describing the
class. The Dictionary() function is defined in the ClassDef
macro and stored (at program startup or library load time) together
with the class name in the TClassTable singleton object.
For a description of all dictionary classes see TDictionary.
TClass() : TDictionary(), fNew(0), fNewArray(0), fDelete(0),
fDeleteArray(0), fDestructor(0), fVersionUsed(kFALSE),
fOffsetStreamer(0)
Default ctor.
TClass(const char *name) : TDictionary(), fNew(0), fNewArray(0),
fDelete(0), fDeleteArray(0), fDestructor(0),
fVersionUsed(kFALSE), fOffsetStreamer(0)
Create a TClass object. This object contains the full dictionary
of a class. It has list to baseclasses, datamembers and methods.
Use this ctor to create a standalone TClass object. Most useful
to get a TClass interface to an interpreted class. Used by TTabCom.
Normally you would use gROOT->GetClass("class") to get access to a
TClass object for a certain class.
TClass(const char *name, Version_t cversion,
const char *dfil, const char *ifil, Int_t dl, Int_t il)
: TDictionary(), fNew(0), fNewArray(0), fDelete(0), fDeleteArray(0),
fDestructor(0), fVersionUsed(kFALSE), fOffsetStreamer(0)
Create a TClass object. This object contains the full dictionary
of a class. It has list to baseclasses, datamembers and methods.
TClass(const char *name, Version_t cversion,
const type_info &info, IsAFunc_t isa,
ShowMembersFunc_t showmembers,
const char *dfil, const char *ifil, Int_t dl, Int_t il)
: TDictionary(), fNew(0), fNewArray(0), fDelete(0), fDeleteArray(0),
fDestructor(0), fVersionUsed(kFALSE), fOffsetStreamer(0)
Create a TClass object. This object contains the full dictionary
of a class. It has list to baseclasses, datamembers and methods.
void Init(const char *name, Version_t cversion,
const type_info *typeinfo, IsAFunc_t isa,
ShowMembersFunc_t showmembers,
const char *dfil, const char *ifil, Int_t dl, Int_t il)
Initialize a TClass object. This object contains the full dictionary
of a class. It has list to baseclasses, datamembers and methods.
~TClass()
TClass dtor. Deletes all list that might have been created.
void AddImplFile(const char* filename, int line)
Int_t AutoBrowse(TObject *obj, TBrowser *b)
Browse external object inherited from TObject.
It passes through inheritance tree and calls TBrowser::Add
in appropriate cases. Static function.
void Browse(TBrowser *b)
This method is called by a browser to get the class information.
void BuildRealData(void *pointer)
Build a full list of persistent data members.
Scans the list of all data members in the class itself and also
in all base classes. For each persistent data member, inserts a
TRealData object in the list fRealData.
If pointer is not 0, uses the object at pointer
otherwise creates a temporary object of this class.
void BuildRealDataFake(const char *name, Int_t offset, TClass *cl)
Build the list of real data for a fake class
void Draw(Option_t *option)
Draw detailed class inheritance structure.
If a class B inherits from a class A, the description of B is drawn
on the right side of the description of A.
Member functions overridden by B are shown in class A with a blue line
erasing the corresponding member function
char* EscapeChars(char *text) const
Introduce an escape character (@) in front of a special chars.
You need to use the result immediately before it is being overwritten.
TClass* GetActualClass(const void *object) const
Return a pointer the the real class of the object.
This is equivalent to object->IsA() when the class has a ClassDef.
It is REQUIRED that object is coming from a proper pointer to the
class represented by 'this'.
Example: Special case:
class MyClass : public AnotherClass, public TObject
then on return, one must do:
TObject *obj = (TObject*)((void*)myobject)directory->Get("some object of MyClass");
MyClass::Class()->GetActualClass(obj); // this would be wrong!!!
Also if the class represented by 'this' and NONE of its parents classes
have a virtual ptr table, the result will be 'this' and NOT the actual
class.
TClass* GetBaseClass(const char *classname)
Return pointer to the base class "classname". Returns 0 in case
"classname" is not a base class. Takes care of multiple inheritance.
TClass* GetBaseClass(const TClass *cl)
Return pointer to the base class "cl". Returns 0 in case "cl"
is not a base class. Takes care of multiple inheritance.
Int_t GetBaseClassOffset(const TClass *cl)
Return data member offset to the base class "cl".
Returns -1 in case "cl" is not a base class.
Takes care of multiple inheritance.
TClass* GetBaseDataMember(const char *datamember)
Return pointer to (base) class that contains datamember.
TDataMember* GetDataMember(const char *datamember) const
Return pointer to datamember object with name "datamember".
Int_t GetDataMemberOffset(const char *name) const
return offset for member name. name can be a data member in
the class itself, one of its base classes, or one member in
one of the aggregated classes.
In case of a fake class, the list of fake TRealData is built
TRealData* GetRealData(const char *name) const
return pointer to TRealData element with name.
name can be a data member in the class itself,
one of its base classes, or one member in
one of the aggregated classes.
In case of a fake class, the list of fake TRealData is built
TList* GetListOfBases()
Return list containing the TBaseClass(es) of a class.
TList* GetListOfDataMembers()
Return list containing the TDataMembers of a class.
TList* GetListOfMethods()
Return list containing the TMethods of a class.
TList* GetListOfAllPublicMethods()
Returns a list of all public methods of this class and its base classes.
Refers to a subset of the methods in GetListOfMethods() so don't do
GetListOfAllPublicMethods()->Delete().
Algorithm used to get the list is:
- put all methods of the class in the list (also protected and private
ones).
- loop over all base classes and add only those methods not already in the
list (also protected and private ones).
- once finished, loop over resulting list and remove all private and
protected methods.
TList* GetListOfAllPublicDataMembers()
Returns a list of all public data members of this class and its base
classes. Refers to a subset of the data members in GetListOfDatamembers()
so don't do GetListOfAllPublicDataMembers()->Delete().
void GetMenuItems(TList *list)
Returns list of methods accessible by context menu.
void ResetMenuList()
Resets the menu list to it's standard value.
void MakeCustomMenuList()
Makes a customizable version of the popup menu list, i.e. makes a list
of TClassMenuItem objects of methods accessible by context menu.
The standard (and different) way consists in having just one element
in this list, corresponding to the whole standard list.
Once the customizable version is done, one can remove or add elements.
TMethod* GetMethodAny(const char *method)
Return pointer to method without looking at parameters.
Does not look in (possible) base classes.
TMethod* GetMethodAllAny(const char *method)
Return pointer to method without looking at parameters.
Does look in all base classes.
TMethod* GetMethod(const char *method, const char *params)
Find the best method (if there is one) matching the parameters.
The params string must contain argument values, like "3189, "aap", 1.3".
The function invokes GetClassMethod to search for a possible method
in the class itself or in its base classes. Returns 0 in case method
is not found.
TMethod* GetMethodWithPrototype(const char *method, const char *proto)
Find the method with a given prototype. The proto string must be of the
form: "char*,int,double". Returns 0 in case method is not found.
TMethod* GetClassMethod(Long_t faddr)
Look for a method in this class that has the interface function
address faddr.
TMethod* GetClassMethod(const char *name, const char* params)
Look for a method in this class that has the name and
signature
Int_t GetNdata()
Return the number of data members of this class
Note that in case the list of data members is not yet created, it will be done
by GetListOfDataMembers().
Int_t GetNmethods()
Return the number of methods of this class
Note that in case the list of methods is not yet created, it will be done
by GetListOfMethods().
TStreamerInfo* GetStreamerInfo(Int_t version)
returns a pointer to the TStreamerInfo object for version
If the object doest not exist, it is created
void IgnoreTObjectStreamer(Bool_t ignore)
When the class kIgnoreTObjectStreamer bit is set, the automatically
generated Streamer will not call TObject::Streamer.
This option saves the TObject space overhead on the file.
However, the information (fBits, fUniqueID) of TObject is lost.
Note that this function must be called for the class deriving
directly from TObject, eg, assuming that BigTrack derives from Track
and Track derives from TObject, one must do:
Track::Class()->IgnoreTObjectStreamer();
and not:
BigTrack::Class()->IgnoreTObjectStreamer();
Bool_t InheritsFrom(const char *classname) const
Return kTRUE if this class inherits from a class with name "classname".
Bool_t InheritsFrom(const TClass *cl) const
Return kTRUE if this class inherits from class cl.
void* DynamicCast(const TClass *cl, void *obj, Bool_t up)
Cast obj of this class type up to baseclass cl if up is true.
Cast obj of this class type down from baseclass cl if up is false.
If this class is not a baseclass of cl return 0, else the pointer
to the cl part of this (up) or to this (down).
void* New(ENewType defConstructor)
Return a pointer to a newly allocated object of this class.
The class must have a default constructor. For meaning of
defConstructor, see TClass::IsCallingNew().
void* New(void *arena, ENewType defConstructor)
Return a pointer to a newly allocated object of this class.
The class must have a default constructor. For meaning of
defConstructor, see TClass::IsCallingNew().
void Destructor(void *obj, Bool_t dtorOnly)
Explicitely call destructor for object.
Int_t Size() const
Return size of object of this class.
TClass* Load(TBuffer &b)
Load class description from I/O buffer and return class object.
void Store(TBuffer &b) const
Store class description on I/O buffer.
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a
process's memory. Return false, after the shared library has been
unloaded or if this is a 'fake' class created from a file's StreamerInfo.
Bool_t IsTObject() const
Bool_t IsForeign() const
Long_t Property() const
void SetUnloaded()
Call this method to indicate that the shared library containing this
class's code has been removed (unloaded) from the process's memory
TStreamerInfo* SetStreamerInfo(Int_t /*version*/, const char * /*info*/)
Info is a string describing the names and types of attributes
written by the class Streamer function.
If info is an empty string (when called by TObject::StreamerInfo)
the default Streamer info string is build. This corresponds to
the case of an automatically generated Streamer.
In case of user defined Streamer function, it is the user responsability
to implement a StreamerInfo function (override TObject::StreamerInfo).
The user must call IsA()->SetStreamerInfo(info) from this function.
UInt_t GetCheckSum(UInt_t code) const
Compute and/or return the class check sum.
The class ckecksum is used by the automatic schema evolution algorithm
to uniquely identify a class version.
The check sum is built from the names/types of base classes and
data members.
Algorithm from Victor Perevovchikov (perev@bnl.gov).
if code==1 data members of type enum are not counted in the checksum
void SetStreamer(const char *name, Streamer_t p)
Store pointer to function to Stream non basic member name.
Int_t ReadBuffer(TBuffer &b, void *pointer, Int_t version, UInt_t start, UInt_t count)
Function called by the Streamer functions to deserialize information
from buffer b into object at p.
This function assumes that the class version and the byte count information
have been read.
version is the version number of the class
start is the starting position in the buffer b
count is the number of bytes for this object in the buffer
Int_t ReadBuffer(TBuffer &b, void *pointer)
Function called by the Streamer functions to deserialize information
from buffer b into object at p.
Int_t WriteBuffer(TBuffer &b, void *pointer, const char *info)
Function called by the Streamer functions to serialize object at p
to buffer b. The optional argument info may be specified to give an
alternative StreamerInfo instead of using the default StreamerInfo
automatically built from the class definition.
For more information, see class TStreamerInfo.
void Streamer(void *object, TBuffer &b)
void SetNew(ROOT::NewFunc_t newFunc)
void SetNewArray(ROOT::NewArrFunc_t newArrayFunc)
void SetDelete(ROOT::DelFunc_t deleteFunc)
void SetDeleteArray(ROOT::DelArrFunc_t deleteArrayFunc)
void SetDestructor(ROOT::DesFunc_t destructorFunc)
ROOT::NewFunc_t GetNew() const
ROOT::NewArrFunc_t GetNewArray() const
ROOT::DelFunc_t GetDelete() const
ROOT::DelArrFunc_t GetDeleteArray() const
ROOT::DesFunc_t GetDestructor() const
Inline Functions
void SetClassVersion(Version_t version)
void AddInstance(Bool_t heap = kFALSE)
Bool_t CanIgnoreTObjectStreamer()
Version_t GetClassVersion() const
const char* GetDeclFileName() const
Short_t GetDeclFileLine() const
G__ClassInfo* GetClassInfo() const
TList* GetListOfRealData() const
const char* GetImplFileName() const
Short_t GetImplFileLine() const
UInt_t GetInstanceCount() const
UInt_t GetHeapInstanceCount() const
TList* GetMenuList() const
ShowMembersFunc_t GetShowMembersWrapper()
TObjArray* GetStreamerInfos() const
const type_info* GetTypeInfo() const
Bool_t IsFolder() const
void ResetInstanceCount()
TClass::ENewType IsCallingNew()
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
TClass TClass(const TClass&)
Author: Rene Brun 07/01/95
Last update: root/meta:$Name: $:$Id: TClass.cxx,v 1.116 2003/04/18 19:27:51 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.