Operator Reference

tuple_ordstuple_ordsTupleOrdsTupleOrdstuple_ords (Operator)

tuple_ordstuple_ordsTupleOrdsTupleOrdstuple_ords — Convert a tuple of strings into a tuple of integer numbers.

Signature

tuple_ords( : : T : Ords)

Herror tuple_ords(const char* T, Hlong* Ords)

Herror T_tuple_ords(const Htuple T, Htuple* Ords)

void TupleOrds(const HTuple& T, HTuple* Ords)

HTuple HTuple::TupleOrds() const

static void HOperatorSet.TupleOrds(HTuple t, out HTuple ords)

HTuple HTuple.TupleOrds()

def tuple_ords(t: MaybeSequence[Union[str, int]]) -> Sequence[int]

def tuple_ords_s(t: MaybeSequence[Union[str, int]]) -> int

Description

tuple_ordstuple_ordsTupleOrdsTupleOrdstuple_ords converts the input tuple TTTtt, which may only contain strings and integer numbers, into a tuple of integer numbers. When the encoding used in the HALCON library is UTF-8 (see set_system('filename_encoding', 'utf8')set_system("filename_encoding", "utf8")SetSystem("filename_encoding", "utf8")SetSystem("filename_encoding", "utf8")set_system("filename_encoding", "utf8")) and the string operators are set to work by code points (see set_system('tuple_string_operator_mode', 'codepoint')set_system("tuple_string_operator_mode", "codepoint")SetSystem("tuple_string_operator_mode", "codepoint")SetSystem("tuple_string_operator_mode", "codepoint")set_system("tuple_string_operator_mode", "codepoint")), which is the default for both, the operator returns for the input strings the appropriate Unicode character codes. When the HALCON library encoding is set to 'locale'"locale""locale""locale""locale" or the string operator mode is 'byte'"byte""byte""byte""byte", the operator returns the ANSI code for every byte of the input string. In that mode, the result may depend on the currently used code page for strings that contain non-ASCII characters. See also Tuple / String Operations for a more detailed description of the different modes and further encoding issues.

The character codes of the individual strings are written to the output according to their order within the string and within the tuple. Integer numbers are simply copied to an appropriate position in the output tuple. This operator can be used to prepare outputs with write_serialwrite_serialWriteSerialWriteSerialwrite_serial. In particular, a byte with value 0 can be written by inserting the integer number 0 into TTTtt.

If the input tuple is empty, the operator returns an empty tuple.

HDevelop In-line Operation

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

Ords := ords(T)

Execution Information

  • Multithreading type: independent (runs in parallel even with exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

TTTtt (input_control)  string(-array) HTupleMaybeSequence[Union[str, int]]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

Input tuple with strings.

OrdsOrdsOrdsordsords (output_control)  integer(-array) HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Output tuple with the Unicode character codes or ANSI codes of the input string.

Example (HDevelop)

tuple_ords (['String 1', 0, 'String 2', 0], Data)
write_serial (SerialHandle, Data)

Alternatives

tuple_ordtuple_ordTupleOrdTupleOrdtuple_ord

See also

tuple_chrtuple_chrTupleChrTupleChrtuple_chr, tuple_chrttuple_chrtTupleChrtTupleChrttuple_chrt, write_serialwrite_serialWriteSerialWriteSerialwrite_serial

Module

Foundation