Home
Categories
Dictionary
Glossary
Download
Project Details
Changes Log
What Links Here
FAQ
License

tacticalRules data declaration



This article explains how to declare datas in the tacticalRules configuration:
  • For triggers conditions
  • For service actions

Using complex data types in triggers

You can use complex data types in triggers:
  • The dataStruct element declares that the data you specify is a structure and that you look for something inside this structure
  • The dataArray element declares that the data you specify is an array and that you look for something inside this array
When you declare one of these elements, you need to declare the path leading to the terminal element for which you will look for the value:
  • The field element declares a field in a structure
  • The index element declares an index in an array

Managing different levels of structuration

You can get an element as the level of structuration you need. For example with the following service declaration:
      <event name="trigger">
         <data name="boolData" type="bool" />
         <data name="structData" type="struct" />
      </event>
and the following types declaration:
      <types>
         <simpleType name="bool" baseType="boolean" />
         <simpleType name="int" baseType="int" />
         <structType name="struct">
            <field name="structField" type="struct2" />
            <field name="boolField" type="bool" />
         </structType>
         <structType name="struct2">
            <field name="intField" type="int" />
            <field name="boolField" type="bool" />
         </structType>
      </types>
The following example checks the value of the intField field in the structField field in the structData data:
      <rules>
         <rule>
            <trigger name="trigger">
               <dataStruct name="structData">
                  <field name="structField">
                     <field name="intField" value="2" >
                  </field>
               </dataStruct>
            </trigger>
            <service name="triggeredEvent">
               <data name="boolData" value="true" />
            </service>
         </rule>
      </rules>

Examples

The following example will trigger the triggeredEvent service if the structData structure in the trigger service has the value 2 for its field named intField:
      <rules>
         <rule>
            <trigger name="trigger">
               <dataStruct name="structData">
                  <field name="intField" value="2" />
               </dataStruct>
            </trigger>
            <service name="triggeredEvent">
               <data name="boolData" value="true" />
            </service>
         </rule>
      </rules>
The following example will trigger the triggeredEvent service if the structData structure in the trigger service has the value 2 for its field named intField, and the value true for its field named boolField:
      <rules>
         <rule>
            <trigger name="trigger">
               <dataStruct name="structData">
                  <field name="intField" value="2" />
                  <field name="boolField" value="true" />
               </dataStruct>
            </trigger>
            <service name="triggeredEvent">
               <data name="boolData" value="true" />
            </service>
         </rule>
      </rules>

Using complex data types in service actions

You can use complex data types in service actions datas:
  • The dataStruct element declares that the data you specify is a structure and that you look for something inside this structure
  • The dataArray element declares that the data you specify is an array and that you look for something inside this array
When you declare one of these elements, you need to declare the path leading to the terminal element for which you will look for the value:
  • The field element declares a field in a structure
  • The index element declares an index in an array

Managing different levels of structuration

You can set an element as the level of structuration you need, exactly as for the triggers declaration. For example:

      <rules>
         <rule>
            <trigger name="trigger">
               <data name="boolData" value="true" />
            </trigger>
            <service name="triggeredEvent">
                  <field name="structField">
                    <field name="boolField" value="true" />
                  </field>
            </service>
         </rule>
      </rules>

Examples

The following example will:
  • Trigger the triggeredEvent service with the value 10 for its field named intField of its structure named structData
  • If the structData structure in the trigger service has the value 2 for its field named intField
      <rules>
         <rule>
            <trigger name="trigger">
               <dataStruct name="structData">
                  <field name="intField" value="2" />
               </dataStruct>
            </trigger>
            <service name="triggeredEvent">
               <dataStruct name="structData">
                  <field name="intField" value="10" />
               </dataStruct>         
            </service>
         </rule>
      </rules>
The following example will:
  • Trigger the triggeredEvent service with the value 10 for its field named intField and the value true for its field named boolField of its structure named structData
  • If the structData structure in the trigger service has the value 2 for its field named intField
      <rules>
         <rule>
            <trigger name="trigger">
               <dataStruct name="structData">
                  <field name="intField" value="2" />
               </dataStruct>
            </trigger>
            <service name="triggeredEvent">
               <dataStruct name="structData">
                  <field name="intField" value="10" />
                  <field name="boolField" value="true" />
               </dataStruct>         
            </service>
         </rule>
      </rules>

See also


Categories: builtin-applis

Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence