Click or drag to resize

IMcOMGlobalMcOpCast Method

Casts the values in a Variant to another arithmetic type

Namespace:  MediaCy.IQL.ObjectManager
Assembly:  MediaCy.IQL.ObjectManager (in MediaCy.IQL.ObjectManager.dll) Version: 10.0.6912.0
Syntax
VB
Function McOpCast ( 
	Operand As Object,
	CastToTypeName As String
) As McObject

Parameters

Operand
Type: SystemObject
May be a scalar or array of any arithmetic type. It may also be an McObject instance of an arithmetic type.
CastToTypeName
Type: SystemString
Destination type for the case. Allowed names are "INTEGER" for 32-bit integer (VB Long type), "LONG" for 64-bit integer, "SHORT" for 16-bit integer (VB Integer type), "BYTE" for 8-bit unsigned integer (VB Byte type), "REAL" for 64-bit IEEE floating point (VB Double type) or "FLOAT" for 32-bit IEEE floating point (DB Single type).

Return Value

Type: McObject
A McObject instance holding the cast Operand. The returned result will be of the arithmetic type specified by the CastToTypeName argument. It will also be the same shape as Operand, except that it will always be an array, even if the Operand is a scalar (generally there is no reason to use these vector operators unless you are dealing with arrays).
Remarks
The Operand (which may be a scalar or an array of arthmetic values) is converted to a requested destination type. Casting can be especially important when using these vector operations, because the association rules for both arithmetic and logical binary operations (E.g. McOpAdd or McOpGT) always cast the right operand to the type of the left before performing the operation. Thus, McOpAdd( 1, 1.5) yields 2, not the intuitively expected 2.5; McOpAdd(McOpCast(1,"REAL"),1.5) does give the expected result.
Examples
VB
'Create an array of Double values going from 0.2 through 1.0 in steps of 0.1
Set var2thru10 = McOpCast( McOpFillIn(2,11), "REAL")
Set varResult = McOpMul( var2thru10, 0.1)
' Show Operation McObject Result = .2,.3,.4,.5,.6,.7,.8
MsgBox( "Operation IMcObject Result = " + McToText(varResult))
See Also