#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Create two completely separate uCalc instances.
   uCalc uc1;
   uc1.DefineVariable("x = 100");

   uCalc uc2;
   uc2.DefineVariable("x = 200");

   // Get the DataType for 'Int' from the *first* instance.
   auto intType_from_uc1 = uc1.DataTypeOf("Int");

   // Use the .uCalc() method to get the parent instance.
   // This should be uc1, so evaluating 'x' should yield 100.
   auto parent = intType_from_uc1.uCalc();
   cout << "Parent of intType_from_uc1 evaluates 'x' to: " << parent.Eval("x") << endl;

   // Get the DataType for 'Int' from the *second* instance.
   auto intType_from_uc2 = uc2.DataTypeOf("Int");

   // This should be uc2, so evaluating 'x' should yield 200.
   parent = intType_from_uc2.uCalc();
   cout << "Parent of intType_from_uc2 evaluates 'x' to: " << parent.Eval("x") << endl;
}