DefineDataTypeMethod

Applies to:uCalc Transform
Class:uCalc
Defines a data type
Syntax
DefineDataType(TypeSize, AllocArrayValue, AllocScalar, AllocScalarByPtr, DeleteArray, DeleteScalar, ResetScalar, ResetArray, SetValueArray, SetValueScalar, SwapValues, ToString)
Parameters
TypeSize
Int32
Number of bytes 1 scalar value of this type takes
AllocArrayValue
ADDR
Address of a function that will allocate an array of this type
AllocScalar
ADDR
Address of a function that will allocate a scalar of this type. If a string is passed, this function must convert it to this type and store the value, otherwise the function must store a default value for this type.
AllocScalarByPtr
ADDR
Address of a function that takes a Pointer to a value of this type, allocates a scalar and stores the copied value in the allocated space.
DeleteArray
ADDR
Address of a function that frees a memory block that was allocated with AllocValueArray
DeleteScalar
ADDR
Address of a function that frees a memory block that was allocated by AllocScalar or AllocScalarByPtr.
ResetScalar
ADDR
Address of a function that resets an allocated scalar back to the default value of this type.
ResetArray
ADDR
Address of a function that resets array elements back to the default value of this type.
SetValueArray
ADDR
Address of a function that stores an array element value.
SetValueScalar
ADDR
Address of a function that stores a scalar value.
SwapValues
ADDR
Address of a function that swaps two values of this type.
ToString
ADDR
Address of a function that converts this data type to a string.
Returns
Type: Item
Defines a data type
Remarks
This allows you to define a data type that functions at the same level as the intrinsic types that come with uCalc.

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

Private Function DefineDataType__(ByVal uCalcHandle As IntPtr,ByVal TypeSize As Int32 , ByVal AllocArrayValue As IntPtr , ByVal AllocScalar As IntPtr , ByVal AllocScalarByPtr As IntPtr , ByVal DeleteArray As IntPtr , ByVal DeleteScalar As IntPtr , ByVal ResetScalar As IntPtr , ByVal ResetArray As IntPtr , ByVal SetValueArray As IntPtr , ByVal SetValueScalar As IntPtr , ByVal SwapValues As IntPtr , ByVal ToString As IntPtr) As IntPtr
End Function
            
[DllImport(uCalcDLL, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl, EntryPoint="DefineDataType")]

protected static extern IntPtr DefineDataType_(IntPtr uCalcHandle, Int32 TypeSize , IntPtr AllocArrayValue  , IntPtr AllocScalar  , IntPtr AllocScalarByPtr  , IntPtr DeleteArray  , IntPtr DeleteScalar  , IntPtr ResetScalar  , IntPtr ResetArray  , IntPtr SetValueArray  , IntPtr SetValueScalar  , IntPtr SwapValues  , IntPtr ToString );
            
{DLLImport}function DefineDataType__(uCalcHandle: System.Pointer;TypeSize: Int32 ; AllocArrayValue: System.Pointer ; AllocScalar: System.Pointer ; AllocScalarByPtr: System.Pointer ; DeleteArray: System.Pointer ; DeleteScalar: System.Pointer ; ResetScalar: System.Pointer ; ResetArray: System.Pointer ; SetValueArray: System.Pointer ; SetValueScalar: System.Pointer ; SwapValues: System.Pointer ; ToString: System.Pointer): System.Pointer; cdecl; external uCalcDLL name 'DefineDataType';

            
typedef uCalcPtr (* __DefineDataType)(void *uCalcHandle, int32_t TypeSize ,  void * AllocArrayValue ,  void * AllocScalar ,  void * AllocScalarByPtr ,  void * DeleteArray ,  void * DeleteScalar ,  void * ResetScalar ,  void * ResetArray ,  void * SetValueArray ,  void * SetValueScalar ,  void * SwapValues ,  void * ToString); 

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

static uCalcPtr DefineDataType_(void *  uCalcHandle, Int32 TypeSize ,  void *   AllocArrayValue ,  void *   AllocScalar ,  void *   AllocScalarByPtr ,  void *   DeleteArray ,  void *   DeleteScalar ,  void *   ResetScalar ,  void *   ResetArray ,  void *   SetValueArray ,  void *   SetValueScalar ,  void *   SwapValues ,  void *   ToString);
            
See also
Prev | Next