libutap
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
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 (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 (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 (std::string name, symbol_t &symbol)
 Resolves a name in this frame or a parent frame. More...
 
frame_t getParent () throw (NoParentException)
 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.

Constructor & Destructor Documentation

frame_t::frame_t ( void *  p)
protected
frame_t::frame_t ( )

Default constructor.

Referenced by createFrame(), and getParent().

frame_t::frame_t ( const frame_t frame)

Copy constructor.

frame_t::~frame_t ( )

Destructor.

Member Function Documentation

void frame_t::add ( symbol_t  symbol)
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.

References add(), and getSize().

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

Creates and returns a new sub-frame.

References frame_t().

bool UTAP::frame_t::empty ( )
int32_t UTAP::frame_t::getIndexOf ( std::string  name) const

Returns the index of the symbol with the given name.

Referenced by UTAP::SignalFlow::checkParams(), and resolve().

int32_t frame_t::getIndexOf ( symbol_t  symbol) const

Returns the index of a symbol or -1 if not present.

frame_t frame_t::getParent ( )
throw (NoParentException
)

Returns the parent frame.

References frame_t().

Referenced by resolve().

uint32_t frame_t::getSize ( ) const
symbol_t frame_t::getSymbol ( int32_t  n)

Returns the Nth symbol in this frame.

bool frame_t::hasParent ( ) const

Returns true if this frame has a parent.

Referenced by 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.

References add(), and UTAP::symbol().

Referenced by UTAP::StatementBuilder::declFuncBegin().

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

Inequality operator.

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

Assignment operator.

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

Equality operator.

symbol_t frame_t::operator[] ( int32_t  n)

Returns the Nth symbol in this frame.

const symbol_t frame_t::operator[] ( int32_t  n) const

Returns the Nth symbol in this frame.

void frame_t::remove ( symbol_t  s)

removes the given symbol

References add(), and UTAP::symbol().

Referenced by UTAP::TimedAutomataSystem::removeProcess().

bool frame_t::resolve ( 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.

References getIndexOf(), and getParent().

Referenced by UTAP::expression_t::deeperClone().

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

Friends And Related Function Documentation

friend class symbol_t
friend

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