Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

/ray/src/vm/input/classinfo.h

Go to the documentation of this file.
00001 /*
00002  * vm/input/classinfo.h
00003  * 
00004  * VM class information node. 
00005  * 
00006  * Copyright (c) 2004 by Wolfgang Wieser ] wwieser (a) gmx <*> de [ 
00007  * 
00008  * This file may be distributed and/or modified under the terms of the 
00009  * GNU General Public License version 2 as published by the Free Software 
00010  * Foundation. (See COPYING.GPL for details.)
00011  * 
00012  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00013  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00014  * 
00015  */
00016 
00017 #ifndef _VM_INPUT_CLASSINFO_H_
00018 #define _VM_INPUT_CLASSINFO_H_ 1
00019 
00027 #include <vm/vmconfig.h>    /* MUST be first */
00028 #include <vm/input/nspcinfo.h>
00029 
00030 
00031 namespace VM
00032 {
00033 
00045 class ClassInfoIE
00046 {
00047     public:
00050         TypeID class_tid;
00051     private:
00053         void operator=(const ClassInfoIE &);
00054     public:
00059         inline ClassInfoIE(TypeID _tid=0) : class_tid(_tid) {}
00062         ClassInfoIE(const ClassInfoIE &);
00064         inline ~ClassInfoIE() {}
00065         
00067         inline ClassInfo *ci();
00069         inline const ClassInfo *ci() const;
00070         
00072         TLString CompleteName() const;
00073 };
00074 
00075 
00083 class ClassInfo : public NamespaceInfo, public ClassInfoIE
00084 {
00085     // Friends used for parsing. 
00086     friend class AssemblerFile;
00087     friend class AssemblerFile_Plaintext;
00088     // Friend for linking. 
00089     friend class VMLinker;
00090     
00091     public:
00093         struct BaseEntry
00094         {
00097             //        master tree, the *ci pointer is used. 
00098             union {
00099                 TypeID tid;        
00100                 ClassInfoIE *ci;   
00101             };
00102             Offset off;   
00103             
00104             inline BaseEntry() {}
00105             inline ~BaseEntry() {}
00106         };
00107         
00109         struct MemberVarEntry
00110         {
00111             VarType vtype;  
00112             Offset off;     
00113             TLString name;  
00114             
00115             inline MemberVarEntry() : name() {}
00116             inline ~MemberVarEntry() {}
00117         };
00118         
00120         struct VTableEntry
00121         {
00130             union {
00131                 SymRef symref;  
00132                 SymbolEntryB *se;  
00133             };
00134             
00135             inline VTableEntry() {}
00136             inline ~VTableEntry() {}
00137         };
00138         
00139     protected:
00140         // NOTE: TypeID is stored in the base class ClassInfoIE. 
00141         
00142         Offset size;       
00143         
00145         uint32 nvirtuals;
00146         
00148         NonResizeableArray<BaseEntry,uint32> base;
00150         NonResizeableArray<VTableEntry,uint32> vtable;
00152         NonResizeableArray<MemberVarEntry,uint32> membvar;
00153         
00155         uint16 need_construct : 1;
00157         uint16 need_cast : 1;
00158         
00159     private:
00161         ClassInfo(const ClassInfo &);
00163         void operator=(const ClassInfo &);
00164     public:
00166         ClassInfo(const TLString &name,TypeID class_tid,
00167             NamespaceInfo *parent=NULL);
00169         ~ClassInfo();
00170         
00172         void DumpTree(StringTreeDump &dump,bool IDs_resolved,
00173             bool recurse) const;
00174         
00176         TLString CompleteName() const;
00177         
00179         inline TypeID ClassTID() const
00180             {  return(class_tid);  }
00181 };
00182 
00183 // This must be put here to be below ClassInfo definition. 
00184 inline ClassInfo *ClassInfoIE::ci()
00185     {  return(class_tid<0 ? NULL : static_cast<ClassInfo*>(this));  }
00186 inline const ClassInfo *ClassInfoIE::ci() const
00187     {  return(class_tid<0 ? NULL : static_cast<const ClassInfo*>(this));  }
00188 
00189 }  // end of namespace VM
00190 
00191 #endif  /* _VM_INPUT_CLASSINFO_H_ */

Generated on Sat Feb 19 22:33:46 2005 for Ray by doxygen 1.3.5