libutap  0.93
Uppaal Timed Automata Parser
UTAP::frame_t Class Reference

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_toperator= (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
 

Detailed Description

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.

Definition at line 183 of file symbols.h.

Constructor & Destructor Documentation

◆ frame_t() [1/3]

frame_t::frame_t ( void *  p)
protected

Definition at line 265 of file symbols.cpp.

◆ frame_t() [2/3]

frame_t::frame_t ( )

Default constructor.

Definition at line 260 of file symbols.cpp.

◆ frame_t() [3/3]

frame_t::frame_t ( const frame_t frame)

Copy constructor.

Definition at line 275 of file symbols.cpp.

◆ ~frame_t()

frame_t::~frame_t ( )

Destructor.

Definition at line 285 of file symbols.cpp.

Member Function Documentation

◆ add() [1/2]

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add() [2/2]

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().

Here is the call graph for this function:

◆ addSymbol()

symbol_t frame_t::addSymbol ( const std::string &  name,
type_t  ,
void *  user = NULL 
)

◆ createFrame() [1/2]

◆ createFrame() [2/2]

frame_t frame_t::createFrame ( const frame_t parent)
static

Creates and returns a new sub-frame.

Definition at line 484 of file symbols.cpp.

References hasParent().

Here is the call graph for this function:

◆ empty()

bool UTAP::frame_t::empty ( )

◆ getIndexOf() [1/2]

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().

Here is the caller graph for this function:

◆ getIndexOf() [2/2]

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.

◆ getParent()

frame_t frame_t::getParent ( )

Returns the parent frame.

Definition at line 458 of file symbols.cpp.

◆ getSize()

◆ getSymbol()

symbol_t frame_t::getSymbol ( int32_t  n)

Returns the Nth symbol in this frame.

Definition at line 334 of file symbols.cpp.

◆ hasParent()

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().

Here is the caller graph for this function:

◆ moveTo()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

bool frame_t::operator!= ( const frame_t frame) const

Inequality operator.

Definition at line 322 of file symbols.cpp.

◆ operator=()

const frame_t & frame_t::operator= ( const frame_t frame)

Assignment operator.

Definition at line 297 of file symbols.cpp.

◆ operator==()

bool frame_t::operator== ( const frame_t frame) const

Equality operator.

Definition at line 316 of file symbols.cpp.

◆ operator[]() [1/2]

symbol_t frame_t::operator[] ( int32_t  n)

Returns the Nth symbol in this frame.

Definition at line 340 of file symbols.cpp.

◆ operator[]() [2/2]

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.

◆ remove()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resolve()

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().

Here is the caller graph for this function:

◆ toString()

std::string UTAP::frame_t::toString ( )

Friends And Related Function Documentation

◆ symbol_t

friend class symbol_t
friend

Definition at line 189 of file symbols.h.


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