Titan



ischosen


This function returns the value true if and only if the data object reference specifies the variant of the union type that is actually selected for a given data object.


Related keyword:


ischosen(any_type value) return boolean


Example 1:

  type union MyUnion
     {  PDU_type1 p1,
        PDU_type2 p2,
        PDU_type p3
     }

...

  // and given that MyPDU is a template of MyUnion type
  // and received_PDU is also of MyUnion type
  // then
  MyPort.receive(MyPDU) -> value received_PDU

  ischosen(received_PDU.p2)
  // returns true if the actual instance of MyPDU carries a PDU of the type PDU_type2