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

/ray/src/vm/vartype.h

Go to the documentation of this file.
00001 /*
00002  * vm/vartype.h
00003  * 
00004  * VM basic variable type. 
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_VARTYPE_H_
00018 #define _VM_VARTYPE_H_ 1
00019 
00027 #include <vm/vmconfig.h>    /* MUST be first */
00028 #include <lib/tl/tlstring.h>
00029 
00030 
00031 namespace VM
00032 {
00033 
00046 struct _packed_ VarType
00047 {
00048     enum ID
00049     {
00050         Unknown=0,  
00051         Byte,   
00052         Short,  
00053         Int,    
00054         Long,   
00055         Flt,    
00056         Dbl,    
00057         Ptr,    
00058     };
00059     
00060     ID id : 8;   
00061     uint8 array; 
00062     
00064     inline VarType() : id(Unknown),array(0) {}
00066     inline VarType(ID _id,uint8 _array) : id(_id),array(_array) {}
00068     inline VarType(const VarType &vt) : id(vt.id),array(vt.array) {}
00070     inline ~VarType() {}
00071     
00073     inline VarType &operator=(const VarType &vt)
00074         {  id=vt.id;  array=vt.array;  return(*this);  }
00075     
00077     inline bool operator==(const VarType &vt) const
00078         {  return(id==vt.id && array==vt.array);  }
00080     inline bool operator!=(const VarType &vt) const
00081         {  return(id!=vt.id || array!=vt.array);  }
00082     
00084     inline bool IsPointerType() const
00085         {  return(array || id==Ptr);  }
00086     
00088     TLString TypeString() const;
00089 };
00090 
00091 }  // end of namespace VM
00092 
00093 #endif  /* _VM_VARTYPE_H_ */

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