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

UTAP::frame_t Class Reference

A reference to a frame. More...

#include <symbols.hh>

List of all members.

Public Member Functions

 frame_t ()
 Default constructor.

 frame_t (const frame_t &)
 Copy constructor.

 ~frame_t ()
 Destructor.

const frame_toperator= (const frame_t &)
 Assignment operator.

bool operator== (const frame_t &) const
 Equality operator.

bool operator!= (const frame_t &) const
 Inequality operator.

uint32_t getSize () const
 Returns the number of symbols in this frame.

symbol_t getSymbol (int32_t)
 Returns the Nth symbol in this frame.

int32_t getIndexOf (const char *name)
 Returns the index of the symbol with the give name.

symbol_t operator[] (int32_t)
 Returns the Nth symbol in this frame.

const symbol_t operator[] (int32_t) const
 Returns the Nth symbol in this frame.

symbol_t addSymbol (const char *, type_t, void *user=NULL)
 Adds a symbol of the given name and type to the frame.

void add (frame_t)
 Add all symbols from the given frame.

bool resolve (const char *name, symbol_t &symbol)
 Resolves a name in this frame or a parent frame.

frame_t getParent () throw (NoParentException)
 Returns the parent frame.

bool hasParent () const
 Returns true if this frame has a parent.


Static Public Member Functions

frame_t createFrame ()
 Creates and returns a new root-frame.

frame_t createFrame (const frame_t &parent)
 Creates and returns a new sub-frame.


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 through out the lifetime of the sub-frame.


Constructor & Destructor Documentation

frame_t::frame_t void *   )  [protected]
 

frame_t::frame_t  ) 
 

Default constructor.

frame_t::frame_t const frame_t  ) 
 

Copy constructor.

frame_t::~frame_t  ) 
 

Destructor.


Member Function Documentation

void frame_t::add frame_t  frame  ) 
 

Add all symbols from 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.

symbol_t frame_t::addSymbol const char *  ,
type_t  ,
void *  user = NULL
 

Adds a symbol of the given name and type to the frame.

frame_t frame_t::createFrame const frame_t parent  )  [static]
 

Creates and returns a new sub-frame.

frame_t frame_t::createFrame  )  [static]
 

Creates and returns a new root-frame.

int32_t frame_t::getIndexOf const char *  name  ) 
 

Returns the index of the symbol with the give name.

frame_t frame_t::getParent  )  throw (NoParentException)
 

Returns the parent frame.

uint32_t frame_t::getSize  )  const
 

Returns the number of symbols in this frame.

symbol_t frame_t::getSymbol int32_t   ) 
 

Returns the Nth symbol in this frame.

bool frame_t::hasParent  )  const
 

Returns true if this frame has a parent.

bool frame_t::operator!= const frame_t  )  const
 

Inequality operator.

const frame_t & frame_t::operator= const frame_t  ) 
 

Assignment operator.

bool frame_t::operator== const frame_t  )  const
 

Equality operator.

const symbol_t frame_t::operator[] int32_t   )  const
 

Returns the Nth symbol in this frame.

symbol_t frame_t::operator[] int32_t   ) 
 

Returns the Nth symbol in this frame.

bool frame_t::resolve const char *  name,
symbol_t symbol
 

Resolves a name in this frame or a parent frame.


Friends And Related Function Documentation

friend class symbol_t [friend]
 


The documentation for this class was generated from the following files:
Generated on Wed Jul 2 12:08:19 2003 for libutap by doxygen 1.3.2