DataTypeOfIndexMethod

Applies to:uCalc Transform
Class:uCalc
Returns a data type object
Syntax
DataTypeOfIndex(Index)
Parameters
Index
Index associated with the data type
Returns
Type: DataType
Returns a data type object
Remarks
Each instance of uCalc has its own separate handle & data type object for any given data type. For instance, GetItemOf("Int64") in one instance of uCalc does not share the same handle as GetItemOf("Int64") in another instance. This allows the same data type to have a different name and different formatting in different instances. However, they share the same data type index across instances. Given the index of a data type, you can directly obtain the proper data type object for a particular uCalc instance, faster than obtaining it by name as text with GetItemOf.
Example 1: Displaying formatted data from string input

Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Integer_8u).ToString("-1")) ' Returns 255
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Integer_16u).ToString("-1")) ' Returns 65535
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Boolean).ToString("-1")) ' Returns "false"
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Complex).ToString("-1")) ' Returns "0+1i"
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_String).ToString("-1")) ' Returns "-1"

          

Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Integer_8u).ToString("-1")); // Returns 255;
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Integer_16u).ToString("-1")); // Returns 65535;
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Boolean).ToString("-1")); // Returns "false";
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Complex).ToString("-1")); // Returns "0+1i";
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_String).ToString("-1")); // Returns "-1";

          

      WriteLn(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Integer_8u).ToString('-1')); // Returns 255;
      WriteLn(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Integer_16u).ToString('-1')); // Returns 65535;
      WriteLn(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Boolean).ToString('-1')); // Returns 'false';
      WriteLn(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Complex).ToString('-1')); // Returns '0+1i';
      WriteLn(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_String).ToString('-1')); // Returns '-1';

          

cout << uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Integer_8u).ToString("-1") << endl; // Returns 255;
cout << uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Integer_16u).ToString("-1") << endl; // Returns 65535;
cout << uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Boolean).ToString("-1") << endl; // Returns "false";
cout << uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Complex).ToString("-1") << endl; // Returns "0+1i";
cout << uc.DataTypeOfIndex(BuiltInTypesEnum::Type_String).ToString("-1") << endl; // Returns "-1";

          

Console::WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Integer_8u).ToString("-1")); // Returns 255;
Console::WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Integer_16u).ToString("-1")); // Returns 65535;
Console::WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Boolean).ToString("-1")); // Returns "false";
Console::WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Complex).ToString("-1")); // Returns "0+1i";
Console::WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum::Type_String).ToString("-1")); // Returns "-1";

          
DLL import code
<DllImport(uCalcDLL, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="DataTypeOfIndex")> _

Private Function DataTypeOfIndex__(ByVal uCalcHandle As IntPtr,ByVal Index As BuiltInTypesEnum) As IntPtr
End Function
            
[DllImport(uCalcDLL, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl, EntryPoint="DataTypeOfIndex")]

protected static extern IntPtr DataTypeOfIndex_(IntPtr uCalcHandle,BuiltInTypesEnum Index);
            
{DLLImport}function DataTypeOfIndex__(uCalcHandle: System.Pointer;Index: BuiltInTypesEnum): System.Pointer; cdecl; external uCalcDLL name 'DataTypeOfIndex';

            
typedef uCalcPtr (* __DataTypeOfIndex)(void *uCalcHandle, BuiltInTypesEnum Index); 

            
[DllImport(uCalcLib, CharSet=CharSet::Ansi, CallingConvention=CallingConvention::Cdecl, EntryPoint = "DataTypeOfIndex")]

static uCalcPtr DataTypeOfIndex_(void *  uCalcHandle, BuiltInTypesEnum Index);
            
Prev | Next