CommsDSL Specification
  • Introduction
  • Version
  • Schema Definition
  • Multiple Files
  • Namespaces
  • Platforms
  • References
  • Properties
  • Numeric Values
  • Boolean Values
  • Names
  • Protocol Versioning
  • Schema
  • Fields
    • Common Properties of Fields
    • enum Field
    • int Field
    • set Field
    • bitfield Field
    • bundle Field
    • string Field
    • data Field
    • list Field
    • float Field
    • ref Field
    • optional Field
    • variant Field
    • Referencing Values of Other Fields
  • Messages
  • Interfaces
  • Aliases
  • Frames
    • Common Properties of Layers
    • payload Layer
    • id Layer
    • size Layer
    • sync Layer
    • checksum Layer
    • value Layer
    • custom Layer
  • Protocol Versioning Summary
  • Appendix
    • Properties of schema
    • Common Properties of Fields
    • Properties of enum Field
    • Properties of int Field
    • Properties of set Field
    • Properties of bitfield Field
    • Properties of bundle Field
    • Properties of string Field
    • Properties of data Field
    • Properties of list Field
    • Properties of float Field
    • Properties of ref Field
    • Properties of optional Field
    • Properties of variant Field
    • Units
    • Properties of message
    • Properties of interface
    • Properties of alias
    • Properties of frame
    • Common Properties of Layers
    • Properties of checksum Layer
    • Properties of value Layer
    • Properties of custom Layer
Powered by GitBook
On this page

Was this helpful?

Namespaces

PreviousMultiple FilesNextPlatforms

Last updated 5 years ago

Was this helpful?

In addition to splitting into , CommsDSL provides namespaces to help in definition of big protocols. It is possible to define , , , and in a separate namespace. The code generator must use this information to define relevant classes in a separate namespace(s) (if such feature is provided by the language) or introduce relevant prefixes into the names to avoid name clashes.

The namespace is defined using <ns> node with single name property. It can contain all the mentioned nodes.

<?xml version="1.0" encoding="UTF-8"?>
<schema ...>
    <ns name="myns">
        <fields>
            ...
        </fields>

        <message ...>
        </message>

        <messages>
            <message ... />
            <message ... />
        </messages>

        <interface ...>
        </interface>

        <interfaces>
            <interface ... />
            <interface ... />
        </interfaces>

        <frame ...>
        </frame>

        <frames>
            <frame ... />
            <frame ... />
        </frames>
    </ns>
</schema>

The namespace (<ns>) can also contain other namespaces:

<?xml version="1.0" encoding="UTF-8"?>
<schema ...>
    <ns name="myns">
        <ns name="subns1">
            <fields>
                ...
            </fields>
        </ns>

        <ns name="subns2">
            <message ... />
            <message ... />
        </ns>
    </ns>
</schema>
multiple files
fields
messages
interfaces
frames
previously