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

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Create two independent uCalc instances
   uCalc uc1;
   uCalc uc2;

   // Define a variable 'x' in each instance with a different value
   auto itemX1 = uc1.DefineVariable("x = 100");
   auto itemX2 = uc2.DefineVariable("x = 200");

   // Use the item to get its parent context and evaluate 'x * 2'
   // This correctly uses uc1's context where x is 100.
   cout << "Context 1: " << itemX1.uCalc().Eval("x * 2") << endl;

   // This correctly uses uc2's context where x is 200.
   cout << "Context 2: " << itemX2.uCalc().Eval("x * 2") << endl;

   // Clean up the instances
   uc1.Release();
   uc2.Release();
}