tuple_typetuple_typeTupleTypeTupleTypetuple_type (Operator)

Name

tuple_typetuple_typeTupleTypeTupleTypetuple_type — 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)

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

HTuple HTuple::TupleType() const

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

HTuple HTuple.TupleType()

def tuple_type(t: HTupleType) -> int

Description

tuple_typetuple_typeTupleTypeTupleTypeTupleTypetuple_type 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 31 (H_TYPE_ANY).

HDevelop In-line Operation

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

Type := type(T)

Attention

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

Execution Information

Parameters

TTTTtt (input_control)  tuple(-array) HTupleHTupleTypeHTupleHtuple (real / integer / string / handle) (double / int / long / string / HHandle) (double / Hlong / HString / HHandle) (double / Hlong / char* / handle)

Input tuple.

TypeTypeTypeTypetypetype (output_control)  number HTupleintHTupleHtuple (integer) (int / long) (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
tuple_type (HNULL, TypeD)
* TypeD = H_TYPE_HANDLE

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_typeTupleTypeTupleTypeTupleTypetuple_type returns the value 2 ( H_MSG_TRUE) .

Alternatives

tuple_is_inttuple_is_intTupleIsIntTupleIsIntTupleIsInttuple_is_int, tuple_is_numbertuple_is_numberTupleIsNumberTupleIsNumberTupleIsNumbertuple_is_number, tuple_is_realtuple_is_realTupleIsRealTupleIsRealTupleIsRealtuple_is_real, tuple_is_stringtuple_is_stringTupleIsStringTupleIsStringTupleIsStringtuple_is_string, tuple_sem_typetuple_sem_typeTupleSemTypeTupleSemTypeTupleSemTypetuple_sem_type

See also

get_obj_classget_obj_classGetObjClassGetObjClassGetObjClassget_obj_class

Module

Foundation