libutap
0.93
Uppaal Timed Automata Parser
|
A reference to a type. More...
#include <type.h>
Public Member Functions | |
type_t () | |
Default constructor. More... | |
type_t (const type_t &) | |
Copy constructor. More... | |
~type_t () | |
Destructor. More... | |
const type_t & | operator= (const type_t &) |
Assignment operator. More... | |
bool | operator== (const type_t &) const |
Equality operator. More... | |
bool | operator!= (const type_t &) const |
Inequality operator. More... | |
Constants::kind_t | getKind () const |
Returns the kind of type object. More... | |
position_t | getPosition () const |
Returns the position of the type in the input file. More... | |
size_t | size () const |
Returns the number of children. More... | |
bool | operator< (const type_t &) const |
Less-than operator. More... | |
const type_t | operator[] (uint32_t) const |
Returns the i'th child. More... | |
const type_t | get (uint32_t) const |
Returns the i'th child. More... | |
const std::string & | getLabel (uint32_t) const |
Returns the i'th label. More... | |
expression_t | getExpression () const |
Returns the expression associated with the type. More... | |
type_t | getArraySize () const |
Returns the size of an array (this is itself a type). More... | |
type_t | getSub () const |
Returns the element type of an array. More... | |
type_t | getSub (size_t) const |
Returns the 'th field of a record or process. More... | |
size_t | getRecordSize () const |
Returns the number of fields of a record. More... | |
std::string | getRecordLabel (size_t i) const |
Returns the label of the 'th field of a record. More... | |
int32_t | findIndexOf (const std::string &) const |
Returns the index of the record or process field with the given label. More... | |
std::pair< expression_t, expression_t > | getRange () const |
Returns the range of a RANGE type. More... | |
std::string | toString () const |
Generates string representation of the type. More... | |
std::string | toDeclarationString () const |
bool | isRange () const |
Shortcut for is(RANGE). More... | |
bool | isInteger () const |
Shortcut for is(INT). More... | |
bool | isBoolean () const |
Shortcut for is(BOOL). More... | |
bool | isFunction () const |
Shortcut for is(FUNCTION). More... | |
bool | isProcess () const |
Shortcut for is(PROCESS). More... | |
bool | isProcessSet () const |
Shortcut for is(PROCESSSET). More... | |
bool | isLocation () const |
Shortcut for is(LOCATION). More... | |
bool | isInstanceLine () const |
Shortcut for is(INSTANCELINE). More... | |
bool | isBranchpoint () const |
Shortcut for is(BRANCHPOINT). More... | |
bool | isChannel () const |
Shortcut for is(CHANNEL). More... | |
bool | isArray () const |
Shortcut for is(ARRAY). More... | |
bool | isScalar () const |
Shortcut for is(SCALAR). More... | |
bool | isClock () const |
Shortcut for is(CLOCK). More... | |
bool | isRecord () const |
Shortcut for is(RECORD). More... | |
bool | isDiff () const |
Shortcut for is(DIFF). More... | |
bool | isVoid () const |
Shortcut for is(VOID_TYPE). More... | |
bool | isCost () const |
Shortcut for is(COST). More... | |
bool | isDouble () const |
Shortcut for is(DOUBLE). More... | |
bool | isIntegral () const |
Returns true if this is a boolean or integer. More... | |
bool | isInvariant () const |
Returns true if this is an invariant, boolean or integer. More... | |
bool | isGuard () const |
Returns true if this is a guard, invariant, boolean or integer. More... | |
bool | isConstraint () const |
Returns true if this is a constraint, guard, invariant, boolean or integer. More... | |
bool | isFormula () const |
Returns true if this is a formula, constraint, guard, invariant, boolean or integer. More... | |
type_t | strip () const |
Removes any leading prefixes, RANGE, REF and LABEL types and returns the result. More... | |
type_t | stripArray () const |
Removes any leading prefixes, RANGE, REF, LABEL and ARRAY types and returns the result. More... | |
bool | isPrefix () const |
Returns false for non-prefix types and true otherwise. More... | |
bool | isConstant () const |
Returns true if and only if all elements of the type are constant. More... | |
bool | isNonConstant () const |
Returns true if and only if all elements of the type are not constant. More... | |
bool | is (Constants::kind_t kind) const |
Returns true if the type has kind kind or if type is a prefix, RANGE or REF type and the getChild().is(kind) returns true. More... | |
bool | unknown () const |
Returns true if this is null-type or of kind UNKNOWN. More... | |
type_t | rename (const std::string &from, const std::string &to) const |
Replaces any LABEL labeled from occuring in the type with a LABEL to. More... | |
type_t | subst (symbol_t symbol, expression_t expr) const |
Substitutes any occurence of symbol in any expression in the type (expressions that occur as ranges either on array sizes, scalars or integers) with expr. More... | |
type_t | createPrefix (Constants::kind_t kind, position_t=position_t()) const |
Creates a new type by adding a prefix to it. More... | |
type_t | createLabel (const std::string &, position_t=position_t()) const |
Creates a LABEL. More... | |
type_t | createPosition (position_t=position_t()) const |
Static Public Member Functions | |
static type_t | createRange (type_t, expression_t, expression_t, position_t=position_t()) |
static type_t | createPrimitive (Constants::kind_t, position_t=position_t()) |
Create a primitive type. More... | |
static type_t | createArray (type_t sub, type_t size, position_t=position_t()) |
Creates an array type. More... | |
static type_t | createTypeDef (const std::string &, type_t, position_t=position_t()) |
Creates a new type definition. More... | |
static type_t | createProcess (frame_t, position_t=position_t()) |
Creates a new process type. More... | |
static type_t | createProcessSet (type_t instance, position_t=position_t()) |
Creates a new processset type. More... | |
static type_t | createRecord (const std::vector< type_t > &, const std::vector< std::string > &, position_t=position_t()) |
Creates a new record type. More... | |
static type_t | createFunction (type_t, const std::vector< type_t > &, const std::vector< std::string > &, position_t=position_t()) |
Creates a new function type. More... | |
static type_t | createInstance (frame_t, position_t=position_t()) |
Creates a new instance type. More... | |
static type_t | createLscInstance (frame_t, position_t=position_t()) |
Creates a new lsc instance type. More... | |
A reference to a type.
Types are represented as trees of types. The type cannot be access directly. You need to use an instance of type_t to access a type. Internally, types are reference counted and do not need to be deallocated manually. Types are immutable.
Types are either primitive such as clocks or channels, or contructed types such as structs and array. Constructed types are created using one of the factory methods in the type_t class. Primitive types are leaves in the tree, constructed types are inner nodes.
All types have a kind - a type for the type. The kind is a value of kind_t. In anticipation of a future homogeneous AST, this kind is defined in the same enumerable as the kind of expressions.
Some constructed types are considered prefixes for other types: URGENT, COMMITTED, BROADCAST, CONSTANT and BROADCAST.
LABEL types are references to named types. These are introduced by references to types defined with a typedef or by scalar set declarations. They have one child: The type which has been named.
Constructed types are:
|
inline |
|
inline |
Destructor.
Definition at line 112 of file type.h.
References findIndexOf(), getArraySize(), getExpression(), getKind(), getLabel(), getPosition(), getRange(), getRecordLabel(), getRecordSize(), getSub(), operator!=(), operator<(), operator=(), operator==(), operator[](), size(), toDeclarationString(), and toString().
|
static |
Creates an array type.
Definition at line 467 of file type.cpp.
References UTAP::Constants::ARRAY.
Referenced by UTAP::ExpressionBuilder::exprCallEnd(), isDouble(), and UTAP::StatementBuilder::typeArrayOfType().
|
static |
Creates a new function type.
Definition at line 451 of file type.cpp.
References UTAP::Constants::FUNCTION.
Referenced by UTAP::StatementBuilder::declFuncBegin(), and isDouble().
|
static |
Creates a new instance type.
Definition at line 483 of file type.cpp.
References UTAP::frame_t::getSize(), and UTAP::Constants::INSTANCE.
Referenced by UTAP::TimedAutomataSystem::addDynamicTemplate(), UTAP::TimedAutomataSystem::addInstance(), UTAP::TimedAutomataSystem::addTemplate(), and isDouble().
type_t type_t::createLabel | ( | const std::string & | , |
position_t | = position_t() |
||
) | const |
Creates a LABEL.
Definition at line 539 of file type.cpp.
References UTAP::Constants::LABEL.
Referenced by isDouble(), UTAP::ExpressionBuilder::typeName(), and UTAP::ExpressionBuilder::typeScalar().
|
static |
Creates a new lsc instance type.
Definition at line 494 of file type.cpp.
References UTAP::frame_t::getSize(), and UTAP::Constants::LSCINSTANCE.
Referenced by UTAP::TimedAutomataSystem::addLscInstance(), UTAP::TimedAutomataSystem::addTemplate(), and isDouble().
type_t UTAP::type_t::createPosition | ( | position_t | = position_t() | ) | const |
type_t type_t::createPrefix | ( | Constants::kind_t | kind, |
position_t | pos = position_t() |
||
) | const |
Creates a new type by adding a prefix to it.
The prefix could be anything and it is the responsibility of the caller to make sure that the given kind is a valid prefix.
Definition at line 532 of file type.cpp.
Referenced by UTAP::SystemBuilder::addSelectSymbolToFrame(), UTAP::ExpressionBuilder::applyPrefix(), UTAP::StatementBuilder::declParameter(), UTAP::ExpressionBuilder::exprForAllBegin(), isDouble(), UTAP::StatementBuilder::iterationBegin(), UTAP::SystemBuilder::procStateCommit(), and UTAP::SystemBuilder::procStateUrgent().
|
static |
Create a primitive type.
Definition at line 527 of file type.cpp.
Referenced by UTAP::template_t::addBranchpoint(), UTAP::template_t::addLocation(), UTAP::TypeChecker::checkExpression(), UTAP::CompileTimeComputableValues::contains(), UTAP::expression_t::createConstant(), UTAP::expression_t::createDeadlock(), UTAP::expression_t::createDouble(), UTAP::expression_t::createExit(), UTAP::ExpressionBuilder::exprDot(), UTAP::ExpressionBuilder::exprDouble(), UTAP::ExpressionBuilder::exprExistsDynamicBegin(), UTAP::ExpressionBuilder::exprExistsDynamicEnd(), UTAP::ExpressionBuilder::exprFalse(), UTAP::ExpressionBuilder::exprForAllDynamicBegin(), UTAP::ExpressionBuilder::exprForAllDynamicEnd(), UTAP::ExpressionBuilder::exprForeachDynamicBegin(), UTAP::ExpressionBuilder::exprForeachDynamicEnd(), UTAP::ExpressionBuilder::exprNumOf(), UTAP::ExpressionBuilder::exprScenario(), UTAP::ExpressionBuilder::exprSumDynamicBegin(), UTAP::ExpressionBuilder::exprTrue(), UTAP::SystemBuilder::instanceName(), isDouble(), UTAP::TimedAutomataSystem::TimedAutomataSystem(), UTAP::ExpressionBuilder::typeBool(), UTAP::ExpressionBuilder::typeBoundedInt(), UTAP::ExpressionBuilder::typeChannel(), UTAP::ExpressionBuilder::typeClock(), UTAP::ExpressionBuilder::typeDouble(), UTAP::ExpressionBuilder::typeInt(), UTAP::ExpressionBuilder::typeName(), UTAP::ExpressionBuilder::typeScalar(), and UTAP::ExpressionBuilder::typeVoid().
|
static |
Creates a new process type.
Definition at line 505 of file type.cpp.
References UTAP::frame_t::getSize(), and UTAP::Constants::PROCESS.
Referenced by UTAP::TimedAutomataSystem::addProcess(), UTAP::ExpressionBuilder::exprCallEnd(), and isDouble().
|
static |
Creates a new processset type.
Definition at line 516 of file type.cpp.
References getLabel(), UTAP::Constants::PROCESSSET, and size().
Referenced by UTAP::TimedAutomataSystem::addProcess(), and isDouble().
|
static |
Definition at line 425 of file type.cpp.
References UTAP::Constants::RANGE, and UTAP::Constants::UNKNOWN.
Referenced by isDouble(), UTAP::ExpressionBuilder::typeBoundedInt(), UTAP::ExpressionBuilder::typeInt(), and UTAP::ExpressionBuilder::typeScalar().
|
static |
Creates a new record type.
Definition at line 437 of file type.cpp.
References UTAP::Constants::RECORD.
Referenced by UTAP::StatementBuilder::declInitialiserList(), isDouble(), and UTAP::StatementBuilder::typeStruct().
|
static |
Creates a new type definition.
Definition at line 475 of file type.cpp.
References UTAP::Constants::TYPEDEF.
Referenced by UTAP::StatementBuilder::declTypeDef(), and isDouble().
int32_t type_t::findIndexOf | ( | const std::string & | label | ) | const |
Returns the index of the record or process field with the given label.
Returns -1 if such a field does not exist.
Definition at line 105 of file type.cpp.
References getLabel(), and size().
Referenced by UTAP::ExpressionBuilder::exprDot(), UTAP::ExpressionBuilder::exprScenario(), isSameScalarType(), and ~type_t().
const type_t type_t::get | ( | uint32_t | i | ) | const |
Returns the i'th child.
Definition at line 93 of file type.cpp.
Referenced by stripArray().
type_t type_t::getArraySize | ( | ) | const |
Returns the size of an array (this is itself a type).
Definition at line 227 of file type.cpp.
References UTAP::Constants::ARRAY, UTAP::Constants::LABEL, and UTAP::Constants::REF.
Referenced by UTAP::TypeChecker::checkExpression(), initRec(), isSameScalarType(), UTAP::TypeChecker::TypeChecker(), and ~type_t().
expression_t type_t::getExpression | ( | ) | const |
kind_t type_t::getKind | ( | ) | const |
Returns the kind of type object.
Definition at line 120 of file type.cpp.
References UTAP::Constants::UNKNOWN.
Referenced by UTAP::StatementBuilder::collectDependencies(), initRec(), UTAP::SystemBuilder::instanceName(), isAssignable(), isSameScalarType(), UTAP::ExpressionBuilder::isType(), mustInitialise(), UTAP::SystemBuilder::process(), stripArray(), UTAP::TypeChecker::TypeChecker(), UTAP::ExpressionBuilder::typeName(), validReturnType(), visit(), UTAP::SignalFlow::visitExpression(), and ~type_t().
const std::string & type_t::getLabel | ( | uint32_t | i | ) | const |
Returns the i'th label.
Definition at line 99 of file type.cpp.
Referenced by createProcessSet(), UTAP::StatementBuilder::declInitialiserList(), findIndexOf(), isSameScalarType(), and ~type_t().
position_t type_t::getPosition | ( | ) | const |
std::pair< expression_t, expression_t > type_t::getRange | ( | ) | const |
Returns the range of a RANGE type.
Definition at line 266 of file type.cpp.
References UTAP::Constants::RANGE.
Referenced by UTAP::StatementBuilder::collectDependencies(), isSameScalarType(), UTAP::TypeChecker::TypeChecker(), and ~type_t().
string type_t::getRecordLabel | ( | size_t | i | ) | const |
Returns the label of the 'th field of a record.
Definition at line 253 of file type.cpp.
References UTAP::Constants::LABEL, UTAP::Constants::PROCESS, UTAP::Constants::RECORD, and UTAP::Constants::REF.
Referenced by getBuiltinFunName(), isSameScalarType(), and ~type_t().
size_t type_t::getRecordSize | ( | ) | const |
Returns the number of fields of a record.
Definition at line 240 of file type.cpp.
References UTAP::Constants::LABEL, UTAP::Constants::RECORD, and UTAP::Constants::REF.
Referenced by isSameScalarType(), and ~type_t().
type_t type_t::getSub | ( | ) | const |
Returns the element type of an array.
Preserves any prefixes.
Definition at line 193 of file type.cpp.
References UTAP::Constants::LABEL, and UTAP::Constants::REF.
Referenced by UTAP::TypeChecker::checkExpression(), UTAP::ExpressionBuilder::exprArray(), UTAP::ExpressionBuilder::exprCallEnd(), UTAP::ExpressionBuilder::exprDot(), initRec(), isSameScalarType(), UTAP::TypeChecker::TypeChecker(), UTAP::TypeChecker::visitIODecl(), UTAP::TypeChecker::visitSystemAfter(), and ~type_t().
type_t type_t::getSub | ( | size_t | i | ) | const |
Returns the 'th field of a record or process.
Preserves any prefixes.
Definition at line 210 of file type.cpp.
References UTAP::Constants::LABEL, and UTAP::Constants::REF.
bool type_t::is | ( | Constants::kind_t | kind | ) | const |
Returns true if the type has kind kind or if type is a prefix, RANGE or REF type and the getChild().is(kind) returns true.
Definition at line 176 of file type.cpp.
References UTAP::Constants::DOUBLEINVGUARD, UTAP::Constants::LABEL, UTAP::Constants::PROCESSVAR, UTAP::Constants::RANGE, and UTAP::Constants::REF.
Referenced by UTAP::TimedAutomataSystem::accept(), UTAP::SystemBuilder::addSelectSymbolToFrame(), append(), channelCapability(), UTAP::TypeChecker::checkDynamicExpressions(), UTAP::CompileTimeComputableValues::contains(), UTAP::ExpressionBuilder::exprDot(), UTAP::ExpressionBuilder::exprForAllBegin(), isArray(), isBoolean(), isBranchpoint(), isChannel(), isClock(), isCost(), isCost(), isDiff(), isDouble(), isFunction(), isInstanceLine(), isInteger(), isInvariantWR(), isLocation(), isProcess(), isProcessID(), isProcessSet(), isRange(), isRecord(), isSameScalarType(), isScalar(), isVoid(), UTAP::StatementBuilder::iterationBegin(), UTAP::XMLWriter::location(), UTAP::SystemBuilder::procStateCommit(), UTAP::SystemBuilder::procStateUrgent(), UTAP::StatementBuilder::structField(), UTAP::StatementBuilder::typeArrayOfType(), UTAP::TypeChecker::TypeChecker(), visit(), UTAP::TypeChecker::visitEdge(), UTAP::SignalFlow::visitExpression(), UTAP::CompileTimeComputableValues::visitInstance(), UTAP::TypeChecker::visitInstance(), UTAP::TypeChecker::visitIterationStatement(), UTAP::TypeChecker::visitProcess(), and UTAP::TypeChecker::visitProperty().
|
inline |
Shortcut for is(ARRAY).
Definition at line 229 of file type.h.
References UTAP::Constants::ARRAY, and is().
Referenced by UTAP::TypeChecker::checkExpression(), UTAP::ExpressionBuilder::exprArray(), isSameScalarType(), UTAP::TypeChecker::TypeChecker(), UTAP::TypeChecker::visitIODecl(), and UTAP::TypeChecker::visitSystemAfter().
|
inline |
Shortcut for is(BOOL).
Definition at line 205 of file type.h.
References UTAP::Constants::BOOL, and is().
Referenced by isSameScalarType().
|
inline |
Shortcut for is(BRANCHPOINT).
Definition at line 223 of file type.h.
References UTAP::Constants::BRANCHPOINT, and is().
Referenced by UTAP::SystemBuilder::procEdgeBegin().
|
inline |
Shortcut for is(CHANNEL).
Definition at line 226 of file type.h.
References UTAP::Constants::CHANNEL, and is().
Referenced by channelCapability(), isSameScalarType(), UTAP::TypeChecker::TypeChecker(), UTAP::TypeChecker::visitEdge(), UTAP::TypeChecker::visitIODecl(), UTAP::TypeChecker::visitMessage(), and UTAP::TypeChecker::visitSystemAfter().
|
inline |
Shortcut for is(CLOCK).
Definition at line 235 of file type.h.
References UTAP::Constants::CLOCK, and is().
Referenced by initRec(), isClock(), isSameScalarType(), and UTAP::TypeChecker::TypeChecker().
bool type_t::isConstant | ( | ) | const |
Returns true if and only if all elements of the type are constant.
Definition at line 375 of file type.cpp.
References UTAP::Constants::CONSTANT, UTAP::Constants::FUNCTION, UTAP::Constants::INSTANCE, UTAP::Constants::LSCINSTANCE, UTAP::Constants::PROCESS, and UTAP::Constants::RECORD.
Referenced by UTAP::expression_t::collectPossibleWrites(), isDouble(), isSameScalarType(), UTAP::CompileTimeComputableValues::visitInstance(), UTAP::TypeChecker::visitInstance(), and UTAP::CompileTimeComputableValues::visitVariable().
bool type_t::isConstraint | ( | ) | const |
Returns true if this is a constraint, guard, invariant, boolean or integer.
Shortcut for is(CONSTRAINT) || isGuard().
Definition at line 365 of file type.cpp.
References UTAP::Constants::CONSTRAINT, and isGuard().
Referenced by isConstraint(), and isDouble().
|
inline |
Shortcut for is(COST).
Definition at line 247 of file type.h.
References UTAP::Constants::COST, and is().
|
inline |
Shortcut for is(DIFF).
Definition at line 241 of file type.h.
References UTAP::Constants::DIFF, and is().
Referenced by isDiff().
|
inline |
Shortcut for is(DOUBLE).
Definition at line 250 of file type.h.
References createArray(), createFunction(), createInstance(), createLabel(), createLscInstance(), createPosition(), createPrefix(), createPrimitive(), createProcess(), createProcessSet(), createRange(), createRecord(), createTypeDef(), UTAP::Constants::DOUBLE, is(), isConstant(), isConstraint(), isFormula(), isGuard(), isIntegral(), isInvariant(), isNonConstant(), isPrefix(), UTAP::operator<<(), rename(), strip(), stripArray(), subst(), UTAP::symbol(), and unknown().
Referenced by initRec(), isBound(), isDouble(), isSameScalarType(), UTAP::TypeChecker::TypeChecker(), UTAP::CompileTimeComputableValues::visitInstance(), and UTAP::TypeChecker::visitState().
bool type_t::isFormula | ( | ) | const |
Returns true if this is a formula, constraint, guard, invariant, boolean or integer.
Shortcut for is(FORMULA) || isConstraint().
Definition at line 370 of file type.cpp.
References UTAP::Constants::FORMULA, and isConstraint().
Referenced by isDouble(), and isFormula().
|
inline |
Shortcut for is(FUNCTION).
Definition at line 208 of file type.h.
References UTAP::Constants::FUNCTION, and is().
Referenced by UTAP::expression_t::collectPossibleReads(), and UTAP::expression_t::collectPossibleWrites().
bool type_t::isGuard | ( | ) | const |
Returns true if this is a guard, invariant, boolean or integer.
Shortcut for is(GUARD) || isInvariant().
Definition at line 353 of file type.cpp.
References UTAP::Constants::GUARD, isInteger(), isInvariant(), and UTAP::Constants::PROBABILITY.
Referenced by isDouble(), and isGuard().
|
inline |
Shortcut for is(INSTANCELINE).
Definition at line 220 of file type.h.
References UTAP::Constants::INSTANCELINE, and is().
Referenced by UTAP::SystemBuilder::procLscUpdate(), and UTAP::SystemBuilder::procMessage().
|
inline |
Shortcut for is(INT).
Definition at line 202 of file type.h.
References UTAP::Constants::INT, and is().
Referenced by UTAP::SystemBuilder::addSelectSymbolToFrame(), UTAP::TypeChecker::checkExpression(), UTAP::ExpressionBuilder::exprForAllBegin(), isBound(), isInteger(), isSameScalarType(), UTAP::StatementBuilder::typeArrayOfType(), UTAP::TypeChecker::TypeChecker(), and UTAP::TypeChecker::visitIterationStatement().
bool type_t::isIntegral | ( | ) | const |
Returns true if this is a boolean or integer.
Shortcut for isInt() || isBoolean().
Definition at line 343 of file type.cpp.
References UTAP::Constants::BOOL, UTAP::Constants::INT, and UTAP::Constants::PROCESSVAR.
Referenced by UTAP::TypeChecker::checkExpression(), initRec(), isDouble(), isIntegral(), isSameScalarType(), UTAP::StatementBuilder::structField(), and UTAP::TypeChecker::TypeChecker().
bool type_t::isInvariant | ( | ) | const |
Returns true if this is an invariant, boolean or integer.
Shortcut for isIntegral() || is(INVARIANT).
Definition at line 348 of file type.cpp.
References UTAP::Constants::INVARIANT, and isIntegral().
Referenced by isDouble(), and isInvariant().
|
inline |
Shortcut for is(LOCATION).
Definition at line 217 of file type.h.
References is(), and UTAP::Constants::LOCATION.
Referenced by UTAP::template_t::addEdge(), UTAP::ExpressionBuilder::exprDot(), UTAP::SystemBuilder::procEdgeBegin(), UTAP::SystemBuilder::procStateCommit(), UTAP::SystemBuilder::procStateInit(), UTAP::SystemBuilder::procStateUrgent(), and UTAP::TypeChecker::TypeChecker().
bool type_t::isNonConstant | ( | ) | const |
Returns true if and only if all elements of the type are not constant.
Definition at line 400 of file type.cpp.
References UTAP::Constants::CONSTANT, UTAP::Constants::FUNCTION, UTAP::Constants::INSTANCE, UTAP::Constants::LSCINSTANCE, UTAP::Constants::PROCESS, and UTAP::Constants::RECORD.
Referenced by UTAP::TypeChecker::checkExpression(), and isDouble().
bool type_t::isPrefix | ( | ) | const |
Returns false for non-prefix types and true otherwise.
Non-prefix types are PRIMITIVE, ARRAY, RECORD, PROCESS, TEMPLATE, FUNCTION, INSTANCE, LSCINSTANCE, RANGE, REF, TYPEDEF.
Definition at line 125 of file type.cpp.
References UTAP::Constants::ARRAY, UTAP::Constants::BOOL, UTAP::Constants::BRANCHPOINT, UTAP::Constants::CHANNEL, UTAP::Constants::CLOCK, UTAP::Constants::CONDITION, UTAP::Constants::CONSTRAINT, UTAP::Constants::COST, UTAP::Constants::DIFF, UTAP::Constants::DOUBLE, UTAP::Constants::FORMULA, UTAP::Constants::FRACTION, UTAP::Constants::FUNCTION, UTAP::Constants::GUARD, UTAP::Constants::INSTANCE, UTAP::Constants::INSTANCELINE, UTAP::Constants::INT, UTAP::Constants::INVARIANT, UTAP::Constants::INVARIANT_WR, UTAP::Constants::LABEL, UTAP::Constants::LOCATION, UTAP::Constants::LSCINSTANCE, UTAP::Constants::MESSAGE, UTAP::Constants::PROCESS, UTAP::Constants::PROCESSSET, UTAP::Constants::RANGE, UTAP::Constants::RATE, UTAP::Constants::RECORD, UTAP::Constants::REF, UTAP::Constants::SCALAR, UTAP::Constants::TIOGRAPH, UTAP::Constants::TYPEDEF, UTAP::Constants::UNKNOWN, UTAP::Constants::UPDATE, and UTAP::Constants::VOID_TYPE.
Referenced by isDouble().
|
inline |
Shortcut for is(PROCESS).
Definition at line 211 of file type.h.
References is(), and UTAP::Constants::PROCESS.
Referenced by UTAP::ExpressionBuilder::exprDot(), and getBuiltinFunName().
|
inline |
Shortcut for is(PROCESSSET).
Definition at line 214 of file type.h.
References is(), and UTAP::Constants::PROCESSSET.
|
inline |
Shortcut for is(RANGE).
Definition at line 199 of file type.h.
References is(), and UTAP::Constants::RANGE.
Referenced by UTAP::TypeChecker::visitProcess().
|
inline |
Shortcut for is(RECORD).
Definition at line 238 of file type.h.
References is(), and UTAP::Constants::RECORD.
Referenced by UTAP::ExpressionBuilder::exprDot(), getBuiltinFunName(), isSameScalarType(), UTAP::StatementBuilder::structField(), and UTAP::TypeChecker::TypeChecker().
|
inline |
Shortcut for is(SCALAR).
Definition at line 232 of file type.h.
References is(), and UTAP::Constants::SCALAR.
Referenced by UTAP::SystemBuilder::addSelectSymbolToFrame(), UTAP::TypeChecker::checkExpression(), UTAP::ExpressionBuilder::exprForAllBegin(), initRec(), isSameScalarType(), UTAP::StatementBuilder::structField(), UTAP::StatementBuilder::typeArrayOfType(), UTAP::TypeChecker::TypeChecker(), UTAP::TypeChecker::visitIterationStatement(), and UTAP::TypeChecker::visitProcess().
|
inline |
Shortcut for is(VOID_TYPE).
Definition at line 244 of file type.h.
References is(), and UTAP::Constants::VOID_TYPE.
Referenced by UTAP::StatementBuilder::declFuncEnd(), isVoid(), UTAP::StatementBuilder::returnStatement(), and UTAP::TypeChecker::visitFunction().
bool type_t::operator!= | ( | const type_t & | type | ) | const |
bool type_t::operator< | ( | const type_t & | type | ) | const |
bool type_t::operator== | ( | const type_t & | type | ) | const |
const type_t type_t::operator[] | ( | uint32_t | i | ) | const |
type_t type_t::rename | ( | const std::string & | from, |
const std::string & | to | ||
) | const |
Replaces any LABEL labeled from occuring in the type with a LABEL to.
As always, a type is immutable, so a copy of the type will be created.
Definition at line 307 of file type.cpp.
References UTAP::Constants::LABEL.
Referenced by UTAP::ExpressionBuilder::exprDot(), and isDouble().
size_t type_t::size | ( | ) | const |
Returns the number of children.
Definition at line 81 of file type.cpp.
Referenced by UTAP::TypeChecker::checkExpression(), UTAP::StatementBuilder::collectDependencies(), UTAP::expression_t::collectPossibleWrites(), createProcessSet(), findIndexOf(), initRec(), isAssignable(), isSameScalarType(), mustInitialise(), UTAP::SystemBuilder::process(), UTAP::TypeChecker::TypeChecker(), validReturnType(), UTAP::TypeChecker::visitFunction(), UTAP::TypeChecker::visitInstance(), and ~type_t().
type_t type_t::strip | ( | ) | const |
Removes any leading prefixes, RANGE, REF and LABEL types and returns the result.
Definition at line 285 of file type.cpp.
References UTAP::Constants::LABEL, UTAP::Constants::RANGE, and UTAP::Constants::REF.
Referenced by initRec(), isDouble(), and stripArray().
type_t type_t::stripArray | ( | ) | const |
Removes any leading prefixes, RANGE, REF, LABEL and ARRAY types and returns the result.
Definition at line 297 of file type.cpp.
References UTAP::Constants::ARRAY, get(), getKind(), and strip().
Referenced by UTAP::TimedAutomataSystem::accept(), isDouble(), UTAP::StatementBuilder::structField(), UTAP::TypeChecker::TypeChecker(), and visit().
type_t type_t::subst | ( | symbol_t | symbol, |
expression_t | expr | ||
) | const |
Substitutes any occurence of symbol in any expression in the type (expressions that occur as ranges either on array sizes, scalars or integers) with expr.
Definition at line 323 of file type.cpp.
Referenced by UTAP::ExpressionBuilder::exprDot(), and isDouble().
string type_t::toDeclarationString | ( | ) | const |
Definition at line 734 of file type.cpp.
References UTAP::Constants::ARRAY, UTAP::Constants::BOOL, UTAP::Constants::BROADCAST, UTAP::Constants::CHANNEL, UTAP::Constants::CLOCK, UTAP::Constants::COMMITTED, UTAP::Constants::CONSTANT, UTAP::Constants::CONSTRAINT, UTAP::Constants::COST, UTAP::Constants::DIFF, UTAP::Constants::DOUBLE, UTAP::Constants::FORMULA, UTAP::Constants::FUNCTION, UTAP::Constants::GUARD, UTAP::Constants::INSTANCE, UTAP::Constants::INT, UTAP::Constants::INVARIANT, UTAP::Constants::LABEL, UTAP::Constants::PROCESS, UTAP::Constants::RANGE, UTAP::Constants::RATE, UTAP::Constants::RECORD, UTAP::Constants::REF, UTAP::Constants::SCALAR, UTAP::Constants::TYPEDEF, UTAP::Constants::UNKNOWN, UTAP::Constants::URGENT, and UTAP::Constants::VOID_TYPE.
Referenced by ~type_t().
string type_t::toString | ( | ) | const |
Generates string representation of the type.
Definition at line 547 of file type.cpp.
References UTAP::Constants::ARRAY, UTAP::Constants::BOOL, UTAP::Constants::BRANCHPOINT, UTAP::Constants::BROADCAST, UTAP::Constants::CHANNEL, UTAP::Constants::CLOCK, UTAP::Constants::COMMITTED, UTAP::Constants::CONDITION, UTAP::Constants::CONSTANT, UTAP::Constants::CONSTRAINT, UTAP::Constants::COST, UTAP::Constants::DIFF, UTAP::Constants::DOUBLE, UTAP::Constants::FORMULA, UTAP::Constants::FRACTION, UTAP::Constants::FUNCTION, UTAP::Constants::GUARD, UTAP::Constants::INSTANCE, UTAP::Constants::INSTANCELINE, UTAP::Constants::INT, UTAP::Constants::INVARIANT, UTAP::Constants::LABEL, UTAP::Constants::LOCATION, UTAP::Constants::LSCINSTANCE, UTAP::Constants::MESSAGE, UTAP::Constants::PROCESS, UTAP::Constants::PROCESSVAR, UTAP::Constants::RANGE, UTAP::Constants::RATE, UTAP::Constants::RECORD, UTAP::Constants::REF, UTAP::Constants::SCALAR, UTAP::Constants::TIOGRAPH, UTAP::Constants::TYPEDEF, UTAP::Constants::UNKNOWN, UTAP::Constants::UPDATE, UTAP::Constants::URGENT, and UTAP::Constants::VOID_TYPE.
Referenced by operator<<(), UTAP::TypeChecker::visitCondition(), UTAP::TypeChecker::visitEdge(), UTAP::TypeChecker::visitState(), and ~type_t().
bool type_t::unknown | ( | ) | const |
Returns true if this is null-type or of kind UNKNOWN.
Definition at line 171 of file type.cpp.
References UTAP::Constants::UNKNOWN.
Referenced by UTAP::TypeChecker::checkExpression(), and isDouble().