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

Data types configuration



Grammar

See the grammar for the types schema.

Name

The name of the types must be unique for all types in the parent application:
  • The name must have the following pattern: [A-Za-z_][A-Za-z_0-9]*
  • The name must be different from "nil" ( nil is a reserved name for the nil type)


For example:
      <type name="bool">
      <type name="position">

Abstract types

Main Article: Abstract types

structure types or union types have an optional isAbstract attribute which specifies if the type is abstract, meaning that it can not be directly used in a Data or a structure field.

For example:
      <types>
         <simpleType name="int" baseType="int" />
         <simpleType name="float" baseType="float" />
         <structType name="abstractPosition" isAbstract="true">
            <field name="latitude" type="float" />
            <field name="lontitude" type="float" />
         </structType>
         <structType name="Position2Element" >
            <extends name="abstractPosition" />
            <field name="elementID" type="int" />
         </structType>
      </types>

Using namespaces

Main Article: Namespace

To avoid names clashes, it is possible to define namespaces for types, as it is also possible for services. To define a namespace, you just have to declare the namespace element as a parent of the types declaration[1]
Of course, you can define more than one namespace in a types XML file
. For example:
      <types>
        <namespace uri="http://mydomain.com/common" >
          <type name="bool">
          <type name="position">
        </namespace>
      </services>

Examples

A simple example

      <types>
         <simpleType name="bool" baseType="boolean" />
         <simpleType name="int" baseType="int" />   
         <enumType name="intEnum" >  
            <enumValue name="ONE" />
            <enumValue name="TWO" />       
         </enumType>  
         <arrayType name="arrayOfInt" type="int" />  
         <structType name="struct">
            <field name="intArray" type="arrayOfInt" />
            <field name="enum" type="intEnum" />   
            <field name="int" type="int" />      
         </structType>      
      </types>

A more complex example

      <types>
         <simpleType name="bool" baseType="boolean" />
         <simpleType name="bool2" baseType="boolean" />
         <simpleType name="int" baseType="int" />
         <simpleType name="int2" baseType="int" />  
         <enumType name="intEnum" >  
            <enumValue name="ONE" />
            <enumValue name="TWO" />       
         </enumType>  
         <enumType name="intEnum2" >  
            <enumValue name="ONE" />
            <enumValue name="THREE" />       
         </enumType>      
         <enumType name="intEnum3" >  
            <enumValue name="ONE" />
            <enumValue name="TWO" /> 
            <enumValue name="THREE" />       
         </enumType>         
         <arrayType name="arrayOfInt" type="int" />
         <arrayType name="arrayOfInt2" type="int" />
         <arrayType name="arrayOfBool" type="bool" />    
         <structType name="struct">
            <field name="intArray" type="arrayOfInt" />
            <field name="enum" type="intEnum" />   
            <field name="int" type="int" />      
         </structType>      
         <structType name="struct2">
            <field name="intArray" type="arrayOfInt2" />
            <field name="enum" type="intEnum" />   
            <field name="int" type="int" />      
         </structType>          
         <structType name="struct3">
            <field name="enum" type="intEnum" />   
            <field name="int" type="int" />      
            <field name="intArray" type="arrayOfInt" />       
         </structType>          
      </types>
In this example:
  • "bool" and "bool2" are equivalent
  • "int" and "int2" are equivalent
  • "arrayOfInt" and "arrayOfInt2" are equivalent
  • "struct" and "struct2" are equivalent
  • "intEnum" and "intEnum2" are equivalent
  • "intEnum" and "int" are not equivalent, but "intEnum" datas can be cast to "int" datas
  • "intEnum" and "intEnum3" are not equivalent
  • "arrayOfInt" and "arrayOfBool" are not equivalent
  • "struct" and "struct3" are not equivalent

An example with Maps

      <types>
         <simpleType name="int" desc="the base int type" baseType="int" />
         <simpleType name="string" baseType="string" />
         <mapType name="map" keyType="string" valueType="int" />
         <structType name="struct">
            <field name="mapField" desc="a Map field" type="map" />
            <field name="enum" type="intEnum" />
            <field name="int" type="int" />
         </structType>
      </types>
In this example, the "map" type specifies a Map where:
  • The keys are string elements
  • The values are int elements

Notes

  1. ^ Of course, you can define more than one namespace in a types XML file

See also


Categories: config

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