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

Anonymous types


    1  Usage
    2  Example
    3  Notes
    4  See also

Normally types are specified in the types configuration file. However types used in datas can be defined directly under the datas which use them. Note that anonymous types are still present in the Map of types for the framework, but their names are created automatically[1]
Their name is constructed with the following pattern:$anonType$_<index>
.

Note that these types are defined locally to the data which use them and can not be referred in other datas or types.

Usage

Defining anonymous types is never mandatory, but can be useful if a type is only used for a specific Data. For example when using the union pattern for GUIs, it can be more interesting to specify the type of the union directly under the Data. For example:
      <services>
         <event name="guiEvent" >
            <data name="event">
              <unionType variant="int" >
                <member name="button1" type="nil" />
                <member name="button2" type="nil" />
                <member name="toggle1" type="bool" />
                <member name="toggle2" type="bool" />
              </structType>
            </data>
         </event>
      </services>

Example

      <publish name="service1" >
         <data name="data1">
            <simpleType baseType="int" />
         </data>
         <data name="data2">
            <xmlType />
         </data>
         <data name="data3">
            <simpleType baseType="string" />
         </data>
         <data name="data4">
            <enumType>
               <enumValue name="ONE" />
               <enumValue name="TWO" />
            </enumType>
         </data>
         <data name="data5">
            <unionType>
               <variant>
                  <enumType>
                     <enumValue name="FIRST" />
                     <enumValue name="SECOND" />
                  </enumType>
               </variant>
               <member name="member1" type="int" />
               <member name="member2" type="string" />
            </unionType>
         </data>
         <data name="data6">
            <structType>
               <field name="field1" type="int" />
               <field name="field2" type="string" />
            </structType>
         </data>
      </publish>

Notes

  1. ^ Their name is constructed with the following pattern:$anonType$_<index>

See also


Categories: concepts

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