Overview
Trigger connections are automatic connections that carry events to methods and call-back functions causing them to execute. In terms of how they are accessed from the active object, they can be treated just like any other automatic connection.
Examples
The two examples shown below are actually equivalent but illustrate two slightly different naming conventions;
In the left-hand case, the code below will be executed when store 'A' contains a populated readable buffer, and store 'B' has a buffer available for write.
In this example, the collector provides the method's trigger and the trigger connection will have three categories of attributes as described above. In this case, neither the providing collector, nor the consuming method have any specific attributes and so the connection will only have the three common attributes described above; Timeout, Signature and Name.
The automatic connections between the consuming collector and the providing stores have a number of additional attributes. The 'A' store connection has three specific attributes. These are 'Access' (set to read), 'Key', and 'Rule'. The 'B' store has two; these are 'Access' (set to write) and 'Key' , which is over-rideable (see Transient Store Connections). The consuming collector has two specific attributes; 'Repeat Count' and 'connection label' (see Collector Connections). Both connections also have the three common attributes; Timeout, Signature and Name.
The translator will generate the following access functions;
Trigger_CClx1Cxn()
Once the method has executed, this function will return a reference to the collector connection. The connection can then be interrogated using its member functions (see Collector Connections). In practice, collector connections are seldom interrogated but the example below uses the collector event number, which increments each time an event is received, as a key for the store output.
Trigger_ATst1Cxn()
Once the method has executed, this function will return a reference to the 'A' store's read connection.
Trigger_BTst1Cxn()
Once the method has executed, this function will return a reference to the 'B' store's write connection.
The following code calculates the output record data from the input record, and sets a key to an incrementing value;
Uns key;
key = Trigger_CClx1().EventNum(); // Set key to the received event number
Trigger_BTst1Cxn().Record().Construct( key ); // Create output record, and over-ride write key
// Calculate output from input
Process( Trigger_ATst1Rec(), // Input data
Trigger_BTst1Rec() ); // Output data
The right-hand example is very similar to the first, but uses the compound method object which is actually equivalent to the first case, but in this case the collector is implicit and does not therefore have an access function. In this instance the translator will generate the following access functions;
Trigger1_ATst1Cxn()
Once the method has executed, this function will return a reference to the 'A' store's read connection.
Trigger2_BTst1Cxn()
Once the method has executed, this function will return a reference to the 'B' store's write connection.
The following code calculates the output record data from the input record, but in this case, does not 'key' the output.
Trigger2_BTst1Cxn().Construct(); // Create output record
// Calculate output from input
Process( Trigger1_ATst1Rec(), // Input data
Trigger2_BTst1Rec() ); // Output data