1    	/* /% C++ %/ */
2    	/***********************************************************************
3    	 * cint (C/C++ interpreter)
4    	 ************************************************************************
5    	 * Header file Class.h
6    	 ************************************************************************
7    	 * Description:
8    	 *  Extended Run Time Type Identification API
9    	 ************************************************************************
10   	 * Copyright(c) 1995~1998  Masaharu Goto 
11   	 *
12   	 * For the licensing terms see the file COPYING
13   	 *
14   	 ************************************************************************/
15   	
16   	
17   	#ifndef G__CLASSINFO_H
18   	#define G__CLASSINFO_H 
19   	
20   	#ifndef G__API_H
21   	#include "Api.h"
22   	#endif
23   	
24   	namespace Cint {
25   	
26   	class G__MethodInfo;
27   	class G__DataMemberInfo;
28   	class G__FriendInfo;
29   	
30   	/*********************************************************************
31   	* class G__ClassInfo
32   	*
33   	* 
34   	*********************************************************************/
35   	class 
36   	#ifndef __CINT__
37   	G__EXPORT
38   	#endif
39   	G__ClassInfo {
40   	 public:
41   	  virtual ~G__ClassInfo() {}
42   	  G__ClassInfo(): tagnum(0), class_property(0) { Init(); }
43   	  void Init();
44   	  G__ClassInfo(const char *classname): tagnum(0), class_property(0){ Init(classname); } 
45   	  void Init(const char *classname);
46   	  G__ClassInfo(const G__value &value_for_type);
47   	  G__ClassInfo(int tagnumin): tagnum(0), class_property(0) { Init(tagnumin); } 
48   	  void Init(int tagnumin);
49   	
50   	  int operator==(const G__ClassInfo& a);
51   	  int operator!=(const G__ClassInfo& a);
52   	
53   	  const char *Name() ;
54   	  const char *Fullname();
55   	  const char *Title() ;
56   	  int Size() ; 
57   	  long Property();
58   	  int NDataMembers();
59   	  int NMethods();
60   	  long IsBase(const char *classname);
61   	  long IsBase(G__ClassInfo& a);
62   	  void* DynamicCast(G__ClassInfo& to, void* obj);
63   	  int Tagnum() const { return(tagnum); }
64   	  G__ClassInfo EnclosingClass() ;
65   	  G__ClassInfo EnclosingSpace() ;
66   	  struct G__friendtag* GetFriendInfo(); 
67   	  void SetGlobalcomp(G__SIGNEDCHAR_T globalcomp);
68   	  void SetProtectedAccess(int protectedaccess);
69   	#ifdef G__OLDIMPLEMENTATION1218_YET
70   	  int IsValid() { return 0<=tagnum && tagnum<G__struct.alltag ? 1 : 0; }
71   	#else
72   	  int IsValid();
73   	#endif
74   	  int IsLoaded();
75   	  int SetFilePos(const char *fname);
76   	  int Next();
77   	  int Linkage();
78   	
79   	  const char *FileName() ;
80   	  int LineNumber() ;
81   	
82   	  int IsTmplt();
83   	  const char* TmpltName();
84   	  const char* TmpltArg();
85   	  
86   	
87   	 protected:
88   	  int tagnum;  // class,struct,union,enum key for cint dictionary
89   	  long class_property;  // cache value (expensive to get)
90   	
91   	 ///////////////////////////////////////////////////////////////
92   	 // Following things have to be added for ROOT
93   	 ///////////////////////////////////////////////////////////////
94   	 public:
95   	  void SetDefFile(char *deffilein);
96   	  void SetDefLine(int deflinein);
97   	  void SetImpFile(char *impfilein);
98   	  void SetImpLine(int implinein);
99   	  void SetVersion(int versionin);
100  	  const char *DefFile();
101  	  int DefLine();
102  	  const char *ImpFile();
103  	  int ImpLine();
104  	  int Version();
105  	  void *New();
106  	  void *New(int n);
107  	  void *New(void *arena);
108  	  void *New(int n, void* arena);
109  	  void Delete(void* p) const ;
110  	  void Destruct(void* p) const ;
111  	  void DeleteArray(void* ary, int dtorOnly = 0);
112  	  int InstanceCount(); 
113  	  void ResetInstanceCount();
114  	  void IncInstanceCount();
115  	  int HeapInstanceCount();
116  	  void IncHeapInstanceCount();
117  	  void ResetHeapInstanceCount();
118  	  int RootFlag();
119  	  //void SetDefaultConstructor(void* p2f);
120  	  enum MatchMode { ExactMatch=0, ConversionMatch=1, ConversionMatchBytecode=2};
121  	  enum InheritanceMode { InThisScope=0, WithInheritance=1 };
122  	  G__InterfaceMethod GetInterfaceMethod(const char *fname,const char *arg
123  						,long* poffset
124  						,MatchMode mode=ConversionMatch
125  	                                        ,InheritanceMode imode=WithInheritance
126  						);
127  	  G__MethodInfo GetMethod(const char *fname,const char *arg,long* poffset
128  				  ,MatchMode mode=ConversionMatch
129  	                          ,InheritanceMode imode=WithInheritance
130  	                          );
131  	  G__MethodInfo GetMethod(const char *fname,struct G__param* libp,long* poffset
132  				  ,MatchMode mode=ConversionMatch
133  	                          ,InheritanceMode imode=WithInheritance
134  	                          );
135  	  G__MethodInfo GetDefaultConstructor();
136  	  G__MethodInfo GetCopyConstructor();
137  	  G__MethodInfo GetDestructor();
138  	  G__MethodInfo GetAssignOperator();
139  	  G__MethodInfo AddMethod(const char* typenam,const char* fname,const char *arg
140  	                          ,int isstatic=0,int isvirtual=0,void *methodAddress=0);
141  	  G__DataMemberInfo GetDataMember(const char *name,long* poffset);
142  	  int HasMethod(const char *fname);
143  	  int HasDataMember(const char *name);
144  	  int HasDefaultConstructor();
145  	
146  	 private:
147  	  void CheckValidRootInfo();
148  	
149  	
150  	 public:
151  	  long ClassProperty();
152  	  unsigned char FuncFlag(); 
153  	  static int GetNumClasses();
154  	
155  	};
156  	
157  	
158  	/*********************************************************************
159  	* class G__FriendInfo
160  	*
161  	* 
162  	*********************************************************************/
163  	class 
164  	#ifndef __CINT__
165  	G__EXPORT
166  	#endif
167  	G__FriendInfo {
168  	 public:
169  	  G__FriendInfo(struct G__friendtag *pin=0): pfriendtag(NULL), cls()
170  	    { Init(pin); }
171  	  G__FriendInfo(const G__FriendInfo& x): pfriendtag(x.pfriendtag), cls(x.cls) 
172  	    { Init(x.pfriendtag); }
173  	  G__FriendInfo& operator=(const G__FriendInfo& x) 
174  	    { Init(x.pfriendtag); return *this; }
175  	  void Init(struct G__friendtag* pin) {
176  	    pfriendtag = pin;
177  	    if(pfriendtag) cls.Init(pfriendtag->tagnum); 
178  	    else           cls.Init(-1);
179  	  }
180  	  G__ClassInfo* FriendOf() { return(&cls); }
181  	  int Next() { 
182  	    if(pfriendtag) {
183  	      pfriendtag=pfriendtag->next; 
184  	      Init(pfriendtag);
185  	      return(IsValid());
186  	    }
187  	    else {
188  	      return(0);
189  	    }
190  	  }
191  	  int IsValid() { if(pfriendtag) return(1); else return(0); }
192  	 private:
193  	  G__friendtag *pfriendtag;
194  	  G__ClassInfo cls;
195  	};
196  	
197  	} // namespace Cint
198  	
199  	using namespace Cint;
200  	#endif
201