libutap
0.93
Uppaal Timed Automata Parser
|
A reference to a frame. More...
#include <symbols.h>
Public Member Functions | |
frame_t () | |
Default constructor. More... | |
frame_t (const frame_t &) | |
Copy constructor. More... | |
~frame_t () | |
Destructor. More... | |
const frame_t & | operator= (const frame_t &) |
Assignment operator. More... | |
bool | operator== (const frame_t &) const |
Equality operator. More... | |
bool | operator!= (const frame_t &) const |
Inequality operator. More... | |
uint32_t | getSize () const |
Returns the number of symbols in this frame. More... | |
symbol_t | getSymbol (int32_t) |
Returns the Nth symbol in this frame. More... | |
int32_t | getIndexOf (const std::string &name) const |
Returns the index of the symbol with the given name. More... | |
int32_t | getIndexOf (symbol_t) const |
Returns the index of a symbol or -1 if not present. More... | |
symbol_t | operator[] (int32_t) |
Returns the Nth symbol in this frame. More... | |
const symbol_t | operator[] (int32_t) const |
Returns the Nth symbol in this frame. More... | |
symbol_t | addSymbol (const std::string &name, type_t, void *user=NULL) |
Adds a symbol of the given name and type to the frame. More... | |
void | add (symbol_t) |
Add all symbols from the given frame. More... | |
void | add (frame_t) |
Add all symbols from the given frame. More... | |
void | moveTo (frame_t) |
Move all symbols from this to a given one (leaving this empty). More... | |
void | remove (symbol_t s) |
removes the given symbol More... | |
bool | resolve (const std::string &name, symbol_t &symbol) |
Resolves a name in this frame or a parent frame. More... | |
frame_t | getParent () |
Returns the parent frame. More... | |
bool | hasParent () const |
Returns true if this frame has a parent. More... | |
std::string | toString () |
bool | empty () |
Static Public Member Functions | |
static frame_t | createFrame () |
Creates and returns a new root-frame. More... | |
static frame_t | createFrame (const frame_t &parent) |
Creates and returns a new sub-frame. More... | |
Protected Member Functions | |
frame_t (void *) | |
Friends | |
class | symbol_t |
A reference to a frame.
A frame is an ordered collection of symbols (see also symbol_t). Frames can only be accessed via an instance of frame_t. Internally, frames are reference counted and do not need to be deallocated manually.
A frame can either be a root-frame or a sub-frame. Sub-frames have a parent frame; root frames do not. When a symbol name cannot be resolved in the current frame, it is resolved recursively in the parent frame.
Frames are constructed using one of the static factory methods of frame_t.
In order to avoid cyclic references no counted reference to the parent frame is maintained. Hence, the existence of the parent frame must be ensured by other means throughout the lifetime of the sub-frame.
|
protected |
Definition at line 265 of file symbols.cpp.
frame_t::frame_t | ( | ) |
Default constructor.
Definition at line 260 of file symbols.cpp.
frame_t::frame_t | ( | const frame_t & | frame | ) |
Copy constructor.
Definition at line 275 of file symbols.cpp.
frame_t::~frame_t | ( | ) |
Destructor.
Definition at line 285 of file symbols.cpp.
void frame_t::add | ( | symbol_t | symbol | ) |
Add all symbols from the given frame.
Add symbol.
Notice that the symbol will be in two frames at the same time, but the symbol will only "point back" to the first frame it was added to.
Definition at line 367 of file symbols.cpp.
References UTAP::symbol_t::getName().
Referenced by UTAP::TimedAutomataSystem::addDynamicTemplate(), UTAP::TimedAutomataSystem::addInstance(), UTAP::TimedAutomataSystem::addLscInstance(), UTAP::instanceLine_t::addParameters(), UTAP::TimedAutomataSystem::addTemplate(), UTAP::TimedAutomataSystem::copyVariablesFromTo(), UTAP::SystemBuilder::instanceNameBegin(), UTAP::SystemBuilder::instantiationBegin(), and moveTo().
void frame_t::add | ( | frame_t | frame | ) |
Add all symbols from the given frame.
Add all symbols in the given frame.
Notice that the symbols will be in two frames at the same time, but the symbol will only "point back" to the first frame it was added to.
Definition at line 380 of file symbols.cpp.
References getSize().
Adds a symbol of the given name and type to the frame.
Definition at line 352 of file symbols.cpp.
References UTAP::symbol_t::getName(), and UTAP::symbol().
Referenced by UTAP::TimedAutomataSystem::addDynamicTemplate(), UTAP::TimedAutomataSystem::addInstance(), UTAP::TimedAutomataSystem::addLscInstance(), UTAP::TimedAutomataSystem::addProcess(), UTAP::SystemBuilder::addSelectSymbolToFrame(), UTAP::TimedAutomataSystem::addTemplate(), UTAP::TimedAutomataSystem::addVariableToFunction(), UTAP::StatementBuilder::declParameter(), and UTAP::SystemBuilder::instanceName().
|
static |
Creates and returns a new root-frame.
Definition at line 474 of file symbols.cpp.
References hasParent().
Referenced by UTAP::TimedAutomataSystem::addDynamicTemplate(), UTAP::TimedAutomataSystem::addTemplate(), UTAP::StatementBuilder::blockBegin(), UTAP::SystemBuilder::declDynamicTemplate(), UTAP::StatementBuilder::declFuncBegin(), UTAP::ExpressionBuilder::exprExistsDynamicBegin(), UTAP::ExpressionBuilder::exprForAllBegin(), UTAP::ExpressionBuilder::exprForAllDynamicBegin(), UTAP::ExpressionBuilder::exprForeachDynamicBegin(), UTAP::ExpressionBuilder::exprSumDynamicBegin(), UTAP::SystemBuilder::ganttDeclStart(), UTAP::SystemBuilder::ganttEntryStart(), UTAP::SystemBuilder::instanceNameBegin(), UTAP::SystemBuilder::instantiationBegin(), UTAP::StatementBuilder::iterationBegin(), UTAP::SystemBuilder::procBegin(), UTAP::SystemBuilder::procEdgeBegin(), UTAP::StatementBuilder::StatementBuilder(), and UTAP::TimedAutomataSystem::TimedAutomataSystem().
Creates and returns a new sub-frame.
Definition at line 484 of file symbols.cpp.
References hasParent().
bool UTAP::frame_t::empty | ( | ) |
int32_t UTAP::frame_t::getIndexOf | ( | const std::string & | name | ) | const |
Returns the index of the symbol with the given name.
Referenced by UTAP::TimedAutomataSystem::addVariableToFunction(), UTAP::SignalFlow::checkParams(), and remove().
int32_t frame_t::getIndexOf | ( | symbol_t | symbol | ) | const |
Returns the index of a symbol or -1 if not present.
Definition at line 427 of file symbols.cpp.
frame_t frame_t::getParent | ( | ) |
Returns the parent frame.
Definition at line 458 of file symbols.cpp.
uint32_t frame_t::getSize | ( | ) | const |
Returns the number of symbols in this frame.
Definition at line 328 of file symbols.cpp.
Referenced by UTAP::TimedAutomataSystem::accept(), add(), UTAP::TimedAutomataSystem::addDynamicTemplate(), UTAP::TimedAutomataSystem::addInstance(), UTAP::TimedAutomataSystem::addLscInstance(), UTAP::instanceLine_t::addParameters(), UTAP::TimedAutomataSystem::addTemplate(), UTAP::TypeChecker::checkExpression(), UTAP::type_t::createInstance(), UTAP::type_t::createLscInstance(), UTAP::type_t::createProcess(), UTAP::SystemBuilder::declDynamicTemplate(), UTAP::StatementBuilder::declFuncBegin(), UTAP::SystemBuilder::instanceName(), UTAP::SystemBuilder::instantiationEnd(), UTAP::XMLWriter::labels(), operator<<(), UTAP::SystemBuilder::procBegin(), visit(), UTAP::TypeChecker::visitBlockStatement(), UTAP::ExpressionVisitor::visitBlockStatement(), UTAP::TypeChecker::visitEdge(), UTAP::TypeChecker::visitGanttChart(), and UTAP::CompileTimeComputableValues::visitInstance().
symbol_t frame_t::getSymbol | ( | int32_t | n | ) |
Returns the Nth symbol in this frame.
Definition at line 334 of file symbols.cpp.
bool frame_t::hasParent | ( | ) | const |
Returns true if this frame has a parent.
Definition at line 468 of file symbols.cpp.
Referenced by createFrame(), and UTAP::SignalFlow::visitExpression().
void frame_t::moveTo | ( | frame_t | frame | ) |
Move all symbols from this to a given one (leaving this empty).
Move all symbols from this to the given frame.
Notice that the symbols will be updated to point to the given frame, while this frame will be emptied and ready for recycling.
Definition at line 392 of file symbols.cpp.
References add(), and UTAP::symbol().
Referenced by UTAP::StatementBuilder::declFuncBegin().
bool frame_t::operator!= | ( | const frame_t & | frame | ) | const |
Inequality operator.
Definition at line 322 of file symbols.cpp.
Assignment operator.
Definition at line 297 of file symbols.cpp.
bool frame_t::operator== | ( | const frame_t & | frame | ) | const |
Equality operator.
Definition at line 316 of file symbols.cpp.
symbol_t frame_t::operator[] | ( | int32_t | n | ) |
Returns the Nth symbol in this frame.
Definition at line 340 of file symbols.cpp.
const symbol_t frame_t::operator[] | ( | int32_t | n | ) | const |
Returns the Nth symbol in this frame.
Definition at line 346 of file symbols.cpp.
void frame_t::remove | ( | symbol_t | s | ) |
removes the given symbol
Definition at line 405 of file symbols.cpp.
References getIndexOf(), and UTAP::symbol().
Referenced by UTAP::TimedAutomataSystem::removeProcess().
bool frame_t::resolve | ( | const std::string & | name, |
symbol_t & | symbol | ||
) |
Resolves a name in this frame or a parent frame.
Resolves the name in this frame or the parent frame and returns the corresponding symbol.
Definition at line 446 of file symbols.cpp.
Referenced by UTAP::expression_t::deeperClone().
std::string UTAP::frame_t::toString | ( | ) |