toycalc::scope Class Reference

Execution scope . More...

#include <scope.hh>

Collaboration diagram for toycalc::scope:

Collaboration graph
[legend]
List of all members.

Public Methods

 scope (scope *parent=0)
 Constructor. More...

virtual ~scope ()
 Destructor. More...

variable_basefind_variable (const std::string &name)
 Look-up a variable in this (and hence parent) scope. More...

void add_function (const function *id)
 Add a variable to the current scope. More...

void add_variable (variable_base *id)
 Add a variable to the current scope. More...

functionfind_function (const std::string &name)
 Look-up a variable in this (and hence parent) scope. More...

const std::list< variable_base * > & variables () const
 Return list of variables. More...

const std::list< function * > & functions () const
 Return list of functions. More...

scope * parent () const
 Get the parent scope. More...

scope * parent (scope *p)
 Get the parent scope. More...

void list () const
 List variables and functions. More...


Static Public Methods

scope * current ()
 get the current scope;. More...

void push ()
 Push a scope. More...

void pop (bool del=true)
 pop a scope. More...

void push (scope *s)
 Push a scope. More...


Detailed Description

Execution scope .

Definition at line 46 of file scope.hh.


Constructor & Destructor Documentation

toycalc::scope::scope scope *    parent = 0 [inline]
 

Constructor.

Definition at line 62 of file scope.hh.

References parent().

Referenced by current(), and push().

toycalc::scope::~scope   [virtual]
 

Destructor.

Definition at line 82 of file scope.cc.

References i.


Member Function Documentation

void toycalc::scope::add_function const function   id
 

Add a variable to the current scope.

Parameters:
id  Identifier to add.
Returns:
variable; either new (automatic) or existing

Definition at line 93 of file scope.cc.

References f.

void toycalc::scope::add_variable variable_base   id
 

Add a variable to the current scope.

Parameters:
id  Identifier to add.
Returns:
variable; either new (automatic) or existing

Definition at line 101 of file scope.cc.

Referenced by toycalc::function::function().

toycalc::scope * toycalc::scope::current   [static]
 

get the current scope;.

Definition at line 42 of file scope.cc.

References scope().

Referenced by list_it(), and push().

toycalc::function * toycalc::scope::find_function const std::string   name
 

Look-up a variable in this (and hence parent) scope.

Parameters:
name  the name to lookup.
Returns:
variable if found, or 0 if not found.

Definition at line 108 of file scope.cc.

References i, and name.

toycalc::variable_base * toycalc::scope::find_variable const std::string   name
 

Look-up a variable in this (and hence parent) scope.

Parameters:
name  the name to lookup.
Returns:
variable if found, or 0 if not found.

Definition at line 125 of file scope.cc.

References i, and name.

const std::list<function*>& toycalc::scope::functions   const [inline]
 

Return list of functions.

Definition at line 103 of file scope.hh.

Referenced by toycalc::completer::complete(), and toycalc::completer::possibilities().

void toycalc::scope::list   const
 

List variables and functions.

Definition at line 142 of file scope.cc.

References i, ylmm::basic_messenger< Lock >::message(), and ylmm::basic_messenger< Lock >::message_stream().

scope* toycalc::scope::parent scope *    p [inline]
 

Get the parent scope.

Definition at line 109 of file scope.hh.

scope* toycalc::scope::parent   const [inline]
 

Get the parent scope.

Definition at line 106 of file scope.hh.

Referenced by toycalc::completer::complete(), push(), and scope().

void toycalc::scope::pop bool    del = true [static]
 

pop a scope.

Parameters:
del  If true, also delete the scope.

Definition at line 60 of file scope.cc.

References _parent.

void toycalc::scope::push scope *    s [static]
 

Push a scope.

Definition at line 74 of file scope.cc.

References current(), and parent().

void toycalc::scope::push   [static]
 

Push a scope.

Definition at line 51 of file scope.cc.

References current(), and scope().

const std::list<variable_base*>& toycalc::scope::variables   const [inline]
 

Return list of variables.

Definition at line 100 of file scope.hh.

Referenced by toycalc::function::call(), toycalc::completer::complete(), and toycalc::completer::possibilities().


The documentation for this class was generated from the following files:
Top of page
Last update Wed Feb 5 03:34:22 2003
Christian Holm
Created by DoxyGen 1.2.15