summaryrefslogtreecommitdiff
path: root/Yacs++/src/FACT.cxx
blob: 1b2593799e15f3417275b027be236794b0d031a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "FACT.hxx"
#include "Cle2000.hxx"
using namespace boost;  using namespace std;  using namespace ganlib;

FACT::FACT() {
  cout << "New FACT object constructed.'" << endl;
}

void FACT::run(long a, long& b) {
   // construct the lifo stack
   LifoPtr ipLifo = LifoPtr(new Lifo());
   ipLifo->push("input_val",int_32(a));
   ipLifo->pushEmpty("output_val","I");

   // call the procedure with in-out CLE-2000 variables
   Cle2000Ptr ipCle2000 = Cle2000Ptr(new Cle2000("fact", 0, ipLifo));
   ipCle2000->exec();

   // recover and erase the lifo stack
   int_32 output_val; ipLifo->pop(output_val);
   b = (long)output_val;

   // empty the lifo stack
   while (ipLifo->getMax() > 0) ipLifo->pop();
   
   // end of case -----------------------------------------------------------
   cout << "FACT::run: successful end of execution" << endl;
}