#include <datatype.hpp>
Public Types | |
enum | Types { Undefined = 0, PrimVoid, PrimBool, PrimChar, PrimInt, Custom = 255 } |
Enum representing all the data types for the Ck language. More... | |
Public Member Functions | |
CkDataType () | |
Default constructor. | |
CkDataType (Types type) | |
type constructor | |
CkDataType (Types type, int dim) | |
Single dimension array constructor. | |
CkDataType (Types type, int dim1, int dim2) | |
double dimension array constructor | |
CkDataType (const CkDataType &other) | |
Copy constructor. | |
virtual | ~CkDataType () |
destructor | |
void | expandDimension (int dim) |
Expand type with one dimension. | |
unsigned int | getNumDimensions () const |
Get the number of dimensions for this variable. 0 means that it is not an array. | |
unsigned int | getDim1Size () const |
Returns size of the first dimension. | |
unsigned int | getDim2Size () const |
Returns size of the second dimension. | |
void | setDimensions (int dim1, int dim2=0) |
Set the dimensions of this datatype. | |
void | setReturnType (Types type) |
Set the basic type of this type. | |
Types | getReturnType () const |
Returns the basic type of this type. | |
std::string | toString () const |
Convert this datatype to a string representation. | |
std::string | toJVMString () const |
Converts this datatype to a JVM identification string. | |
bool | operator== (Types type) const |
Compare datatype to basic datatype. | |
bool | operator!= (Types type) const |
Compare datatype to basic datatype. | |
bool | operator== (const CkDataType &other) const |
Compare two datatypes. | |
bool | operator!= (const CkDataType &other) const |
Compare two datatypes. | |
CkDataType | reduceDimensions (unsigned int dimensions) const |
Return this datatype converted around the given dimensions. | |
Static Public Member Functions | |
std::string | dataTypeToString (Types type) |
Convert DataTypes to string information. | |
Private Member Functions | |
void | commontInit () |
Initializes all variables of this class. Common for all constructors. | |
Private Attributes | |
Types | Type |
int | Dimensions [2] |
All data types have a basic type which is one of the primitives void, boolean, character or integer. Uninitialized datatypes start out with the type Undefined. In addition datatypes can have one or two vectors which mean that they are arrays. This class can be extended later to support custom datatypes like structs and classes.
Definition at line 22 of file datatype.hpp.
|
Enum representing all the data types for the Ck language.
Definition at line 26 of file datatype.hpp. Referenced by getReturnType(). |
|
Convert DataTypes to string information.
Definition at line 104 of file datatype.cpp. References Custom, PrimBool, PrimChar, PrimInt, PrimVoid, and Undefined. Referenced by toString(). |
|
Expand type with one dimension. The new dimension is added in front.
Definition at line 81 of file datatype.cpp. |
|
Return this datatype converted around the given dimensions. e.g this datatype is int[2][5]; converting 1 dimensions returns a datatype that is int[5] converting 2 dimensions return a datatype that is int Definition at line 223 of file datatype.cpp. References getNumDimensions(), and setDimensions(). |
|
Set the dimensions of this datatype. The default is the 0,0 dimension which means that this type is not an array type.
Definition at line 56 of file datatype.hpp. Referenced by reduceDimensions(). |
|
Converts this datatype to a JVM identification string.
Definition at line 145 of file datatype.cpp. |
|
Convert this datatype to a string representation. This function converts the datatype to a literal representation: e.g An non array integer type is represented as "int". A multidimensional integer array with dimensions 2 and 4 is represted as "int[2][4]" Definition at line 125 of file datatype.cpp. References dataTypeToString(). |