Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

UTAP::type_t Class Reference

A reference to a type. More...

#include <symbols.hh>

List of all members.

Public Member Functions

 type_t ()
 Default constructor.

 type_t (const type_t &)
 Copy constructor.

 ~type_t ()
 Destructor.

const type_toperator= (const type_t &)
 Assignment operator.

bool operator== (const type_t &) const
 Equality operator.

bool operator!= (const type_t &) const
 Inequality operator.

type_t getBase () const
 Returns the base type of this frame.

frame_t getRecordFields () const
 Returns the fields of a record type.

frame_t getParameters () const
 Returns the parameters of a function or template type.

frame_t getFrame () const
 Polymorphic version of getRecordFields() and getParameters().

type_t getSub ()
 Returns the sub-type of this type.

bool hasPrefix (prefix::prefix_t) const
 Returns the true if this type has the given prefix.

type_t setPrefix (bool set, prefix::prefix_t) const
 Sets or clears a prefix.

expression_t getArraySize () const
 Returns the size of an array.

std::pair< expression_t, expression_tgetRange () const
 Returns the range of an integer type.


Static Public Member Functions

type_t createInteger (expression_t, expression_t)
 Creates and returns a new integer type with the given range.

type_t createRecord (frame_t)
 Creates and returns a new record type.

type_t createFunction (frame_t, type_t)
 Creates and returns a new function type.

type_t createArray (expression_t, type_t)
 Creates and returns a new array type.

type_t createTypeName (type_t)
 Creates and returns a new named type.

type_t createTemplate (frame_t)
 Creates and returns a new template type.

type_t createProcess (frame_t)
 Creates and returns a new process type.

type_t createBase ()
 Create a new primitive type.


Static Public Attributes

type_t UNKNOWN = type_t::createBase()
type_t VOID_TYPE = type_t::createBase()
type_t CLOCK = type_t::createBase()
type_t INT = type_t::createBase()
type_t LOCATION = type_t::createBase()
type_t CHANNEL = type_t::createBase()
type_t TEMPLATE = type_t::createBase()
type_t INSTANCE = type_t::createBase()
type_t FUNCTION = type_t::createBase()
type_t ARRAY = type_t::createBase()
type_t RECORD = type_t::createBase()
type_t PROCESS = type_t::createBase()
type_t NTYPE = type_t::createBase()
type_t INVARIANT = type_t::createBase()
type_t GUARD = type_t::createBase()
type_t DIFF = type_t::createBase()
type_t CONSTRAINT = type_t::createBase()


Detailed Description

A reference to a type.

Types are represented as type objects. Type objects cannot be access directly. You need to use an instance of type_t to access a type object. Internally, type objects are reference counted and do not need to be deallocated manually.

Types are either primitive such as clocks or channels, or contructed types such as structs and array. Primitive types are allocated statically and can be accessed via the static member fields of the type_t class. Constructed types are created using one of the static factory methods in the type_t class.

All types have a base type. For primitive types, the base type is the type itself. For constructed types, the base type indicates the type constructor (i.e. if this is an array, record, etc.). In addition, all types can have a number of prefixes, such as URGENT, COMMITTED, CONSTANT, BROADCAST, and REFERENCE.

Constructed types can have other fields: Integers have a range, arrays have a size and a sub-type, records have fields, functions have parameters and a return type (the sub-type), templates have parameters, and named types have a sub-type.


Constructor & Destructor Documentation

type_t::type_t  ) 
 

Default constructor.

This creates the equivalent of a NULL pointer.

type_t::type_t const type_t  ) 
 

Copy constructor.

type_t::~type_t  ) 
 

Destructor.


Member Function Documentation

type_t type_t::createArray expression_t  ,
type_t 
[static]
 

Creates and returns a new array type.

type_t type_t::createBase  )  [static]
 

Create a new primitive type.

type_t type_t::createFunction frame_t  ,
type_t 
[static]
 

Creates and returns a new function type.

type_t type_t::createInteger expression_t  ,
expression_t 
[static]
 

Creates and returns a new integer type with the given range.

type_t type_t::createProcess frame_t   )  [static]
 

Creates and returns a new process type.

type_t type_t::createRecord frame_t   )  [static]
 

Creates and returns a new record type.

type_t type_t::createTemplate frame_t   )  [static]
 

Creates and returns a new template type.

type_t type_t::createTypeName type_t   )  [static]
 

Creates and returns a new named type.

expression_t type_t::getArraySize  )  const
 

Returns the size of an array.

type_t type_t::getBase  )  const
 

Returns the base type of this frame.

frame_t type_t::getFrame  )  const
 

Polymorphic version of getRecordFields() and getParameters().

The frame returned must not be modified (since type objects are supposed to be immutable).

frame_t type_t::getParameters  )  const
 

Returns the parameters of a function or template type.

See also getFrame().

pair< expression_t, expression_t > type_t::getRange  )  const
 

Returns the range of an integer type.

frame_t type_t::getRecordFields  )  const
 

Returns the fields of a record type.

See also getFrame().

type_t type_t::getSub  ) 
 

Returns the sub-type of this type.

For functions, this is the return value. For arrays, this is type type of the array elements.

bool type_t::hasPrefix prefix::prefix_t   )  const
 

Returns the true if this type has the given prefix.

bool type_t::operator!= const type_t  )  const
 

Inequality operator.

const type_t & type_t::operator= const type_t  ) 
 

Assignment operator.

bool type_t::operator== const type_t  )  const
 

Equality operator.

type_t type_t::setPrefix bool  set,
prefix::prefix_t  prefix
const
 

Sets or clears a prefix.

The type itself is not altered, but a new type corresponding to the change is returned.


Member Data Documentation

type_t type_t::ARRAY = type_t::createBase() [static]
 

type_t type_t::CHANNEL = type_t::createBase() [static]
 

type_t type_t::CLOCK = type_t::createBase() [static]
 

type_t type_t::CONSTRAINT = type_t::createBase() [static]
 

type_t type_t::DIFF = type_t::createBase() [static]
 

type_t type_t::FUNCTION = type_t::createBase() [static]
 

type_t type_t::GUARD = type_t::createBase() [static]
 

type_t type_t::INSTANCE = type_t::createBase() [static]
 

type_t type_t::INT = type_t::createBase() [static]
 

type_t type_t::INVARIANT = type_t::createBase() [static]
 

type_t type_t::LOCATION = type_t::createBase() [static]
 

type_t type_t::NTYPE = type_t::createBase() [static]
 

type_t type_t::PROCESS = type_t::createBase() [static]
 

type_t type_t::RECORD = type_t::createBase() [static]
 

type_t type_t::TEMPLATE = type_t::createBase() [static]
 

type_t type_t::UNKNOWN = type_t::createBase() [static]
 

type_t type_t::VOID_TYPE = type_t::createBase() [static]
 


The documentation for this class was generated from the following files:
Generated on Wed Jul 2 12:08:20 2003 for libutap by doxygen 1.3.2