rpnprogramstackstate Class Reference
#include <rpn.h>
List of all members.
Public Member Functions |
| | rpnprogramstackstate () |
| void | init () |
| deque< rpnbase * > & | ds () |
| deque< rpnvar * > & | vs () |
| ostream & | print (ostream &os) const |
| void | push (rpnprogram *p) |
| void | pop () |
| void | add (rpnbase *x, string const &s) |
| void | findprogram (bool &found, string &path, rpnprogram *targ) |
| void | find (bool &result, unsigned int &indexi, unsigned int &indexk, rpnvar *&x, string const &nm) const |
| void | erase (string const &nm) |
| void | replace (rpnbase *x, string const &nm) |
| void | exists (bool &res, string const &nm) const |
| void | evaluate (deque< rpnbase * > &ds, string const &nm) const |
| void | recall (deque< rpnbase * > &ds, string const &nm) const |
| void | recallpointer (deque< rpnbase * > &ds, string const &nm) const |
| | rpnprogramstackstate () |
| void | init () |
| deque< rpnbase * > & | ds () |
| deque< rpnvar * > & | vs () |
| ostream & | print (ostream &os) const |
| void | push (rpnprogram *p) |
| void | pop () |
| void | add (rpnbase *x, string const &s) |
| void | findprogram (bool &found, string &path, rpnprogram *targ) |
| void | find (bool &result, unsigned int &indexi, unsigned int &indexk, rpnvar *&x, string const &nm) const |
| void | erase (string const &nm) |
| void | replace (rpnbase *x, string const &nm) |
| void | exists (bool &res, string const &nm) const |
| void | evaluate (deque< rpnbase * > &ds, string const &nm) const |
| void | recall (deque< rpnbase * > &ds, string const &nm) const |
| void | recallpointer (deque< rpnbase * > &ds, string const &nm) const |
Static Public Attributes |
| static rpnprogram | rpnhome |
| static deque< rpnprogram * > * | ps |
| static deque< rpnbase * > | ds2 |
Detailed Description
Definition at line 328 of file rpn.h.
Constructor & Destructor Documentation
| rpnprogramstackstate::rpnprogramstackstate |
( |
|
) |
[inline] |
| rpnprogramstackstate::rpnprogramstackstate |
( |
|
) |
[inline] |
Member Function Documentation
| void rpnprogramstackstate::add |
( |
rpnbase * |
x, |
|
|
string const & |
s | |
|
) |
| | |
| void rpnprogramstackstate::add |
( |
rpnbase * |
x, |
|
|
string const & |
s | |
|
) |
| | |
Definition at line 737 of file rpn.cpp.
References ps.
00738 {
00739 ps->front()->variables.push_front( new rpnvar(x,s) );
00740 }
| deque<rpnbase*>& rpnprogramstackstate::ds |
( |
|
) |
[inline] |
Definition at line 306 of file rpn2.h.
References ps.
00307 { return ps->front()->v; }
| deque<rpnbase*>& rpnprogramstackstate::ds |
( |
|
) |
[inline] |
Definition at line 354 of file rpn.h.
References ps.
00355 { return ps->front()->v; }
| void rpnprogramstackstate::erase |
( |
string const & |
nm |
) |
|
| void rpnprogramstackstate::erase |
( |
string const & |
nm |
) |
|
Definition at line 697 of file rpn.cpp.
References find(), and ps.
00698 {
00699 bool res;
00700 unsigned int i,k;
00701 rpnvar* x2;
00702
00703 find(res,i,k,x2,nm);
00704 if (res)
00705 {
00706 deque<rpnprogram*>& w = *ps;
00707 w[i]->variables.erase( w[i]->variables.begin()+k );
00708 }
00709 }
| void rpnprogramstackstate::evaluate |
( |
deque< rpnbase * > & |
ds, |
|
|
string const & |
nm | |
|
) |
| | const |
| void rpnprogramstackstate::evaluate |
( |
deque< rpnbase * > & |
ds, |
|
|
string const & |
nm | |
|
) |
| | const |
| void rpnprogramstackstate::exists |
( |
bool & |
res, |
|
|
string const & |
nm | |
|
) |
| | const |
| void rpnprogramstackstate::exists |
( |
bool & |
res, |
|
|
string const & |
nm | |
|
) |
| | const |
Definition at line 620 of file rpn.cpp.
00624 {
00625 unsigned int i,k;
00626 rpnvar* x;
00627
00628 find(res,i,k,x,nm);
00629 }
| void rpnprogramstackstate::find |
( |
bool & |
result, |
|
|
unsigned int & |
indexi, |
|
|
unsigned int & |
indexk, |
|
|
rpnvar *& |
x, |
|
|
string const & |
nm | |
|
) |
| | const |
| void rpnprogramstackstate::find |
( |
bool & |
result, |
|
|
unsigned int & |
indexi, |
|
|
unsigned int & |
indexk, |
|
|
rpnvar *& |
x, |
|
|
string const & |
nm | |
|
) |
| | const |
Definition at line 581 of file rpn.cpp.
Referenced by erase(), and replace().
00588 {
00589 result=false;
00590
00591 for (unsigned int i=0, imax=ps->size(); i<imax; ++i)
00592 {
00593 deque<rpnprogram*>& w = *ps;
00594 if ( ! w[i]->variables.empty() )
00595 {
00596 deque<rpnvar*>& z = w[i]->variables;
00597 for (unsigned int k=0, kmax=z.size(); k<kmax; ++k)
00598 {
00599 if (z[k]->varname==nm)
00600 {
00601 result=true;
00602 indexi = i;
00603 indexk = k;
00604 x = z[k];
00605
00606 return;
00607 }
00608 }
00609 }
00610 }
00611 }
| void rpnprogramstackstate::findprogram |
( |
bool & |
found, |
|
|
string & |
path, |
|
|
rpnprogram * |
targ | |
|
) |
| | |
| void rpnprogramstackstate::findprogram |
( |
bool & |
found, |
|
|
string & |
path, |
|
|
rpnprogram * |
targ | |
|
) |
| | |
Definition at line 744 of file rpn.cpp.
00749 {
00750 found = false;
00751
00752
00753 if (targ==&rpnhome)
00754 {
00755 findprogrampath = path = "/";
00756 found = true;
00757 return;
00758 }
00759
00760 findprogram(found,&rpnhome,"",targ);
00761
00762 if (found)
00763 path = findprogrampath;
00764 }
| void rpnprogramstackstate::init |
( |
|
) |
|
| void rpnprogramstackstate::init |
( |
|
) |
|
| void rpnprogramstackstate::pop |
( |
|
) |
[inline] |
Definition at line 317 of file rpn2.h.
References ps.
00318 { if(ps->size()>1) ps->pop_front(); }
| void rpnprogramstackstate::pop |
( |
|
) |
[inline] |
Definition at line 365 of file rpn.h.
References ps.
00366 { if(ps->size()>1) ps->pop_front(); }
Definition at line 716 of file rpn.cpp.
References ps.
Referenced by operator<<().
00717 {
00718 for (unsigned int i=0, imax=ps->size(); i<imax; ++i)
00719 {
00720 os << "{ ";
00721 deque<rpnprogram*>& w = *ps;
00722 if ( ! w[i]->variables.empty() )
00723 {
00724 deque<rpnvar*>& z = w[i]->variables;
00725 for (unsigned int k=0, kmax=z.size(); k<kmax; ++k)
00726 {
00727 os << "(" << z[k]->varname << ",";
00728 z[k]->x->print(os);
00729 os << ") ";
00730 }
00731 }
00732 os << "}" << endl;
00733 }
00734 return os;
00735 }
| void rpnprogramstackstate::push |
( |
rpnprogram * |
p |
) |
[inline] |
Definition at line 315 of file rpn2.h.
References ps.
00316 { ps->push_front(p); }
| void rpnprogramstackstate::push |
( |
rpnprogram * |
p |
) |
[inline] |
Definition at line 363 of file rpn.h.
References ps.
00364 { ps->push_front(p); }
| void rpnprogramstackstate::recall |
( |
deque< rpnbase * > & |
ds, |
|
|
string const & |
nm | |
|
) |
| | const |
| void rpnprogramstackstate::recall |
( |
deque< rpnbase * > & |
ds, |
|
|
string const & |
nm | |
|
) |
| | const |
| void rpnprogramstackstate::recallpointer |
( |
deque< rpnbase * > & |
ds, |
|
|
string const & |
nm | |
|
) |
| | const |
| void rpnprogramstackstate::recallpointer |
( |
deque< rpnbase * > & |
ds, |
|
|
string const & |
nm | |
|
) |
| | const |
Definition at line 663 of file rpn.cpp.
References rpnbase::inc(), and rpnvar::x.
00667 {
00668 bool res;
00669 unsigned int i,k;
00670 rpnvar* x;
00671
00672 find(res,i,k,x,nm);
00673 if (res)
00674 {
00675 x->x->inc();
00676 ds.push_front(x->x);
00677 }
00678 }
| void rpnprogramstackstate::replace |
( |
rpnbase * |
x, |
|
|
string const & |
nm | |
|
) |
| | |
| void rpnprogramstackstate::replace |
( |
rpnbase * |
x, |
|
|
string const & |
nm | |
|
) |
| | |
Definition at line 681 of file rpn.cpp.
References rpnbase::dec(), find(), and rpnvar::x.
00682 {
00683 bool res;
00684 unsigned int i,k;
00685 rpnvar* x2;
00686
00687 find(res,i,k,x2,nm);
00688 if (res)
00689 {
00690 x2->x->dec();
00691 x2->x = x;
00692 }
00693 else
00694 x->dec();
00695 }
| deque<rpnvar*>& rpnprogramstackstate::vs |
( |
|
) |
[inline] |
Definition at line 309 of file rpn2.h.
References ps.
00310 { return ps->front()->variables; }
| deque<rpnvar*>& rpnprogramstackstate::vs |
( |
|
) |
[inline] |
Definition at line 357 of file rpn.h.
References ps.
00358 { return ps->front()->variables; }
Member Data Documentation
The documentation for this class was generated from the following files: