Casting Functions

Float64() — Equivalent to calling GetValNumber() with PropOption_Coerce.Int64() — Equivalent to calling GetValInteger64() with PropOption_Coerce.UInt64() — Equivalent to calling GetValUnsignedInteger64() with PropOption_Coerce.Str() — Equivalent to calling GetValString() with PropOption_Coerce.

Operators

Equality (==) and Inequality (!=) — To enforce type safety, enumerations can be compared only to other enumerations of the same named type. The equality and inequality operations compare the numeric values of the enumeration instances, ignoring any enumerator information. For example, if both Scarlet and Red have the numeric value of 2, then an enumeration set to Scarlet will equal an enumeration set to Red. (This behavior corresponds to the behavior of enums in C#, C, and C++.)

Assignment (=) — To enforce type safety, enumerations can be assigned only to other enumerations of the same named type.

Logical NOT (!) — Supported for flags enumerations only. Returns true if the numeric value is zero, false otherwise. Use logical NOT to check if any flags are set.

Bitwise AND (&), OR (|) and XOR (^) — Supported for flags enumerations only. To enforce type safety, enumerations can be combined only with other enumerations of the same named type. The TestStand engine performs the specified operation on the numeric values of the two operands, then constructs a new instance of the enumeration type and sets the value.

Note This behavior can result in a runtime error for strict enumerations if the resulting value is out of range.

Bitwise NOT(~) — Supported for flags enumerations only. The TestStand engine performs the bitwise NOT operation on the numeric value of the operand, then constructs a new instance ofthe enumeration type and sets the value.

Note This behavior can result in a runtime error for strict enumerations if the resulting value is out of range.

Unsupported Operations (<, >, +, -, *, /, %, +=, -=, *=, /=, %=, &&, ||, <<, >> ) — These operations are not supported for enumerations. To perform these operations, you must first convert the enumeration to a number.

Enumeration Constants

Use the Enum() expression function or the Enums keyword to specify an enumeration constant in an expression.

Enums keyword — Use the syntax Enums.<TYPE>.<ENUMERATOR> to specify an enumeration constant in a TestStand expression. For example, Enums.Color.Red specifies the Red value from the Color type in the Getting Started Creating a TestStand Enumeration section.

Enum(String type, [String|Number] value) — Returns an instance of an enumeration with the specified type and value. If value is a string, the enumerator and number are set as if by callingSetValString(). Passing an out of range value results in an error. If value is a number, the value is set as if by calling SetValNumber(), SetValInteger64(), SetValUnsignedInteger64() as appropriate for the representation of the enumeration type. Passing an out of range value to a strict enumeration results in a runtime error.