Class.h

Go to the documentation of this file.
00001 /* /% C++ %/ */
00002 /***********************************************************************
00003  * cint (C/C++ interpreter)
00004  ************************************************************************
00005  * Header file Class.h
00006  ************************************************************************
00007  * Description:
00008  *  Extended Run Time Type Identification API
00009  ************************************************************************
00010  * Copyright(c) 1995~1998  Masaharu Goto 
00011  *
00012  * For the licensing terms see the file COPYING
00013  *
00014  ************************************************************************/
00015 
00016 
00017 #ifndef G__CLASSINFO_H
00018 #define G__CLASSINFO_H 
00019 
00020 #ifndef G__API_H
00021 #include "Api.h"
00022 #endif
00023 
00024 namespace Cint {
00025 
00026 class G__MethodInfo;
00027 class G__DataMemberInfo;
00028 class G__FriendInfo;
00029 
00030 /*********************************************************************
00031 * class G__ClassInfo
00032 *
00033 * 
00034 *********************************************************************/
00035 class 
00036 #ifndef __CINT__
00037 G__EXPORT
00038 #endif
00039 G__ClassInfo {
00040  public:
00041   virtual ~G__ClassInfo() {}
00042   G__ClassInfo(): tagnum(0), class_property(0) { Init(); }
00043   void Init();
00044   G__ClassInfo(const char *classname): tagnum(0), class_property(0){ Init(classname); } 
00045   void Init(const char *classname);
00046   G__ClassInfo(const G__value &value_for_type);
00047   G__ClassInfo(int tagnumin): tagnum(0), class_property(0) { Init(tagnumin); } 
00048   void Init(int tagnumin);
00049 
00050   int operator==(const G__ClassInfo& a);
00051   int operator!=(const G__ClassInfo& a);
00052 
00053   const char *Name() ;
00054   const char *Fullname();
00055   const char *Title() ;
00056   int Size() ; 
00057   long Property();
00058   int NDataMembers();
00059   int NMethods();
00060   long IsBase(const char *classname);
00061   long IsBase(G__ClassInfo& a);
00062   void* DynamicCast(G__ClassInfo& to, void* obj);
00063   long Tagnum() const { return(tagnum); }
00064   G__ClassInfo EnclosingClass() ;
00065   G__ClassInfo EnclosingSpace() ;
00066   struct G__friendtag* GetFriendInfo(); 
00067   void SetGlobalcomp(int globalcomp);
00068   void SetProtectedAccess(int protectedaccess);
00069 #ifdef G__OLDIMPLEMENTATION1218_YET
00070   int IsValid() { return 0<=tagnum && tagnum<G__struct.alltag ? 1 : 0; }
00071 #else
00072   int IsValid();
00073 #endif
00074   int IsLoaded();
00075   int SetFilePos(const char *fname);
00076   int Next();
00077   int Linkage();
00078 
00079   const char *FileName() ;
00080   int LineNumber() ;
00081 
00082   int IsTmplt();
00083   const char* TmpltName();
00084   const char* TmpltArg();
00085   
00086 
00087  protected:
00088   long tagnum;  // class,struct,union,enum key for cint dictionary
00089   long class_property;  // cache value (expensive to get)
00090 
00091  ///////////////////////////////////////////////////////////////
00092  // Following things have to be added for ROOT
00093  ///////////////////////////////////////////////////////////////
00094  public:
00095   void SetDefFile(char *deffilein);
00096   void SetDefLine(int deflinein);
00097   void SetImpFile(char *impfilein);
00098   void SetImpLine(int implinein);
00099   void SetVersion(int versionin);
00100   const char *DefFile();
00101   int DefLine();
00102   const char *ImpFile();
00103   int ImpLine();
00104   int Version();
00105   void *New();
00106   void *New(int n);
00107   void *New(void *arena);
00108   void *New(int n, void* arena);
00109   void Delete(void* p) const ;
00110   void Destruct(void* p) const ;
00111   void DeleteArray(void* ary, int dtorOnly = 0);
00112   int InstanceCount(); 
00113   void ResetInstanceCount();
00114   void IncInstanceCount();
00115   int HeapInstanceCount();
00116   void IncHeapInstanceCount();
00117   void ResetHeapInstanceCount();
00118   int RootFlag();
00119   //void SetDefaultConstructor(void* p2f);
00120   enum MatchMode { ExactMatch=0, ConversionMatch=1, ConversionMatchBytecode=2};
00121   enum InheritanceMode { InThisScope=0, WithInheritance=1 };
00122   G__InterfaceMethod GetInterfaceMethod(const char *fname,const char *arg
00123                                         ,long* poffset
00124                                         ,MatchMode mode=ConversionMatch
00125                                         ,InheritanceMode imode=WithInheritance
00126                                         );
00127   G__MethodInfo GetMethod(const char *fname,const char *arg,long* poffset
00128                           ,MatchMode mode=ConversionMatch
00129                           ,InheritanceMode imode=WithInheritance
00130                           );
00131   G__MethodInfo GetMethod(const char *fname,struct G__param* libp,long* poffset
00132                           ,MatchMode mode=ConversionMatch
00133                           ,InheritanceMode imode=WithInheritance
00134                           );
00135   G__MethodInfo GetDefaultConstructor();
00136   G__MethodInfo GetCopyConstructor();
00137   G__MethodInfo GetDestructor();
00138   G__MethodInfo GetAssignOperator();
00139   G__MethodInfo AddMethod(const char* typenam,const char* fname,const char *arg
00140                           ,int isstatic=0,int isvirtual=0,void *methodAddress=0);
00141   G__DataMemberInfo GetDataMember(const char *name,long* poffset);
00142   int HasMethod(const char *fname);
00143   int HasDataMember(const char *name);
00144   int HasDefaultConstructor();
00145 
00146  private:
00147   void CheckValidRootInfo();
00148 
00149 
00150  public:
00151   long ClassProperty();
00152   unsigned char FuncFlag(); 
00153   static int GetNumClasses();
00154 
00155 };
00156 
00157 
00158 /*********************************************************************
00159 * class G__FriendInfo
00160 *
00161 * 
00162 *********************************************************************/
00163 class 
00164 #ifndef __CINT__
00165 G__EXPORT
00166 #endif
00167 G__FriendInfo {
00168  public:
00169   G__FriendInfo(struct G__friendtag *pin=0): pfriendtag(NULL), cls()
00170     { Init(pin); }
00171   G__FriendInfo(const G__FriendInfo& x): pfriendtag(x.pfriendtag), cls(x.cls) 
00172     { Init(x.pfriendtag); }
00173   G__FriendInfo& operator=(const G__FriendInfo& x) 
00174     { Init(x.pfriendtag); return *this; }
00175   void Init(struct G__friendtag* pin) {
00176     pfriendtag = pin;
00177     if(pfriendtag) cls.Init(pfriendtag->tagnum); 
00178     else           cls.Init(-1);
00179   }
00180   G__ClassInfo* FriendOf() { return(&cls); }
00181   int Next() { 
00182     if(pfriendtag) {
00183       pfriendtag=pfriendtag->next; 
00184       Init(pfriendtag);
00185       return(IsValid());
00186     }
00187     else {
00188       return(0);
00189     }
00190   }
00191   int IsValid() { if(pfriendtag) return(1); else return(0); }
00192  private:
00193   G__friendtag *pfriendtag;
00194   G__ClassInfo cls;
00195 };
00196 
00197 } // namespace Cint
00198 
00199 using namespace Cint;
00200 #endif

Generated on Tue Jul 5 14:24:58 2011 for ROOT_528-00b_version by  doxygen 1.5.1