cniIsTerminalAttached

Checks whether a terminal is attached to another node by a connector. It returns an integer value that specifies whether the specified terminal object is attached to one or more terminals on other message flow nodes. You can use it to test whether a message can be propagated to a terminal. However, it is not necessary to call this function before propagating a message with the cniPropagate utility function. Using the cniIsTerminalAttached function, a node can modify its behavior when a terminal is not connected.

Syntax

int cniIsTerminalAttached(
  int*          returnCode,
  CciTerminal*  terminalObject);

Parameters

returnCode
The return code from the function (output).
terminalObject
The address of the input or output terminal to be checked for an attached connector (input). The address is returned from cniCreateOutputTerminal.

Return values

  • If the terminal is attached to another node by a connector, a value of 1 is returned.
  • If the terminal is not attached, or a failure occurred, a value of zero is returned.
  • If a failure occurred, the value of the returnCode parameter indicates the reason for the error.

Example

  if (terminalObject) {
    if (cniIsTerminalAttached(&rc, terminalObject)) {
      if (rc == CCI_SUCCESS) {
        retvalue = cniPropagate(
                                &rc, 
                                terminalObject, 
                                destinationList, 
                                exceptionList, 
                                message);

Related concepts
User-defined Input nodes
User-defined message processing nodes
User-defined output nodes

Related tasks
Creating an input node in C
Creating a message processing node in C

Related reference
C language node utility functions
cniCreateOutputTerminal
cniPropagate