ValueMethod
Returns the value (default double precision) associated with a
uCalc.Item
Example 1: Retrieving an item value by explicit data type
Dim var = uc.DefineVariable("Var = 1.25")
Dim ByteVar = uc.DefineVariable("ByteVar As Byte = -1")
Dim Int16Var = uc.DefineVariable("Int16Var As Int16 = 456")
Dim Int32Var = uc.DefineVariable("Int32Var As Int32 = Int16u(-1)")
Dim Int64Var = uc.DefineVariable("Int64Var = Int64(55.2)")
Dim SingleVar = uc.DefineVariable("SingleVar As Single = Single(1.0000000001)-1")
Dim DoubleVar = uc.DefineVariable("DoubleVar As Double = Double(1.0000000001)-1")
Dim StringVar = uc.DefineVariable("StringVar = 'Just a test'"):
Dim PointerVar = uc.DefineVariable("PtrVar As Double Ptr = AddressOf(DoubleVar)")
Console.WriteLine("Var value: " + var.Value())
Console.WriteLine("ByteVar value: " + CInt(ByteVar.ValueByte()))
Console.WriteLine("Int16Var value: " + Int16Var.ValueInt16())
Console.WriteLine("Int32Var value: " + Int32Var.ValueInt32())
Console.WriteLine("Int64Var value: " + Int64Var.ValueInt64())
Console.WriteLine("SingleVar value: " + SingleVar.ValueSng())
Console.WriteLine("DoubleVar value: " + DoubleVar.ValueDbl())
Console.WriteLine("StringVar value: " + StringVar.ValueStr())
Console.Write("PointerVar value: "): Console.WriteLine(PointerVar.ValuePtr())
Console.Write("DoubleVar address: "): Console.WriteLine(DoubleVar.ValueAddr())
Console.WriteLine(PointerVar.ValuePtr())
var var = uc.DefineVariable("Var = 1.25");
var ByteVar = uc.DefineVariable("ByteVar As Byte = -1");
var Int16Var = uc.DefineVariable("Int16Var As Int16 = 456");
var Int32Var = uc.DefineVariable("Int32Var As Int32 = Int16u(-1)");
var Int64Var = uc.DefineVariable("Int64Var = Int64(55.2)");
var SingleVar = uc.DefineVariable("SingleVar As Single = Single(1.0000000001)-1");
var DoubleVar = uc.DefineVariable("DoubleVar As Double = Double(1.0000000001)-1");
var StringVar = uc.DefineVariable("StringVar = 'Just a test'");
var PointerVar = uc.DefineVariable("PtrVar As Double Ptr = AddressOf(DoubleVar)");
Console.WriteLine("Var value: " + var.Value());
Console.WriteLine("ByteVar value: " + (int)ByteVar.ValueByte());
Console.WriteLine("Int16Var value: " + Int16Var.ValueInt16());
Console.WriteLine("Int32Var value: " + Int32Var.ValueInt32());
Console.WriteLine("Int64Var value: " + Int64Var.ValueInt64());
Console.WriteLine("SingleVar value: " + SingleVar.ValueSng());
Console.WriteLine("DoubleVar value: " + DoubleVar.ValueDbl());
Console.WriteLine("StringVar value: " + StringVar.ValueStr());
Console.Write("PointerVar value: "); Console.WriteLine(PointerVar.ValuePtr());
Console.Write("DoubleVar address: "); Console.WriteLine(DoubleVar.ValueAddr());
Console.WriteLine(PointerVar.ValuePtr());
WriteLn('Var value: ' + var.Value());
WriteLn('ByteVar value: ' + CInt(ByteVar.ValueByte()));
WriteLn('Int16Var value: ' + Int16Var.ValueInt16());
WriteLn('Int32Var value: ' + Int32Var.ValueInt32());
WriteLn('Int64Var value: ' + Int64Var.ValueInt64());
WriteLn('SingleVar value: ' + SingleVar.ValueSng());
WriteLn('DoubleVar value: ' + DoubleVar.ValueDbl());
WriteLn('StringVar value: ' + StringVar.ValueStr());
Write('PointerVar value: '); WriteLn(PointerVar.ValuePtr());
Write('DoubleVar address: '); WriteLn(DoubleVar.ValueAddr());
WriteLn(PointerVar.ValuePtr());
auto var = uc.DefineVariable("Var = 1.25");
auto ByteVar = uc.DefineVariable("ByteVar As Byte = -1");
auto Int16Var = uc.DefineVariable("Int16Var As Int16 = 456");
auto Int32Var = uc.DefineVariable("Int32Var As Int32 = Int16u(-1)");
auto Int64Var = uc.DefineVariable("Int64Var = Int64(55.2)");
auto SingleVar = uc.DefineVariable("SingleVar As Single = Single(1.0000000001)-1");
auto DoubleVar = uc.DefineVariable("DoubleVar As Double = Double(1.0000000001)-1");
auto StringVar = uc.DefineVariable("StringVar = 'Just a test'");
auto PointerVar = uc.DefineVariable("PtrVar As Double Ptr = AddressOf(DoubleVar)");
cout << "Var value: " << var.Value() << endl;
cout << "ByteVar value: " << (int)ByteVar.ValueByte() << endl;
cout << "Int16Var value: " << Int16Var.ValueInt16() << endl;
cout << "Int32Var value: " << Int32Var.ValueInt32() << endl;
cout << "Int64Var value: " << Int64Var.ValueInt64() << endl;
cout << "SingleVar value: " << SingleVar.ValueSng() << endl;
cout << "DoubleVar value: " << DoubleVar.ValueDbl() << endl;
cout << "StringVar value: " << StringVar.ValueStr() << endl;
cout << "PointerVar value: "; cout << PointerVar.ValuePtr() << endl;
cout << "DoubleVar address: "; cout << DoubleVar.ValueAddr() << endl;
cout << PointerVar.ValuePtr() << endl;
auto var = uc.DefineVariable("Var = 1.25");
auto ByteVar = uc.DefineVariable("ByteVar As Byte = -1");
auto Int16Var = uc.DefineVariable("Int16Var As Int16 = 456");
auto Int32Var = uc.DefineVariable("Int32Var As Int32 = Int16u(-1)");
auto Int64Var = uc.DefineVariable("Int64Var = Int64(55.2)");
auto SingleVar = uc.DefineVariable("SingleVar As Single = Single(1.0000000001)-1");
auto DoubleVar = uc.DefineVariable("DoubleVar As Double = Double(1.0000000001)-1");
auto StringVar = uc.DefineVariable("StringVar = 'Just a test'");
auto PointerVar = uc.DefineVariable("PtrVar As Double Ptr = AddressOf(DoubleVar)");
Console::WriteLine("Var value: " + var.Value());
Console::WriteLine("ByteVar value: " + (int)ByteVar.ValueByte());
Console::WriteLine("Int16Var value: " + Int16Var.ValueInt16());
Console::WriteLine("Int32Var value: " + Int32Var.ValueInt32());
Console::WriteLine("Int64Var value: " + Int64Var.ValueInt64());
Console::WriteLine("SingleVar value: " + SingleVar.ValueSng());
Console::WriteLine("DoubleVar value: " + DoubleVar.ValueDbl());
Console::WriteLine("StringVar value: " + StringVar.ValueStr());
Console::Write("PointerVar value: "); Console::WriteLine(PointerVar.ValuePtr());
Console::Write("DoubleVar address: "); Console::WriteLine(DoubleVar.ValueAddr());
Console::WriteLine(PointerVar.ValuePtr());
DLL import code
<DllImport(uCalcDLL, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="Value")> _
Private Function Value__(ByVal ItemHandle As IntPtr) As Double
End Function
[DllImport(uCalcDLL, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl, EntryPoint="Value")]
protected static extern double Value_(IntPtr ItemHandle);
{DLLImport}function Value__(ItemHandle: System.Pointer): Double; cdecl; external uCalcDLL name 'Value';
typedef double (* __Value)(void *ItemHandle);
[DllImport(uCalcLib, CharSet=CharSet::Ansi, CallingConvention=CallingConvention::Cdecl, EntryPoint = "Value")]
static double Value_(void * ItemHandle);