Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

datatype.hpp

00001 /*
00002  * Copyright (c) 2003, Raymond Bosman
00003  * Copyright (c) 2003, Frederik Holljen
00004  * All Rights Reserved.
00005  *
00006  * See COPYING for licensing.
00007  */
00008 
00009 
00010 #ifndef DATATYPE_HPP
00011 #define DATATYPE_HPP
00012 
00013 #include <string>
00014 
00016 
00022 class CkDataType
00023 {
00024 public:
00026     enum Types{
00027         Undefined = 0, 
00028         PrimVoid,      
00029         PrimBool,      
00030         PrimChar,      
00031         PrimInt,       
00032         Custom = 255   
00033     };
00034 public:
00035     CkDataType();
00036     CkDataType( Types type );
00037     CkDataType( Types type, int dim );
00038     CkDataType( Types type, int dim1, int dim2 );
00039     CkDataType( const CkDataType &other );
00040 
00042     virtual ~CkDataType() {}
00043 
00044     void expandDimension( int dim );
00045     unsigned int getNumDimensions() const;
00047     unsigned int getDim1Size() const { return Dimensions[0]; }
00049     unsigned int getDim2Size() const { return Dimensions[1]; }
00051 
00056     void setDimensions( int dim1, int dim2 = 0 )
00057         { Dimensions[0] = dim1; Dimensions[1] = dim2; }
00059     void setReturnType( Types type ) { Type = type; }
00061     Types getReturnType() const { return Type; }
00062 
00063     static std::string dataTypeToString( Types type );
00064     std::string toString() const;
00065     std::string toJVMString() const;
00066 
00067     // some operator overloading to make usage of this class a bit easier
00068     bool operator==( Types type ) const;
00069     bool operator!=( Types type ) const;
00070     bool operator==( const CkDataType &other ) const;
00071     bool operator!=( const CkDataType &other ) const;
00072 
00073     // convert routines
00074     CkDataType reduceDimensions( unsigned int dimensions ) const;
00075 
00076 private:
00077     void commontInit();
00078 
00079 private:
00080     Types Type;
00081     int Dimensions[2]; // if Dims[0] == 0, no array,
00082 };
00083 
00084 #endif // DATATYPE_HPP

Generated on Mon Dec 1 14:26:27 2003 for Ck by doxygen 1.3.3