ACT Library
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
Type Class Referenceabstract

The abstract base class for all types in the system. More...

#include <basetype.h>

Inheritance diagram for Type:
Bool Chan Int PBool PInt PInts PReal PType UserDef

Public Types

enum  direction {
  NONE = 0 , IN = 1 , OUT = 2 , INOUT = 3 ,
  OUTIN = 4
}
 

Public Member Functions

 Type ()
 
 ~Type ()
 constructor
 
virtual const char * getName ()=0
 destructor
 
virtual TypeExpand (ActNamespace *ns, Scope *s, int nt, inst_param *ip)=0
 
virtual int isEqual (const Type *t) const =0
 

Static Public Member Functions

static void Init ()
 
static const char * dirstring (direction d)
 

Friends

class TypeFactory
 

Detailed Description

The abstract base class for all types in the system.

Any type in the system inherits from this base type. It has a number of common methods that all types are expected to provide. Types tend to never be deleted, since they are only created when needed and then persist until the program no longer needs to use the ACT library.

Common types are cached by the TypeFactory, and types should only be created via the TypeFactory class.

Member Enumeration Documentation

◆ direction

A type can have direction flags. The supported direction flags are either none, "?" (for input), and "!" (for output). Additional flags "?!" (inout) and "!?" (outin) can be used in the port list of user-defined data or channel types.

Enumerator
NONE 

no direction flag

IN 

direction flag is ?

OUT 

direction flag is !

INOUT 

direction flag is ?!

OUTIN 

direction flag is !?

Constructor & Destructor Documentation

◆ Type()

Type::Type ( )
inline

◆ ~Type()

Type::~Type ( )
inline

constructor

Member Function Documentation

◆ dirstring()

static const char * Type::dirstring ( direction  d)
inlinestatic

Used for converting a direction into a string for printing.

Parameters
dis the direction flag
Returns
the string corresponding to the flag

◆ Expand()

virtual Type * Type::Expand ( ActNamespace ns,
Scope s,
int  nt,
inst_param ip 
)
pure virtual

This is used to expand the type, substituting any template parameters. These parameters are used for templated built-in types like int<>, chan(), and ptype().

Parameters
nsis the namespace
sis the evaluation scope
ntare the number of template parameters for this type
ipis the parameter name
Returns
an expanded type

Implemented in PInt, PInts, PBool, PReal, Bool, UserDef, PType, Int, Chan, Interface, Process, Function, Data, and Channel.

◆ getName()

virtual const char * Type::getName ( )
pure virtual

destructor

Returns
a string corresponding to the full type name for the specified type. This should not be free'd.

Implemented in PInt, PInts, PBool, PReal, PType, Bool, Int, Chan, and UserDef.

◆ Init()

static void Type::Init ( )
static

Initialize static members. This also calls the static initialization function for the TypeFactory

◆ isEqual()

virtual int Type::isEqual ( const Type t) const
pure virtual

Check if two types are equal to each other.

Parameters
tis the type to compare against
Returns
the result of comparing two types

Implemented in PInt, PInts, PBool, PReal, PType, Bool, Int, Chan, UserDef, and Data.

Friends And Related Function Documentation

◆ TypeFactory

friend class TypeFactory
friend

The documentation for this class was generated from the following file: