<?xml version="1.0" encoding="UTF-8"?>

<types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://www.omg.org/spec/DDS-XML"
    xsi:schemaLocation="http://www.omg.org/spec/DDS-XML https://www.omg.org/spec/DDS-XML/20260301/dds-xml_type_definitions.xsd">

    <!-- Forward Declarations -->
    <forward_dcl name="PlainEnum" kind="enum" />
    <forward_dcl name="PlainBitmask" kind="bitmask" />
    <forward_dcl name="PlainBitset" kind="bitset" />
    <forward_dcl name="PlainStruct" kind="struct" />
    <forward_dcl name="PlainUnion" kind="union" />
    <forward_dcl name="PlainException" kind="exception" />
    <forward_dcl name="PlainInterface" kind="interface" />

    <!-- Enums and Constants -->
    <enum name="PlainEnum">
        <enumerator name="ACE" />
        <enumerator name="KING" />
        <enumerator name="QUEEN" />
    </enum>

    <const name="INT_CONSTANT" type="int32" value="32" />
    <const name="INT_CONSTANT2" type="int32" value="2" />
    <const name="INT16_CONSTANT11" type="int16" value="11" />
    <const name="INT16_CONSTANT12" type="int16" value="12" />
    <const name="FLOAT_CONSTANT" type="float32" value="3.14" />
    <const name="STRING_CONSTANT" type="string" value="Hello" />

    <!-- Resolving a string value with a constant is done ahead of a literal string -->
    <const name="STRING_CONSTANT2" type="string" value="STRING_CONSTANT" />
    <const name="STRING_CONSTANT3" type="string" value="::STRING_CONSTANT" />

    <!-- If the literal string is desired it an be escaped -->
    <const name="STRING_CONSTANT4" type="string" value="&quot;STRING_CONSTANT&quot;" />

    <!-- Enum literals can be used to initilize constant integer values -->
    <const name="ENUM_CONSTANT" type="nonBasic" nonBasicTypeName="PlainEnum"
        value="KING" />
    <const name="ENUM_CONSTANT2" type="nonBasic" nonBasicTypeName="::PlainEnum"
        value="::KING" />

    <!-- Enums and Constants with builtin annotations -->
    <const name="SPEED_OF_LIGHT" type="float32" value="299792.458" unit="Km/s" />
    <const name="ABSOLUTE_ZERO_TEMPERATURE" type="float32" value="-273.15" unit="Celsius" />
    <const name="MAX_DEGREES" type="int32" value="360" unit="Degrees" />

    <enum name="emumWithBuiltinAnnotations" bitBound="16" ignoreLiteralNames="true" extensibility="final">
        <enumerator name="ACE" value="1" />
        <enumerator name="KING" value="12" defaultLiteral="true" />
        <enumerator name="QUEEN" value="INT16_CONSTANT11" />
        <enumerator name="KNIGHT" value="::INT16_CONSTANT12" />
    </enum>

    <!-- Bitmasks -->
    <bitmask name="PlainBitmask">
        <flag name="flg1" />
        <flag name="flg2" />
    </bitmask>

    <!-- Bitmasks with builtin annotations -->
    <bitmask name="PlainBitmask2" bitBound="64" extensibility="final">
        <flag name="flg1" />
        <flag name="flg2" position="2" />
        <flag name="flg3" position="INT_CONSTANT2" />
        <flag name="flg4" position="::INT_CONSTANT11" />
        <flag name="flg5" position="63" />
    </bitmask>


    <!-- Bitset -->
    <bitset name="PlainBitset">
        <bitfield name="bf1" bitSize="1" />
        <bitfield name="bf1" bitSize="INT_CONSTANT2" />
        <bitfield name="bf3" bitSize="::INT_CONSTANT2" />
        <bitpadding bitSize="5" />
        <bitpadding bitSize="INT_CONSTANT2" />
        <bitpadding bitSize="::INT_CONSTANT2" />
        <bitfield name="bf4" bitSize="1" />
    </bitset>

    <bitset name="DerivedBitset" baseType="PlainBitset">
        <bitfield name="bf5" bitSize="1" />
    </bitset>

    <!-- Bitset with builtin annotations -->
    <bitset name="BitsetWithAnnotations">
        <bitfield name="bf1" bitSize="16" />
        <bitfield name="bf2" bitSize="INT_CONSTANT2" holdingType="auto" />
        <bitfield name="bf3" bitSize="::INT_CONSTANT2" holdingType="int16" />
        <bitpadding bitSize="5" />
        <bitfield name="bf4" bitSize="1" holdingType="boolean" />
    </bitset>

    <!-- Aliases -->
    <typedef name="aBoolAlias" type="boolean" />
    <typedef name="anOctetAlias" type="byte" />
    <typedef name="aCharAlias" type="char8" />
    <typedef name="aWCharAlias" type="char16" />
    <typedef name="anInt8Alias" type="int8" />
    <typedef name="anUInt8Alias" type="uint8" />
    <typedef name="anInt16Alias" type="int16" />
    <typedef name="anUInt16Alias" type="uint16" />
    <typedef name="anInt32Alias" type="int32" />
    <typedef name="anUInt32Alias" type="uint32" />
    <typedef name="anInt64Alias" type="int64" />
    <typedef name="anUInt64Alias" type="uint64" />
    <typedef name="aFloat32Alias" type="float32" />
    <typedef name="aFloat64Alias" type="float64" />

    <typedef name="SequenceAlias" type="int32"
        sequenceMaxLength="32" />
    <typedef name="SequenceAlias2" type="int32"
        sequenceMaxLength="INT_CONSTANT" />
    <typedef name="ArrayAlias" type="int32"
        arrayDimensions=" 2, 3, 5 " />
    <typedef name="ArrayAlias2" type="int32"
        arrayDimensions=" INT_CONSTANT, 3, ::INT_CONSTANT2" />
    <typedef name="StringAlias" type="string"
        stringMaxLength="32" />
    <typedef name="StringSeqAlias" type="string" stringMaxLength="32"
        sequenceMaxLength="32" />
    <typedef name="StringSeqAlias2" type="string" stringMaxLength="INT_CONSTANT"
        sequenceMaxLength="::INT_CONSTANT" />
    <typedef name="ComplexAlias" type="nonBasic" nonBasicTypeName="PlainEnum" />
    <typedef name="ComplexAliasSequence" type="nonBasic" nonBasicTypeName="::PlainEnum"
        sequenceMaxLength="32" />
    <typedef name="MapAlias" type="string"
        mapKeyType="string" mapKeyStringMaxLength="32" />
    <typedef name="MapAlias2" type="string"
        mapKeyType="nonBasic" mapKeyNonBasicTypeName="anIntAlias" />
    <typedef name="ComplexMapAlias" type="nonBasic" nonBasicTypeName="PlainEnum"
        mapKeyType="uint32" />

    <!-- Aliases with builtin Annotations -->
    <typedef name="Angle" type="int32" min="0" max="MAX_DEGREES" unit="Degrees" />
    <typedef name="Temperature" type="float32" min="::ABSOLUTE_ZERO_TEMPERATURE" max="10000000"
        unit="Celsius" default="100" external="true" />
    <!-- Use -1 as length to indicated an unbounded sequence -->
    <typedef name="SequenceWithExternalElement" type="float32" sequenceMaxLength="-1"
        externalElement="true" />

    <!-- Structures -->
    <struct name="PlainStruct">
        <member name="aString" type="string" stringMaxLength="INT_CONSTANT" />
        <member name="aString2" type="string" stringMaxLength="::INT_CONSTANT" />
        <member name="aOneByteInt" type="int8" />
        <member name="aShort" type="int16" />
        <member name="aLong" type="int32" />
        <member name="aBoolean" type="boolean" />
        <member name="aUnsignedShort" type="uint16" />
        <member name="aUnsignedLong" type="uint32" />
        <member name="aFloat" type="float32" />
        <member name="aDouble" type="float64" />
        <member name="aChar" type="char8" />
        <member name="aWchar" type="char16" />
        <member name="aLongLong" type="int64" />
        <member name="aUnsignedLongLong" type="uint64" />
    </struct>

    <struct name="DerivedStruct" baseType="PlainStruct">
        <member name="anotherBooleanMember" type="boolean" />
    </struct>

    <struct name="StructWithComplexMembers">
        <member name="anAliasComplexStruct" type="nonBasic"
            nonBasicTypeName="PlainTypedef2" />

        <member name="anEnum" type="nonBasic" nonBasicTypeName="PlainEnum" />

        <member name="anEnumSeq" type="nonBasic" nonBasicTypeName="PlainEnum"
            sequenceMaxLength="3" />

        <member name="anEnumArr" type="nonBasic" nonBasicTypeName="PlainEnum"
            arrayDimensions="3,4" />

        <member name="aMap" type="nonBasic" nonBasicTypeName="PlainEnum"
            mapKeyType="int32" mapMaxLength="INT32_CONST" />

        <member name="aMap2" type="nonBasic" nonBasicTypeName="PlainEnum"
            mapKeyType="string" mapKeyStringMaxLength="32" mapMaxLength="1000" />

        <member name="aMap2" type="nonBasic" nonBasicTypeName="PlainEnum"
            mapKeyType="nonBasic" mapKeyNonBasicTypeName="anIntAlias" mapMaxLength="1000" />

        <member name="aComplexType" type="nonBasic" nonBasicTypeName="PlainStruct1" />
        <member name="aComplexSequenceType" type="nonBasic" nonBasicTypeName="PlainStruct1"
            sequenceMaxLength="32" />
    </struct>

    <!-- Structures with builtin annotations -->
    <struct name="StructWithBuiltinAnnotations"
        nested="false" extensibility="mutable" autoid="hash"
        data_representation="xcdr2"
        topic="MyTopic1/slash.dot-hyphen_underscore and space allowed">

        <member type="int64" name="aMemberWithId1" id="33" />
        <member type="int64" name="aMemberWithId2" id="INT_CONSTANT" />
        <member type="int64" name="aMemberWithId3" id="::INT_CONSTANT2" />

        <member type="int64" name="aMemberWithHashId1" hashid="oldMemberName" />
        <member type="int64" name="aMemberWithHashId2" hashid="STR_CONSTANT" />
        <member type="int64" name="aMemberWithHashId3" hashid="::STR_CONSTANT2" />
        <member type="int64" name="aMemberWithHashId4" hashid="&quot;STR_CONSTANT2&quot;" />

        <member type="int64" name="aMemberWithDefaultHashId" hashid="" />
        <member type="int64" name="aMemberWithMustUndertand" mustUnderstand="true" />
        <member type="int64" name="aMemberWithOptional" optional="true" />
        <member type="int64" name="aMemberWithExternal" external="true" />
        <member type="float32" name="aSequenceMemberWithExernal" sequenceMaxLength="100"
            external="true" />
        <member type="float32" name="aArrayMemberWithExernal" arrayDimensions="10"
            external="true" />
        <member type="float32" name="aMapMemberWithExernal" mapKeyType="int32"
            external="true" />
        <member type="float32" name="aSequenceWithExernalElement" sequenceMaxLength="100"
            externalElement="true" />
        <member type="float32" name="aArrayMemberWithExernalElement" arrayDimensions="10"
            externalElement="true" />
        <member type="float32" name="aMapMemberWithExernalElement" mapKeyType="int32"
            externalElement="true" />

        <member type="int64" name="aMemberWithDefaultValue1" default="1014" />
        <member type="int64" name="aMemberWithDefaultValue2" default="INT_CONSTANT" />
        <member type="int64" name="aMemberWithDefaultValue3" default="::INT_CONSTANT2" />

        <member type="int32" name="aMemberWithTryConstruct" sequenceMaxLength="100"
            tryConstruct="trim" />
        <member type="int64" name="aMemberWithNonSeriaized" nonSerialized="true" />

        <member type="int64" name="aMemberWithMinValue1" min="1014" />
        <member type="int64" name="aMemberWithMaxValue2" max="INT_CONSTANT" />
        <member type="int64" name="aMemberWithMaxValue3" max="::INT_CONSTANT2" />

        <member type="float32" name="aMemberWithUnit" unit="m" />
    </struct>

    <!-- Unions -->
    <union name="PlainUnion">
        <discriminator type="boolean" />
        <case>
            <caseDiscriminator value="2" />
            <member type="boolean" name="unionValue1" optional="true" />
        </case>
        <case>
            <caseDiscriminator value="INT_CONST" />
            <caseDiscriminator value="::INT_CONST2" />
            <member type="float64" name="unionValue2" unit="m" />
        </case>
        <defaultCase>
            <member type="int32" name="unionValueDefault" />
        </defaultCase>
    </union>

    <union name="KeyedUnion">
        <discriminator type="int32" key="true" />
        <case>
            <caseDiscriminator value="42" />
            <member type="boolean" name="unionValue1" />
        </case>
        <case>
            <caseDiscriminator value="34" />
            <caseDiscriminator value="35" />
            <member type="float64" name="unionValue2" />
        </case>
        <defaultCase>
            <member type="int32" name="unionValueDefault" />
        </defaultCase>
    </union>

    <union name="DerivedUnion">
        <baseUnion type="PlainUnion" />
        <case>
            <caseDiscriminator value="37" />
            <member type="boolean" name="anotherValue" />
        </case>
    </union>

    <!-- Unions with builtin Annotations -->
    <union name="UnionWithBuiltinAnnotations"
        nested="false" extensibility="mutable" autoid="hash"
        data_representation="xcdr2"
        topic="MyTopicName/slash.dot-hyphen_underscore and space allowed">

        <discriminator type="int32" key="true" default="10" min="0" max="100" tryConstruct="use_default"/>

        <case>
            <caseDiscriminator value="1" />
            <member type="int64" name="aMemberWithId" id="33" />
        </case>
        <case>
            <caseDiscriminator value="2" />
            <member type="int64" name="aMemberWithHashId" hashid="oldMemberName" />
        </case>

        <case>
            <caseDiscriminator value="10" />
            <member type="int32" name="anOptionalMember" optional="true" />
        </case>
        <case>
            <caseDiscriminator value="20" />
            <member type="int32" name="aTrimMember" sequenceMaxLength="20" tryConstruct="trim" />
        </case>
        <case>
            <caseDiscriminator value="30" />
            <member type="int32" name="aMemberWithRange" min="0" max="100" />
        </case>
        <case>
            <caseDiscriminator value="31" />
            <member type="int32" name="aMemberWithUnits" unit="meter" />
        </case>
        <case>
            <caseDiscriminator value="40" />
            <caseDiscriminator value="50" />
            <member type="float64" name="aNonSerializedMember" nonSerialized="true" />
        </case>
        <case>
            <caseDiscriminator value="60" />
            <member type="float64" name="anExternalMember" external="true" />
        </case>
        <case>
            <caseDiscriminator value="70" />
            <member type="float64" name="aMemberWithDefaultValue" default="3.14" />
        </case>
        <case>
            <caseDiscriminator value="71" />
            <member type="float64" name="aMemberWithDefaultValue2" default="FLOAT_CONSTANT" />
        </case>
        <defaultCase>
            <member type="int32" name="unionValueDefault" default="1234" />
        </defaultCase>
    </union>

    <!-- Use of module level annotations results in the enclosed types
         to default to being nested, use hash member IDs and use xcdr2 
    -->
    <module name="ModuleAnnotations"
        autoid="hash"
        defaultNested="true"
        data_representation="xcdr2">

        <struct name="MyStruct">
            <member type="int64" name="aMemberWithId" id="33" />
        </struct>
    </module>

    <!-- Use of module level annotations results in the enclosed types
         to default to using sequential member IDs and mutable extensibility.
         Enclosed unions default to use hash member IDs.
    -->
    <module name="ModuleAnnotations2"
        autoid="sequential"
        extensibility="mutable"
        union_autoid="hash"
        union_autoid_selection="all_unions">

        <!-- Use of union_autoid in the module causes member IDs
            to be assigned using a hash function -->
        <union name="MyUnion">
            <discriminator type="int8" />
            <case>
                <caseDiscriminator value="37" />
                <member type="boolean" name="aValue" />
            </case>
            <case>
                <caseDiscriminator value="38" />
                <member type="boolean" name="anotherValue" />
            </case>
        </union>
    </module>

    <!-- Exceptions -->
    <exception name="PlainException" />

    <exception name="PlainException2">
        <member name="aBoolMember" type="boolean" />
        <member name="aCharMember" type="char8" />
        <member name="anIntMember" type="int32" />
        <member name="aFloatMember" type="float32" />
        <member name="aStringMember" type="string" stringMaxLength="32" />
        <member name="aSequenceMember" type="int32" sequenceMaxLength="32" />
        <member name="anArrayMember" type="int32" arrayDimensions="32, 4" />
        <member name="aMapMember" type="int32" mapMaxLength="32"
            mapKeyType="string" mapKeyStringMaxLength="32" />
        <member name="aComplexMember" type="nonBasic"
            nonBasicTypeName="PlainStruct2" />
        <member name="aComplexMemberSequence" type="nonBasic" nonBasicTypeName="PlainStruct2"
            sequenceMaxLength="32" />
    </exception>

    <exception name="DerivedException" baseType="PlainException">
        <member name="level" type="float32" />
    </exception>

    <!-- Exceptions don't have builtin Annotations -->

    <!-- Interfaces -->
    <interface name="PlainInterface">
        <const name="MAX_SPEED" type="float32" value="32" />
        <operation name="pause" />
        <operation name="resume" />
        <operation name="set_speed">
            <raises>
                <exception_ref exceptionType="PlainException" />
            </raises>
            <arguments>
                <argument name="item_identfier" type="int32" direction="in" />
                <argument name="speed" type="float32" direction="inout" />
                <argument name="estimated_delay" type="float32" direction="out" />
            </arguments>
        </operation>
        <operation name="get_speed">
            <return type="float32" />
            <arguments>
                <argument name="item_identfier" type="int32" />
            </arguments>
        </operation>
    </interface>

    <!-- Interfaces -->

    <interface name="InterfaceWithBuiltinAnnotations" extensibility="mutable"
        service="DDS">
        <const name="MAX_SPEED" type="float32" value="32" unit="m/s" />
        <operation name="pause" />
        <operation name="resume" />
        <operation name="set_speed">
            <raises>
                <exception_ref exceptionType="PlainException" />
            </raises>
            <arguments>
                <argument name="item_identfier" type="int32" />
                <argument name="speed" type="float32"
                    unit="m/s" max="MAX_SPEED" />
            </arguments>
        </operation>
        <operation name="get_speed">
            <return type="float32" unit="m/s" max="MAX_SPEED" />
            <arguments>
                <argument name="item_identfier" type="int32" />
            </arguments>
        </operation>
    </interface>

    <!-- =============================================== -->
    <!-- Documentation, Verbatim, License, and Custom Annotations -->

    <!-- Annotation declatations -->
    <annotation name="SimpleAnnotation" />

    <annotation name="AnnotationWithParams">
        <parameter name="intParam" type="int32" default="32" />
        <parameter name="strParam" type="string" />
        <parameter name="aliasParam" type="nonBasic" nonBasicTypeName="anIntAlias" />
    </annotation>

    <annotation name="DocumentedAnnotation">
        <doc>Documentation on the type</doc>
        <parameter name="intParam" type="int32" default="32">
            <doc>Documentation on the parameter</doc>
        </parameter>
    </annotation>

    <!-- License Definitions -->
    <license_type name="APACHE-2.0" link="https://spdx.org/licenses/Apache-2.0.html" />
    <license_type name="MIT" link="https://spdx.org/licenses/MIT.html" />

    <module name="OMG">
        <license_type name="RAND" link="https://www.omg.org/cgi-bin/doc?ipr/12-09-02.pdf" />
        <license_use name="RAND.ALMAS" license_type="OMG::RAND"
            link="https://www.omg.org/spec/ALMAS" />
    </module>

    <license_use name="APACHE2.MYPACKAGE" license_type="APACHE-2.0"
        link="https://my.gitrepo.com/myPackge/myLicense.txt" />
    <license_use name="RAND.OARIS" license_type="OMG::RAND" link="https://www.omg.org/spec/OARIS" />

    <!-- Constants -->
    <const name="DOCUMENTED_CONSTANT1" type="int32" value="255" license="APACHE2.MYPACKAGE">
        <annotations>
            <doc>Description of the constant</doc>
            <verbatim language="C++" placement="before-declaration">
                // Put this in the C++ code
            </verbatim>
            <custom annotation_ref="SimpleAnnotation" />
        </annotations>
    </const>

    <const name="DOCUMENTED_CONSTANT3" type="float32" value="3.1416" unit="meter"
        license="::APACHE2.MYPACKAGE">
        <annotations>
            <doc format="html">
            <![CDATA[ 
            <h1>Constant description Heading</h1>
            <p>Bullet points:</p>
            <ul>
                <li>First bullet point</li>
                <li>Second bullet point</li>
                <li>Third bullet point</li>
            </ul>
            ]]>
            </doc>
            <custom annotation_ref="ComplexAnnotation">
                <parameter name="strParam" value="Hello" />
            </custom>
        </annotations>
    </const>

    <const name="ANNOTATED_CONSTANT" type="float32" value="3.1416" unit="meter"
        license="OMG::RAND.OARIS">
        <annotations>
            <doc>Description of the constant</doc>
            <custom annotation_ref="SimpleAnnotation" />
            <custom annotation_ref="AnnotationWithParams">
                <parameter name="intParam" value="55" />
                <parameter name="strParam" value="Hello World" />
                <parameter name="aliasParam" value="INT_CONSTANT" />
            </custom>
            <verbatim language="C++" placement="before-declaration">
                // Put this in the C++ code
            </verbatim>
        </annotations>
    </const>

    <!-- Enumerations -->
    <enum name="AnnotatedEnum" bitBound="16" license="::OMG::RAND.OARIS">
        <annotations>
            <doc>Documentation on the type</doc>
            <doc format="markdown">
                # Documentation on the type
                - First bullet point
                - Second bullet point
            </doc>
            <doc format="html">
                <![CDATA[ 
                <h1>Constant description Heading</h1>
                <p>Bullet points:</p>
                <ul>
                    <li>First bullet point</li>
                    <li>Second bullet point</li>
                    <li>Third bullet point</li>
                </ul>
                ]]>
            </doc>
            <custom annotation_ref="SimpleAnnotation" />
            <custom annotation_ref="AnnotationWithParams">
                <parameter name="intParam" value="32" />
                <parameter name="strParam" value="Hello" />
            </custom>
            <verbatim language="C++" placement="before-declaration">
                // Put this in the C++ code
            </verbatim>
        </annotations>
        <enumerator name="ACE" value="1" />
        <enumerator name="KING" value="13" />
        <enumerator name="QUEEN" value="12">
            <annotations>
                <doc>Documentation on the enumerator</doc>
                <custom annotation_ref="SimpleAnnotation" />
                <custom annotation_ref="AnnotationWithParams">
                    <parameter name="intParam" value="32" />
                    <parameter name="strParam" value="Hello" />
                </custom>
                <verbatim language="C++" placement="before-declaration">
                    // Put this in the C++ code
                </verbatim>
            </annotations>
        </enumerator>
    </enum>

    <!-- Bitmasks -->
    <bitmask name="AnnotatedBitmsak" bitBound="16" license="APACHE2.MYPACKAGE">
        <annotations>
            <doc>Documentation on the type</doc>
            <custom annotation_ref="SimpleAnnotation" />
            <custom annotation_ref="AnnotationWithParams">
                <parameter name="intParam" value="32" />
                <parameter name="strParam" value="Hello" />
            </custom>
            <verbatim language="C++" placement="before-declaration">
                // Put this in the C++ code
            </verbatim>
        </annotations>

        <flag name="flg3" position="3">
            <annotations>
                <doc>Documentation on the flag</doc>
                <custom annotation_ref="SimpleAnnotation" />
                <custom annotation_ref="ComplexAnnotation">
                    <parameter name="intParam" value="32" />
                    <parameter name="strParam" value="Hello" />
                </custom>
                <verbatim language="C++" placement="before-declaration">
                    // Put this in the C++ code
                </verbatim>
            </annotations>
        </flag>
    </bitmask>


    <!-- Bitset -->
    <bitset name="AnnotatedBitset" license="APACHE2.MYPACKAGE">
        <annotations>
            <doc>Documentation on the type</doc>
            <custom annotation_ref="SimpleAnnotation" />
            <custom annotation_ref="ComplexAnnotation">
                <parameter name="intParam" value="32" />
                <parameter name="strParam" value="Hello" />
            </custom>
            <verbatim language="C++" placement="before-declaration">
                // Put this in the C++ code
            </verbatim>
        </annotations>

        <bitfield name="bf1" bitSize="6">
            <annotations>
                <doc>Documentation on the flag</doc>
                <custom annotation_ref="SimpleAnnotation" />
                <custom annotation_ref="ComplexAnnotation">
                    <parameter name="intParam" value="32" />
                    <parameter name="strParam" value="Hello" />
                </custom>
                <verbatim language="C++" placement="before-declaration">
                    // Put this in the C++ code
                </verbatim>
            </annotations>
        </bitfield>
    </bitset>

    <!-- Aliases -->
    <typedef name="AnnotatedTypedef" type="float32" license="APACHE2.MYPACKAGE">
        <annotations>
            <doc>Documentation on the type</doc>
            <custom annotation_ref="SimpleAnnotation" />
            <custom annotation_ref="ComplexAnnotation">
                <parameter name="intParam" value="32" />
                <parameter name="strParam" value="Hello" />
            </custom>
            <verbatim language="C++" placement="before-declaration">
                // Put this in the C++ code
            </verbatim>
        </annotations>
    </typedef>

    <!-- Structures -->
    <struct name="AnnotatedStruct" license="APACHE2.MYPACKAGE">
        <annotations>
            <doc>
                Some documentation
                Multiple lines are allowed
            </doc>
            <custom annotation_ref="Annotation1" />
            <doc format="markdown">More markdown documentation</doc>
            <doc format="html">HTML documentation</doc>
            <custom annotation_ref="SimpleAnnotation" />
            <custom annotation_ref="ComplexAnnotation">
                <parameter name="intParam" value="32" />
                <parameter name="strParam" value="Hello" />
            </custom>
            <verbatim language="C++">//This is  C++ comment</verbatim>
        </annotations>

        <member name="anInt" type="int32" id="33" key="true" />
        <member name="aFloat" type="float32" min="0" max="250" optional="true" unit="volt">
            <annotations>
                <doc format="plain">Member documentation</doc>
                <verbatim language="C++" placement="before-declaration">
                    // Put this comment
                    // In the C++ code
                </verbatim>
                <custom annotation_ref="SimpleAnnotation" />
                <custom annotation_ref="ComplexAnnotation">
                    <parameter name="intParam" value="32" />
                    <parameter name="strParam" value="Hello" />
                </custom>
            </annotations>
        </member>
    </struct>

    <!-- Unions -->
    <union name="AnnotatednUnion" license="APACHE2.MYPACKAGE">
        <annotations>
            <doc>Type documentation</doc>
            <custom annotation_ref="SimpleAnnotation" />
            <custom annotation_ref="ComplexAnnotation">
                <parameter name="intParam" value="32" />
                <parameter name="strParam" value="Hello" />
            </custom>
        </annotations>

        <discriminator type="nonBasic" nonBasicTypeName="PlainEnum" />
        <case>
            <caseDiscriminator value="ACE" />
            <member type="float64" name="unionValue1">
                <annotations>
                    <doc>Member Documentation</doc>
                    <custom annotation_ref="SimpleAnnotation" />
                    <custom annotation_ref="ComplexAnnotation">
                        <parameter name="intParam" value="32" />
                        <parameter name="strParam" value="Hello" />
                    </custom>
                </annotations>
            </member>
        </case>
        <case>
            <caseDiscriminator value="KING" />
            <member type="float64" name="unionValue2" />
        </case>
    </union>

    <!-- Exceptions -->
    <exception name="AnnotatedException" baseType="PlainException" license="APACHE2.MYPACKAGE">
        <annotations>
            <doc></doc>
            <custom annotation_ref="SimpleAnnotation" />
            <verbatim></verbatim>
        </annotations>
        <member name="hello" type="boolean">
            <annotations>
                <doc>Member documentation</doc>
            </annotations>
        </member>
        <member name="level" type="float32" />
        <member name="message" type="string" sequenceMaxLength="32" />
    </exception>

    <interface name="AnnotatedInterface" service="DDS" license="APACHE2.MYPACKAGE">
        <annotations>
            <doc>Interface documentation</doc>
            <custom annotation_ref="SimpleAnnotation" />
            <custom annotation_ref="ComplexAnnotation">
                <parameter name="intParam" value="32" />
                <parameter name="strParam" value="Hello" />
            </custom>
            <verbatim language="C++" placement="before-declaration">
                // Put this comment
                // In the C++ code
            </verbatim>
        </annotations>

        <operation name="my_operation1">
            <annotations>
                <doc>Operation documentation</doc>
                <custom annotation_ref="SimpleAnnotation" />
                <custom annotation_ref="ComplexAnnotation">
                    <parameter name="intParam" value="32" />
                    <parameter name="strParam" value="Hello" />
                </custom>
                <verbatim language="C++" placement="before-declaration">
                    // Put this comment
                    // In the C++ code
                </verbatim>
            </annotations>
        </operation>

        <operation name="my_operation2">
            <arguments>
                <argument name="argument1" type="float32">
                    <annotations>
                        <doc>Argument documentation</doc>
                        <custom annotation_ref="SimpleAnnotation" />
                        <custom annotation_ref="ComplexAnnotation">
                            <parameter name="intParam" value="32" />
                            <parameter name="strParam" value="Hello" />
                        </custom>
                        <verbatim language="C++" placement="before-declaration">
                            // Put this comment
                            // In the C++ code
                        </verbatim>
                    </annotations>
                </argument>
            </arguments>
        </operation>

        <operation name="another_operation">
            <!-- No <annotations> on raises, exception and return -->
            <raises>
                <exception_ref exceptionType="PlainException" />
            </raises>
            <return type="int64" />
        </operation>
    </interface>

    <!-- Modules -->
    <module name="Module1"
        autoid="hash" defaultNested="true">
        <annotations>
            <doc>Module documentation</doc>
            <custom annotation_ref="SimpleAnnotation" />
            <custom annotation_ref="ComplexAnnotation">
                <parameter name="intParam" value="32" />
                <parameter name="strParam" value="Hello" />
            </custom>
            <verbatim language="C++" placement="before-declaration">
                // Put this comment
                // In the C++ code
            </verbatim>
        </annotations>

        <include file="AnotherFile.xml" />

        <annotation name="aCustomAnnotation">
            <parameter name="intParam" type="int32" default="32" />
            <parameter name="strParam" type="string" />
            <parameter name="aliasParam" type="nonBasic" nonBasicTypeName="anIntAlias" />
        </annotation>

        <const name="M1_CONSTANT1" type="int32" value="100" />
        <const name="M1_CONSTANT2" type="int32" value="INT_CONSTANT" />
        <const name="M1_CONSTANT3" type="int32" value="::INT_CONSTANT" />
        <const name="M1_CONSTANT4" type="int32" value="M1_CONSTANT" />
        <const name="M1_CONSTANT5" type="int32" value="Module1::M1_CONSTANT" />
        <const name="M1_CONSTANT6" type="int32" value="::Module1::M1_CONSTANT" />

        <typedef name="m1_Alias1" type="boolean" />
        <typedef name="m1_Alias2" type="nonBasic" nonBasicTypeName="aBoolAlias" />
        <typedef name="m1_Alias3" type="nonBasic" nonBasicTypeName="::aBoolAlias" />
        <typedef name="m1_Alias4" type="nonBasic" nonBasicTypeName="m1_Alias1" />
        <typedef name="m1_Alias5" type="nonBasic" nonBasicTypeName="Module1::m1_Alias1" />
        <typedef name="m1_Alias6" type="nonBasic" nonBasicTypeName="::Module1::m1_Alias1" />
        <typedef name="m1_Alias7" type="nonBasic" nonBasicTypeName="::aBoolAlias" />


        <struct name="MyStruct">
            <member type="boolean" name="aMember" />
        </struct>

        <module name="Module1Nested1">
            <const name="M1_N1_CONSTANT1" type="int32" value="100" />
            <const name="M1_N1_CONSTANT2" type="int32" value="INT_CONSTANT1" />
            <const name="M1_N1_CONSTANT3" type="int32" value="::INT_CONSTANT1" />
            <const name="M1_N1_CONSTANT4" type="int32" value="M1_CONSTANT1" />
            <const name="M1_N1_CONSTANT5" type="int32" value="Module1::M1_CONSTANT" />
            <const name="M1_N1_CONSTANT6" type="int32" value="::Module1::M1_CONSTANT" />
            <const name="M1_N1_CONSTANT7" type="int32" value="M1_N1_CONSTANT" />
            <const name="M1_N1_CONSTANT8" type="int32" value="Module1Nested1::M1_N1_CONSTANT" />
            <const name="M1_N1_CONSTANT9" type="int32"
                value="Module1::Module1Nested1::M1_N1_CONSTANT" />
            <const name="M1_N1_CONSTANT10" type="int32"
                value="::Module1::Module1Nested1::M1_N1_CONSTANT" />


            <typedef name="m1_n1_Alias" type="boolean" />
            <typedef name="m1_n1_Alias2" type="nonBasic" nonBasicTypeName="aBoolAlias" />
            <typedef name="m1_n1_Alias3" type="nonBasic" nonBasicTypeName="::aBoolAlias" />
            <typedef name="m1_n1_Alias4" type="nonBasic" nonBasicTypeName="m1_Alias1" />
            <typedef name="m1_n1_Alias5" type="nonBasic" nonBasicTypeName="Module1::m1_Alias1" />
            <typedef name="m1_n1_Alias6" type="nonBasic" nonBasicTypeName="::Module1::m1_Alias1" />
            <typedef name="m1_n1_Alias7" type="nonBasic" nonBasicTypeName="m1_n1_Alias" />
            <typedef name="m1_n1_Alias8" type="nonBasic"
                nonBasicTypeName="Module1Nested1::m1_n1_Alias" />
            <typedef name="m1_n1_Alias9" type="nonBasic"
                nonBasicTypeName="Module1::Module1Nested1::m1_n1_Alias" />
            <typedef name="m1_n1_Alias10" type="nonBasic"
                nonBasicTypeName="::Module1::Module1Nested1::m1_n1_Alias" />

        </module>

        <const name="M1_CONSTANT7" type="int32" value="Module1Nested1::M1_N1_CONSTANT" />
        <const name="M1_CONSTANT8" type="int32" value="Module1::Module1Nested1::M1_N1_CONSTANT" />
        <const name="M1_CONSTANT9" type="int32" value="::Module1::Module1Nested1::M1_N1_CONSTANT" />

        <typedef name="m1_Alias7" type="nonBasic" nonBasicTypeName="Module1Nested1::m1_n1_Alias" />
        <typedef name="m1_Alias8" type="nonBasic"
            nonBasicTypeName="Module1::Module1Nested1::m1_n1_Alias" />
        <typedef name="m1_Alias9" type="nonBasic"
            nonBasicTypeName="::Module1::Module1Nested1::m1_n1_Alias" />

    </module>

    <!-- ============== -->
    <!-- HELLO EXAMPLE -->
    <!-- ============== -->
    <module name="HelloExample">
        <const name="HELLO_MAX_LEN" value="64" type="int32" />

        <struct name="HelloType">
            <member name="sender" key="true" type="string" stringMaxLength="HELLO_MAX_LEN" />
            <member name="greeting" type="string" stringMaxLength="HELLO_MAX_LEN" />
            <member name="count" type="int32" />
        </struct>
    </module>

    <module name="QueryExample">
        <!-- Log Query Service: RPC Style -->
        <interface name="LogQueryIf">
            <annotations>
                <doc>Get the most recent commands matching a pattern.</doc>
            </annotations>
            <operation name="get_log">
                <arguments>
                    <argument name="pattern" type="string" stringMaxLength="100" />
                    <argument name="maxMessages" type="int32" />
                </arguments>
                <return type="string" sequenceMaxLength="LENGTH_UNLIMITED" />
            </operation>
        </interface>

        <!-- Log Query Service: Request/Reply style -->
        <struct name="LogQueryRequest">
            <annotations>
                <doc>Get the most recent log messages matching a pattern.</doc>
            </annotations>
            <member name="pattern" type="string" stringMaxLength="100" />
            <member name="maxMessages" type="int32" />
        </struct>

        <struct name="LogQueryReply">
            <member name="messages" type="string" sequenceMaxLength="LENGTH_UNLIMITED" />
        </struct>
    </module>

    <!-- ============== -->
    <!-- SHAPES EXAMPLE -->
    <!-- ============== -->
    <module name="ShapesExample">

        <const name="COLOR_MAX_LEN" value="32"
            type="int32" />

        <struct name="ShapeType" extensibility="append">
            <member name="color" key="true"
                type="string" stringMaxLength="COLOR_MAX_LEN" />
            <member name="x"
                type="int32" />
            <member name="y"
                type="int32" />
            <member name="shapesize"
                type="int32" />
        </struct>

        <struct name="ShapeTypeExtended" baseType="ShapeType">
            <member name="angle" min="0" max="360" unit="degree"
                type="int32" />
        </struct>


        <const name="MIN_DELAY" type="float32" value="0.001" />
        <const name="MAX_SPEED" type="float32" value="32" unit="pixels/s" />
        <const name="MAX_POINTS" type="float32" value="100" />

        <struct name="Position">
            <member name="x" type="int32" />
            <member name="y" type="int32" />
        </struct>

        <struct name="Velocity">
            <member name="vx" type="float32" max="MAX_SPEED" unit="pixels/s" />
            <member name="vy" type="float32" max="MAX_SPEED" unit="pixels/s" />
        </struct>

        <!-- Shape Service: RPC Style -->
        <!-- ======================== -->

        <exception name="Rejected">
            <member name="reason" type="string" />
        </exception>
        <exception name="InvalidColor" />
        <exception name="OutOfBounds" />
        <exception name="TooFast" />

        <interface name="ControlIf" service="DDS">
            <annotations>
                <doc>Control the motion of shapes</doc>
            </annotations>
            <operation name="stop" />

            <operation name="start">
                <arguments>
                    <argument name="delay" unit="sec"
                        type="float32" />
                </arguments>
            </operation>

            <operation name="set_state" extensibility="mutable">
                <annotations>
                    <doc format="markdown">
                        Sets the position, direction, and speed of a shape 
                        identified by its color:    
                        - The shape will jump to the new position immediately 
                          and continue moving from there. 
                        - The position is the center of the shape.
                        - The velocity is the speed and direction of the shape.

                        *Returns*:
                        - `true`: If the shape was successfully updated.
                        - an exception if the shape could not be updated.

                        *Exceptions*:
                        - `InvalidColor`: The color is not currently being published.
                        - `OutOfBounds`: The position is out of bounds.
                        - `TooFast`: The speed is too fast.
                    </doc>
                </annotations>
                <raises>
                    <exception_ref exceptionType="InvalidColor" />
                    <exception_ref exceptionType="OutOfBounds" />
                    <exception_ref exceptionType="TooFast" />
                </raises>
                <arguments>
                    <argument name="color" type="string" stringMaxLength="COLOR_MAX_LEN" />
                    <argument name="position" type="nonBasic" nonBasicTypeName="Position" />
                    <argument name="velocity" type="nonBasic" nonBasicTypeName="Velocity" />
                </arguments>
                <return type="boolean" />
            </operation>
        </interface>

        <!-- Interface extended via inheritance -->
        <interface name="ControlExtendedIf" baseType="ControlIf">
            <annotations>
                <doc>Extends ControlIf adding method to stop a single shape.</doc>
            </annotations>
            <operation name="stop_single_shape">
                <arguments>
                    <argument name="color" type="string" mapKeyStringMaxLength="COLOR_MAX_LEN" />
                </arguments>
                <return type="boolean" />
            </operation>
        </interface>

        <interface name="ShapeQueryIf" service="DDS">
            <annotations>
                <doc>Query information about shapes</doc>
            </annotations>

            <operation name="get_path" extensibility="mutable">
                <annotations>
                    <doc format="markdown">
                        Gets the current path of a shape identified by its color.
                    </doc>
                </annotations>
                <arguments>
                    <argument name="color" type="string" stringMaxLength="COLOR_MAX_LEN" />
                    <argument name="max_points" type="int32" />
                </arguments>
                <return type="nonBasic" nonBasicTypeName="Position" sequenceMaxLength="MAX_POINTS" />
            </operation>
        </interface>

        <!-- ShapeCommand Service: Request/Reply style -->
        <!-- ========================================= -->

        <struct name="StopRequest" />
        <struct name="StopReply" />

        <struct name="StartRequest">
            <member name="delay" min="MIN_DELAY"
                type="float32" />
        </struct>
        <struct name="StartReply" />

        <struct name="SetStateRequest" extensibility="mutable">
            <annotations>
                <doc format="markdown">
                    Sets the position, direction, and speed of a shape 
                    identified by its color:    
                    - The shape will jump to the new position immediately 
                        and continue moving from there. 
                    - The position is the center of the shape.
                    - The velocity is the speed and direction of the shape.

                    *Returns*:
                    - `true`: If the shape was successfully updated.
                    - an exception if the shape could not be updated.

                    *Exceptions*:
                    - `InvalidColor`: The color is not currently being published.
                    - `OutOfBounds`: The position is out of bounds.
                    - `TooFast`: The speed is too fast.
                </doc>
            </annotations>
            <member name="color"
                type="string" stringMaxLength="COLOR_MAX_LEN" />
            <member name="position"
                type="nonBasic" nonBasicTypeName="Position" />
            <member name="velocity"
                type="nonBasic" nonBasicTypeName="Velocity" />
        </struct>

        <enum name="SetStateRequest_ReturnCode">
            <enumerator name="OK" />
            <enumerator name="REJECTED" />
            <enumerator name="INVALID_COLOR" />
            <enumerator name="OUT_OF_BOUNDS" />
            <enumerator name="TOO_FAST" />
        </enum>

        <!--  Set State using Request/Reply -->
        <union name="SetStateReply">
            <discriminator type="nonBasic" nonBasicTypeName="SetRequest_ReturnCode" />
            <case>
                <caseDiscriminator value="REJECTED" />
                <member name="exception_reply"
                    type="nonBasic" nonBasicTypeName="EmptyStruct" />
            </case>
        </union>

        <!-- Additional Request/Reply service to stop a single shape -->
        <struct name="StopSingleShapeRequest" baseType="StopRequest">
            <annotations>
                <doc>Request to stop a single shape.</doc>
            </annotations>
            <member name="color"
                type="string" stringMaxLength="COLOR_MAX_LEN">
                <annotations>
                    <doc>Color of the shape to stop.</doc>
                </annotations>
            </member>
        </struct>
        <struct name="StopSingleShapeReply">
            <member name="result" type="boolean" />
        </struct>
    </module>
</types>
