proj home

Files   Classes   Functions   Hierarchy  

rpnbitshiftright Class Reference

#include <rpnfunc.h>

Inheritance diagram for rpnbitshiftright:
Collaboration diagram for rpnbitshiftright:

List of all members.

Public Member Functions

 rpnbitshiftright ()
 rpnbitshiftright (deque< rpnbase * > &ds, bool const evaluate=true)
 ~rpnbitshiftright ()
rpnbasecopy () const
void visit (deque< rpnbase * > &ds, rpninteger &n)
string const name () const
void eval (deque< rpnbase * > &ds)


Detailed Description

Definition at line 1304 of file rpnfunc.h.


Constructor & Destructor Documentation

rpnbitshiftright::rpnbitshiftright (  )  [inline]

Definition at line 1308 of file rpnfunc.h.

Referenced by copy().

01308 {}

rpnbitshiftright::rpnbitshiftright ( deque< rpnbase * > &  ds,
bool const   evaluate = true 
)

Definition at line 4041 of file rpnfunc.cpp.

References eval().

04042 {
04043   if (evaluate)
04044     eval(ds);
04045   else
04046     ds.push_front(this);
04047 }

rpnbitshiftright::~rpnbitshiftright (  )  [inline]

Definition at line 1310 of file rpnfunc.h.

01310 {}


Member Function Documentation

rpnbase * rpnbitshiftright::copy (  )  const [virtual]

Reimplemented from rpnfunction.

Definition at line 4049 of file rpnfunc.cpp.

References rpnbitshiftright().

04050 {
04051   return new rpnbitshiftright();
04052 }

void rpnbitshiftright::eval ( deque< rpnbase * > &  ds  )  [virtual]

Reimplemented from rpnfunction.

Definition at line 4054 of file rpnfunc.cpp.

References rpnbase::accept(), and rpnbase::dec().

Referenced by rpnbitshiftright().

04055 {
04056   if (ds.size()>1)
04057     ds[0]->accept(ds,*this);
04058 
04059   dec();
04060 }

string const rpnbitshiftright::name (  )  const [inline, virtual]

Reimplemented from rpnfunction.

Definition at line 1315 of file rpnfunc.h.

01315 { return string("shr"); }

void rpnbitshiftright::visit ( deque< rpnbase * > &  ds,
rpninteger n 
) [virtual]

Reimplemented from rpnfunction.

Definition at line 4062 of file rpnfunc.cpp.

References rpnbase::dec(), rpnbase::isinteger(), and rpninteger::num.

04063 {
04064   rpnbase* x0 = ds.front();
04065   rpnbase* x1 = ds[1];
04066 
04067   if (!x1->isinteger())
04068     return;
04069 
04070   ds.pop_front();
04071 
04072   ((rpninteger*)x1)->num = (((rpninteger*)x1)->num >> n.num);
04073   
04074   x0->dec();
04075 }


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

Generated on Fri Mar 4 00:50:12 2011 for Chelton Evans Source by  doxygen 1.5.8