ROOT logo
// @(#)root/meta:$Id: TBaseClass.cxx 34924 2010-08-21 05:39:09Z pcanal $
// Author: Fons Rademakers   08/02/95

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include "TBaseClass.h"
#include "TClass.h"
#include "TInterpreter.h"

//////////////////////////////////////////////////////////////////////////
//                                                                      //
//  Each class (see TClass) has a linked list of its base class(es).    //
//  This class describes one single base class.                         //
//  The base class info is obtained via the CINT api.                   //
//     see class TCint.                                                 //
//                                                                      //
//  The base class information is used a.o. in to find all inherited    //
//  methods.                                                            //
//                                                                      //
//////////////////////////////////////////////////////////////////////////


ClassImp(TBaseClass)

//______________________________________________________________________________
TBaseClass::TBaseClass(BaseClassInfo_t *info, TClass *cl) : TDictionary()
{
   // Default TBaseClass ctor. TBaseClasses are constructed in TClass
   // via a call to TCint::CreateListOfBaseClasses().

   fInfo     = info;
   fClass    = cl;
   fClassPtr = 0;
   if (fInfo) SetName(gCint->BaseClassInfo_FullName(fInfo));
}

//______________________________________________________________________________
TBaseClass::~TBaseClass()
{
   // TBaseClass dtor deletes adopted CINT BaseClassInfo object.

   gCint->BaseClassInfo_Delete(fInfo);
}

//______________________________________________________________________________
void TBaseClass::Browse(TBrowser *b)
{
   // Called by the browser, to browse a baseclass.

   TClass *c = GetClassPointer();
   if (c) c->Browse(b);
}

//______________________________________________________________________________
TClass *TBaseClass::GetClassPointer(Bool_t load)
{
   // Get pointer to the base class TClass.

   if (!fClassPtr) fClassPtr = TClass::GetClass(fName, load);
   return fClassPtr;
}

//______________________________________________________________________________
Int_t TBaseClass::GetDelta() const
{
   // Get offset from "this" to part of base class.

   return (Int_t)gCint->BaseClassInfo_Offset(fInfo);
}

//______________________________________________________________________________
const char *TBaseClass::GetTitle() const
{
   // Get base class description (comment).

   TClass *c = ((TBaseClass *)this)->GetClassPointer();
   return c ? c->GetTitle() : "";
}

//______________________________________________________________________________
int TBaseClass::IsSTLContainer()
{
   // Return which type (if any) of STL container the data member is.

   if (!fInfo) return kNone;
   const char *type = gCint->BaseClassInfo_TmpltName(fInfo);
   if (!type) return kNone;

   if (!strcmp(type, "vector"))   return kVector;
   if (!strcmp(type, "list"))     return kList;
   if (!strcmp(type, "deque"))    return kDeque;
   if (!strcmp(type, "map"))      return kMap;
   if (!strcmp(type, "multimap")) return kMultimap;
   if (!strcmp(type, "set"))      return kSet;
   if (!strcmp(type, "multiset")) return kMultiset;
   return kNone;
}

//______________________________________________________________________________
Long_t TBaseClass::Property() const
{
   // Get property description word. For meaning of bits see EProperty.

   return gCint->BaseClassInfo_Property(fInfo);
}
 TBaseClass.cxx:1
 TBaseClass.cxx:2
 TBaseClass.cxx:3
 TBaseClass.cxx:4
 TBaseClass.cxx:5
 TBaseClass.cxx:6
 TBaseClass.cxx:7
 TBaseClass.cxx:8
 TBaseClass.cxx:9
 TBaseClass.cxx:10
 TBaseClass.cxx:11
 TBaseClass.cxx:12
 TBaseClass.cxx:13
 TBaseClass.cxx:14
 TBaseClass.cxx:15
 TBaseClass.cxx:16
 TBaseClass.cxx:17
 TBaseClass.cxx:18
 TBaseClass.cxx:19
 TBaseClass.cxx:20
 TBaseClass.cxx:21
 TBaseClass.cxx:22
 TBaseClass.cxx:23
 TBaseClass.cxx:24
 TBaseClass.cxx:25
 TBaseClass.cxx:26
 TBaseClass.cxx:27
 TBaseClass.cxx:28
 TBaseClass.cxx:29
 TBaseClass.cxx:30
 TBaseClass.cxx:31
 TBaseClass.cxx:32
 TBaseClass.cxx:33
 TBaseClass.cxx:34
 TBaseClass.cxx:35
 TBaseClass.cxx:36
 TBaseClass.cxx:37
 TBaseClass.cxx:38
 TBaseClass.cxx:39
 TBaseClass.cxx:40
 TBaseClass.cxx:41
 TBaseClass.cxx:42
 TBaseClass.cxx:43
 TBaseClass.cxx:44
 TBaseClass.cxx:45
 TBaseClass.cxx:46
 TBaseClass.cxx:47
 TBaseClass.cxx:48
 TBaseClass.cxx:49
 TBaseClass.cxx:50
 TBaseClass.cxx:51
 TBaseClass.cxx:52
 TBaseClass.cxx:53
 TBaseClass.cxx:54
 TBaseClass.cxx:55
 TBaseClass.cxx:56
 TBaseClass.cxx:57
 TBaseClass.cxx:58
 TBaseClass.cxx:59
 TBaseClass.cxx:60
 TBaseClass.cxx:61
 TBaseClass.cxx:62
 TBaseClass.cxx:63
 TBaseClass.cxx:64
 TBaseClass.cxx:65
 TBaseClass.cxx:66
 TBaseClass.cxx:67
 TBaseClass.cxx:68
 TBaseClass.cxx:69
 TBaseClass.cxx:70
 TBaseClass.cxx:71
 TBaseClass.cxx:72
 TBaseClass.cxx:73
 TBaseClass.cxx:74
 TBaseClass.cxx:75
 TBaseClass.cxx:76
 TBaseClass.cxx:77
 TBaseClass.cxx:78
 TBaseClass.cxx:79
 TBaseClass.cxx:80
 TBaseClass.cxx:81
 TBaseClass.cxx:82
 TBaseClass.cxx:83
 TBaseClass.cxx:84
 TBaseClass.cxx:85
 TBaseClass.cxx:86
 TBaseClass.cxx:87
 TBaseClass.cxx:88
 TBaseClass.cxx:89
 TBaseClass.cxx:90
 TBaseClass.cxx:91
 TBaseClass.cxx:92
 TBaseClass.cxx:93
 TBaseClass.cxx:94
 TBaseClass.cxx:95
 TBaseClass.cxx:96
 TBaseClass.cxx:97
 TBaseClass.cxx:98
 TBaseClass.cxx:99
 TBaseClass.cxx:100
 TBaseClass.cxx:101
 TBaseClass.cxx:102
 TBaseClass.cxx:103
 TBaseClass.cxx:104
 TBaseClass.cxx:105
 TBaseClass.cxx:106
 TBaseClass.cxx:107
 TBaseClass.cxx:108
 TBaseClass.cxx:109
 TBaseClass.cxx:110
 TBaseClass.cxx:111