ClassesClassesClassesClasses | | | | Operators

tuple_typetuple_typeTupleTypetuple_typeTupleTypeTupleType (Operator)

Name

tuple_typetuple_typeTupleTypetuple_typeTupleTypeTupleType — Return the type of a tuple.

Signature

tuple_type( : : T : Type)

Herror tuple_type(double T, Hlong* Type)

Herror T_tuple_type(const Htuple T, Htuple* Type)

Herror tuple_type(const HTuple& T, Hlong* Type)

void TupleType(const HTuple& T, HTuple* Type)

HTuple HTuple::TupleType() const

void HOperatorSetX.TupleType(
[in] VARIANT T, [out] VARIANT* Type)

VARIANT HTupleX.TupleType([in] VARIANT T)

static void HOperatorSet.TupleType(HTuple t, out HTuple type)

HTuple HTuple.TupleType()

Description

tuple_typetuple_typeTupleTypetuple_typeTupleTypeTupleType returns the type of the input tuple TTTTTt. The type is returned as an integer value in the output parameter TypeTypeTypeTypeTypetype. In HDevelop corresponding constants are defined:

H_TYPE_MIXED is returned in the following two cases:

Exception: Empty input tuple

If the input tuple is empty, the operator returns 15 (H_TYPE_ANY).

HDevelop In-line Operation

HDevelop provides an in-line operation for tuple_typetuple_typeTupleTypetuple_typeTupleTypeTupleType, which can be used in an expression in the following syntax:

Type := type(T)

Attention

tuple_typetuple_typeTupleTypetuple_typeTupleTypeTupleType returns the internal data type of the tuple. In contrast to tuple_is_numbertuple_is_numberTupleIsNumbertuple_is_numberTupleIsNumberTupleIsNumber it does not return whether a tuple could be represented as a tuple of a certain type.

Parallelization

Parameters

TTTTTt (input_control)  number(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*) (double / Hlong / BSTR) (double / Hlong / char*)

Input tuple.

TypeTypeTypeTypeTypetype (output_control)  number HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Type of the input tuple as an integer number.

Example (HDevelop)

tuple_type ([3.1416,'pi',3], TypeA)
* TypeA = H_TYPE_MIXED
tuple_type (['a','b','111'], TypeB)
* TypeB = H_TYPE_STRING
tuple_type ([], TypeC)
* TypeC = H_TYPE_ANY

TupleInt := [1,2,3,4]
TupleReal := [42.0]
TupleConcat := [TupleInt, TupleReal]
tuple_type (TupleConcat, TypeConcat)
* TypeConcat = H_TYPE_MIXED
* Now set 42.0 to 42
TupleConcat[4] := 42
tuple_type (TupleConcat, TypeConcat2)
* TypeConcat2 = H_TYPE_MIXED
* TupleConcat now consists of integers only, but the
* internal representation hasn't been updated. Optimize
* it by converting the tuple explicitly to an integer
* tuple.
tuple_int (TupleConcat, TupleConcatInt)
tuple_type (TupleConcatInt, TypeConcatInt)
* TypeConcatInt = H_TYPE_INT

Result

If the parameters are valid, the operator tuple_typetuple_typeTupleTypetuple_typeTupleTypeTupleType returns the value 2 (H_MSG_TRUE).

Alternatives

tuple_is_inttuple_is_intTupleIsInttuple_is_intTupleIsIntTupleIsInt, tuple_is_numbertuple_is_numberTupleIsNumbertuple_is_numberTupleIsNumberTupleIsNumber, tuple_is_realtuple_is_realTupleIsRealtuple_is_realTupleIsRealTupleIsReal, tuple_is_stringtuple_is_stringTupleIsStringtuple_is_stringTupleIsStringTupleIsString

See also

get_obj_classget_obj_classGetObjClassget_obj_classGetObjClassGetObjClass

Module

Foundation


ClassesClassesClassesClasses | | | | Operators