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

UTAP::expression_t Class Reference

A reference to an expression. More...

#include <expression.h>

List of all members.

Public Member Functions

 expression_t ()
 Default constructor.
 expression_t (const expression_t &)
 Copy constructor.
 ~expression_t ()
 Destructor.
expression_t clone () const
 Make a shallow clone of the expression.
Constants::kind_t getKind () const
 Returns the kind of the expression.
uint32_t getSize () const
 Returns the number of subexpression.
const position_tgetPosition () const
 Returns the position of this expression.
type_t getType () const
 Returns the type of the expression.
void setType (type_t)
 Sets the type of the expression.
int32_t getValue () const
 Returns the value field of this expression.
int32_t getIndex () const
 Returns the index field of this expression.
bool empty () const
 Returns true if this is an empty expression.
Constants::synchronisation_t getSync () const
 Returns the synchronisation type of SYNC operations.
std::string toString (bool old=false) const
 Returns a string representation of the expression.
expression_toperator[] (uint32_t)
 Returns the ith subexpression.
const expression_t operator[] (uint32_t) const
 Returns the ith subexpression.
expression_tget (uint32_t)
 Returns the ith subexpression.
const expression_tget (uint32_t) const
 Returns the ith subexpression.
expression_toperator= (const expression_t &)
 Assignment operator.
bool equal (const expression_t &) const
 Equality operator.
symbol_t getSymbol ()
 Returns the symbol this expression evaluates to.
const symbol_t getSymbol () const
 Returns the symbol this expression evaluates to.
bool isReferenceTo (const std::set< symbol_t > &) const
 Returns true if this expression is a reference to a symbol in the given set.
bool changesVariable (const std::set< symbol_t > &) const
 True if this expression can change any of the variables identified by the given symbols.
bool dependsOn (const std::set< symbol_t > &) const
 True if the evaluation of this expression depends on any of the symbols in the given set.
void collectPossibleWrites (std::set< symbol_t > &) const
void collectPossibleReads (std::set< symbol_t > &) const
bool operator< (const expression_t) const
 Less-than operator.
bool operator== (const expression_t) const
 Equallity operator.

Static Public Member Functions

static int getPrecedence (Constants::kind_t)
static expression_t createConstant (const position_t &, int32_t)
 Create a CONSTANT expression.
static expression_t createIdentifier (const position_t &, symbol_t)
 Create an IDENTIFIER expression.
static expression_t createUnary (const position_t &, Constants::kind_t, expression_t, type_t=type_t::UNKNOWN)
 Create a unary expression.
static expression_t createBinary (const position_t &, Constants::kind_t, expression_t, expression_t, type_t=type_t::UNKNOWN)
 Create a binary expression.
static expression_t createTernary (const position_t &, Constants::kind_t, expression_t, expression_t, expression_t, type_t=type_t::UNKNOWN)
 Create a ternary expression.
static expression_t createNary (const position_t &, Constants::kind_t, const std::vector< expression_t > &, type_t=type_t::UNKNOWN)
 Create an n-ary expression.
static expression_t createDot (const position_t &, expression_t, int32_t=-1, type_t=type_t::UNKNOWN)
 Create a DOT expression.
static expression_t createSync (const position_t &, expression_t, Constants::synchronisation_t)
 Create a SYNC expression.
static expression_t createDeadlock (const position_t &)
 Create a DEADLOCK expression.


Detailed Description

A reference to an expression.

An expression is a tree of operations and is identified by the root of the tree. There are many kinds of operations (see kind_t), some are leafs in the tree (identifers, constants), some are unary operations (unary minus, negation), some are binary (plus, minus, etc.), and some are n-ary (lists, function calls).

Expressions can be annotated with types. The type of an expression should never contain information about whether the expression is a variable reference, a constant value or about the range of the result value. Use the TypeChecker and RangeChecker classes to determine these informations.

All nodes have the following attributes:

kind indicates the kind of operation position indicates the position of the expression in the input file. type the type of the result of evaluating the expression size the number of subexpressions sub the subexpressions

Some nodes have extra attributes (depending on the kind):

value the value of a CONSTANT node sync the synchronisation of a SYNC node index the index of a DOT node symbol the symbol of an IDENTIFIER node

Expressions are created by using the static factory methods.


Constructor & Destructor Documentation

UTAP::expression_t::expression_t  ) 
 

Default constructor.

Creates an empty expression.

UTAP::expression_t::expression_t const expression_t  ) 
 

Copy constructor.

UTAP::expression_t::~expression_t  ) 
 

Destructor.


Member Function Documentation

bool UTAP::expression_t::changesVariable const std::set< symbol_t > &   )  const
 

True if this expression can change any of the variables identified by the given symbols.

expression_t UTAP::expression_t::clone  )  const
 

Make a shallow clone of the expression.

void UTAP::expression_t::collectPossibleReads std::set< symbol_t > &   )  const
 

void UTAP::expression_t::collectPossibleWrites std::set< symbol_t > &   )  const
 

static expression_t UTAP::expression_t::createBinary const position_t ,
Constants::kind_t  ,
expression_t  ,
expression_t  ,
type_t  = type_t::UNKNOWN
[static]
 

Create a binary expression.

static expression_t UTAP::expression_t::createConstant const position_t ,
int32_t 
[static]
 

Create a CONSTANT expression.

static expression_t UTAP::expression_t::createDeadlock const position_t  )  [static]
 

Create a DEADLOCK expression.

static expression_t UTAP::expression_t::createDot const position_t ,
expression_t  ,
int32_t  = -1,
type_t  = type_t::UNKNOWN
[static]
 

Create a DOT expression.

static expression_t UTAP::expression_t::createIdentifier const position_t ,
symbol_t 
[static]
 

Create an IDENTIFIER expression.

static expression_t UTAP::expression_t::createNary const position_t ,
Constants::kind_t  ,
const std::vector< expression_t > &  ,
type_t  = type_t::UNKNOWN
[static]
 

Create an n-ary expression.

static expression_t UTAP::expression_t::createSync const position_t ,
expression_t  ,
Constants::synchronisation_t 
[static]
 

Create a SYNC expression.

static expression_t UTAP::expression_t::createTernary const position_t ,
Constants::kind_t  ,
expression_t  ,
expression_t  ,
expression_t  ,
type_t  = type_t::UNKNOWN
[static]
 

Create a ternary expression.

static expression_t UTAP::expression_t::createUnary const position_t ,
Constants::kind_t  ,
expression_t  ,
type_t  = type_t::UNKNOWN
[static]
 

Create a unary expression.

bool UTAP::expression_t::dependsOn const std::set< symbol_t > &   )  const
 

True if the evaluation of this expression depends on any of the symbols in the given set.

bool UTAP::expression_t::empty  )  const
 

Returns true if this is an empty expression.

bool UTAP::expression_t::equal const expression_t  )  const
 

Equality operator.

const expression_t& UTAP::expression_t::get uint32_t   )  const
 

Returns the ith subexpression.

expression_t& UTAP::expression_t::get uint32_t   ) 
 

Returns the ith subexpression.

int32_t UTAP::expression_t::getIndex  )  const
 

Returns the index field of this expression.

Constants::kind_t UTAP::expression_t::getKind  )  const
 

Returns the kind of the expression.

const position_t& UTAP::expression_t::getPosition  )  const
 

Returns the position of this expression.

static int UTAP::expression_t::getPrecedence Constants::kind_t   )  [static]
 

uint32_t UTAP::expression_t::getSize  )  const
 

Returns the number of subexpression.

const symbol_t UTAP::expression_t::getSymbol  )  const
 

Returns the symbol this expression evaluates to.

Notice that not all expression evaluate to a symbol.

symbol_t UTAP::expression_t::getSymbol  ) 
 

Returns the symbol this expression evaluates to.

Notice that not all expression evaluate to a symbol.

Constants::synchronisation_t UTAP::expression_t::getSync  )  const
 

Returns the synchronisation type of SYNC operations.

type_t UTAP::expression_t::getType  )  const
 

Returns the type of the expression.

int32_t UTAP::expression_t::getValue  )  const
 

Returns the value field of this expression.

This call is not valid for all expressions.

bool UTAP::expression_t::isReferenceTo const std::set< symbol_t > &   )  const
 

Returns true if this expression is a reference to a symbol in the given set.

bool UTAP::expression_t::operator< const   expression_t  )  const
 

Less-than operator.

Makes it possible to put expression_t objects into an STL set.

expression_t& UTAP::expression_t::operator= const expression_t  ) 
 

Assignment operator.

bool UTAP::expression_t::operator== const   expression_t  )  const
 

Equallity operator.

Returns true if the two references point to the same expression object.

const expression_t UTAP::expression_t::operator[] uint32_t   )  const
 

Returns the ith subexpression.

expression_t& UTAP::expression_t::operator[] uint32_t   ) 
 

Returns the ith subexpression.

void UTAP::expression_t::setType type_t   ) 
 

Sets the type of the expression.

std::string UTAP::expression_t::toString bool  old = false  )  const
 

Returns a string representation of the expression.


The documentation for this class was generated from the following file:
Generated on Thu Nov 10 13:16:12 2005 for libutap by  doxygen 1.4.2