Definitions.xid.xml 13.5 KB
<?xml version="1.0" encoding="UTF-8" ?>

<!--
  Copyright (c) 2017, TeleCommunication Systems, Inc.,
  a wholly-owned subsidiary of Comtech Telecommunications Corp.
  and/or affiliates of TeleCommunication Systems, Inc.
  All rights reserved.
  TeleCommunication Systems, Inc. PROPRIETARY/CONFIDENTIAL.
  Use is subject to license terms included in the distribution.
-->

<specification xmlns="https://xid.location.studio/schema/V1.0.0/XtensibleInterfaceDefinition.xsd"
               xmlns:xid="https://xid.location.studio/schema/V1.0.0/XtensibleInterfaceDefinition.xsd"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="https://xid.location.studio/schema/V1.0.0/XtensibleInterfaceDefinition.xsd XtensibleInterfaceDefinition.xsd"
               identity="Definitions.xid.xml">
    <title>Tensor Defitions</title>
    <comment>
       Defines fundamental type mappings.
    </comment>

    <tag name="package" value="com.comtechtel"/>

    <namespace name="Tensor">
        <type name="void" size="0">
            <comment>represents nothing. &lt;br/&gt;Useful in &lt;operation&gt; with no &lt;input&gt;</comment>
            <lang name="c" type="void"/>
            <lang name="cpp" type="void"/>
            <lang name="java" type="void"/>
            <lang name="node" type="void"/>
        </type>
        <type name="bool" size="1">
            <comment>represents true/false</comment>
            <lang name="c" type="bool" include="stdbool.h"/>
            <lang name="cpp" type="bool"/>
            <lang name="java" type="XidBool" include="com.comtechtel.tensor.xid.XidBool"/>
            <lang name="node" type="XidBool"/>
        </type>

        <type name="uint8" size="1">
            <comment>8-bit, unsigned value</comment>
            <lang name="c" type="uint8_t" include="stdint.h"/>
            <lang name="cpp" type="uint8_t" include="cstdint"/>
            <lang name="java" type="XidByte" include="com.comtechtel.tensor.xid.XidByte" />
            <lang name="node" type="XidUInt8"/>
        </type>
        <type name="uint16" size="2">
            <comment>16-bit, unsigned value</comment>
            <lang name="c" type="uint16_t" include="stdint.h"/>
            <lang name="cpp" type="uint16_t" include="cstdint"/>
            <lang name="java" type="XidShort" include="com.comtechtel.tensor.xid.XidShort"/>
            <lang name="node" type="XidUShort"/>
        </type>
        <type name="uint24" size="3">
            <comment>24-bit, unsigned value</comment>
            <lang name="c" type="uint24_t" include="Tensor/CXMF/int24.h"/>
            <lang name="cpp" type="uint24_t" include="Tensor/Types/int24.h"/>
            <lang name="java" type="XidInt24" include="com.comtechtel.tensor.xid.XidInt24"/>
            <lang name="node" type="XidUInt24"/>
        </type>
        <type name="uint32" size="4">
            <comment>32-bit, unsigned value</comment>
            <lang name="c" type="uint32_t" include="stdint.h"/>
            <lang name="cpp" type="uint32_t" include="cstdint"/>
            <lang name="java" type="XidInt" include="com.comtechtel.tensor.xid.XidInt"/>
             <lang name="node" type="XidUInt"/>
        </type>
        <type name="uint64" size="8">
            <comment>64-bit, unsigned value</comment>
            <lang name="c" type="uint64_t" include="stdint.h"/>
            <lang name="cpp" type="uint64_t" include="cstdint"/>
            <lang name="java" type="XidLong" include="com.comtechtel.tensor.xid.XidLong"/>
             <lang name="node" type="XidULong"/>
        </type>

        <type name="int8" size="1">
            <comment>8-bit, signed value</comment>
            <lang name="c" type="int8_t" include="stdint.h"/>
            <lang name="cpp" type="int8_t" include="cstdint"/>
            <lang name="java" type="XidByte" include="com.comtechtel.tensor.xid.XidByte"/>
            <lang name="node" type="XidInt8"/>
        </type>
        <type name="int16" size="2">
            <comment>16-bit, signed value</comment>
            <lang name="c" type="int16_t" include="stdint.h"/>
            <lang name="cpp" type="int16_t" include="cstdint"/>
            <lang name="java" type="XidShort" include="com.comtechtel.tensor.xid.XidShort" />
            <lang name="node" type="XidShort"/>
        </type>
        <type name="int24" size="3">
            <comment>24-bit, unsigned value</comment>
            <lang name="c" type="int24_t" include="Tensor/CXMF/int24.h"/>
            <lang name="cpp" type="int24_t" include="Tensor/Types/int24.h"/>
            <lang name="java" type="XidInt24" include="com.comtechtel.tensor.xid.XidInt24"/>
             <lang name="node" type="XidInt24"/>
        </type>
        <type name="int32" size="4">
            <comment>32-bit, signed value</comment>
            <lang name="c" type="int32_t" include="stdint.h"/>
            <lang name="cpp" type="int32_t" include="cstdint"/>
            <lang name="java" type="XidInt" include="com.comtechtel.tensor.xid.XidInt"/>
            <lang name="node" type="XidInt"/>
        </type>
        <type name="int64" size="8">
            <comment>64-bit, signed value</comment>
            <lang name="c" type="int64_t" include="stdint.h"/>
            <lang name="cpp" type="int64_t" include="cstdint"/>
            <lang name="java" type="XidLong" include="com.comtechtel.tensor.xid.XidLong"/>
            <lang name="node" type="XidLong"/>
        </type>

        <!--
        <type name="float16" size="4">
            <comment>32-bit, IEEE 754 binary16</comment>
            <comment>C/cpp usually a "float"</comment>
            <artifact>https://en.wikipedia.org/wiki/Half-precision_floating-point_format</artifact>
        </type>
        -->

        <type name="float32" size="4">
            <comment>32-bit, IEEE 754 binary32</comment>
            <artifact>https://en.wikipedia.org/wiki/Single-precision_floating-point_format</artifact>
            <lang name="c" type="float"/>
            <lang name="cpp" type="float"/>
            <lang name="java" type="XidFloat" include="com.comtechtel.tensor.xid.XidFloat"/>
            <lang name="node" type="XidFloat"/>
        </type>
        <type name="float64" size="8">
            <comment>64-bit, IEEE 754 binary64</comment>
            <artifact>https://en.wikipedia.org/wiki/Double-precision_floating-point_format</artifact>
            <lang name="c" type="double"/>
            <lang name="cpp" type="double"/>
            <lang name="java" type="XidDouble" include="com.comtechtel.tensor.xid.XidDouble"/>
            <lang name="node" type="XidDouble"/>
        </type>
        <!--
        <type name="float128" size="8">
            <comment>128-bit, IEEE 754 binary128</comment>
            <artifact>https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format</artifact>
            <lang name="cpp" type="long double"/>
        </type>
        -->
        
        <type name="byte" size="1">
            <comment>A single byte</comment>
            <lang name="c" type="uint8_t" include="stdint.h"/>
            <lang name="cpp" type="uint8_t" include="cstdint"/>
            <lang name="java" type="XidByte" include="com.comtechtel.tensor.xid.XidByte"/>
            <lang name="node" type="XidUInt8"/>
        </type>
        <type name="raw">
            <comment>Variable sized collection of bytes</comment>
            <!-- may change this type -->
            <lang name="c" type="CAtom" include="Tensor/CXMF/CXMF.h"/>
            <lang name="cpp" type="::Tensor::XMF::Atom" include="Tensor/XMF/Atom.h"/>
            <lang name="java" type="Atom" include="com.comtechtel.tensor.xmf.Atom"/>
            <lang name="node" type="Atom"/>
        </type>

        <type name="string">
            <comment>Variable sized collection of characters</comment>
            <lang name="c" type="CXMFString" include="Tensor/CXMF/CXMFString.h"/>
            <lang name="cpp" type="std::string" include="string"/>
            <lang name="java" type="XidString" include="com.comtechtel.tensor.xid.XidString"/>
            <lang name="node" type="XidString"/>
        </type>

        <type name="datetime" size="8">
            <comment>nanoseconds since Jan 1, 1970.</comment>
            <lang name="c" type="uint64_t" include="stdint.h"/>
            <lang name="cpp" type="::Tensor::Types::DateTime" include="Tensor/Types/DateTime.h"/>
            <lang name="java" type="XidDateTime" include="com.comtechtel.tensor.xid.XidDateTime"/>
            <lang name="node" type="XidDateTime"/>
        </type>

        <type name="UUID" size="16">
            <comment>16 byte UUID</comment>
            <lang name="c" type="UUID" include="Tensor/CXMF/uuid.h"/>
            <lang name="cpp" type="::Tensor::Types::UUID" include="Tensor/Types/uuid.h"/>
            <lang name="java" type="XidUuid" include="com.comtechtel.tensor.xid.XidUuid"/>
            <lang name="node" type="XidUuid"/>
        </type>

        <type name="uri">
          <comment>Standard Universal Resource Identifier (URI)</comment>
          <tag name="TODO" value="Define uri as a custom type.  Use string for now."/>
          <lang name="c" type="CXMFString" include="Tensor/CXMF/CXMFString.h"/>
          <lang name="cpp" type="std::string" include="string"/>
          <lang name="java" type="XidString" include="com.comtechtel.tensor.xid.XidString"/>
          <lang name="node" type="XidString"/>
        </type>

        <type name="json">
          <comment>JSON formatted/encoded string</comment>
          <tag name="TODO" value="Define json as a custom type.  Use string for now."/>
          <lang name="c" type="CXMFString" include="Tensor/CXMF/CXMFString.h"/>
          <lang name="cpp" type="std::string" include="string"/>
          <lang name="java" type="XidString" include="com.comtechtel.tensor.xid.XidString"/>
          <lang name="node" type="XidString"/>
        </type>

        <type name="mac48" size="6">
			<artifact>https://wikipedia.org/wiki/MAC_address</artifact>
            <comment>6 byte IEEE MAC-48</comment>
            <lang name="c" type="MacAddress48" include="Tensor/CXMF/MacAddress48.h"/>
            <lang name="cpp" type="::Tensor::Types::MacAddress48" include="Tensor/Types/MacAddress48.h"/>
            <lang name="java" type="XidMacAddress48" include="com.comtechtel.tensor.xid.MacAddress48"/>
            <lang name="node" type="XidMacAddress48"/>
        </type>

        <!-- 
        *******************************************************
        Encoding Data Types
        *******************************************************
        -->

        <!-- Encoding format type spec.-->
        <type name="EncodingFormat" size="2">
            <comment>
              The encoding format determines how element data is run-time encoded within a particular element independent of the
				transport encoding.
              These values are specified in the "encoding" attribute for elements. Not all encoding formats
              are supported by every wireline protocol implementation.  Additionally, custom encodings may be
              defined to support application defined encodings.   Any non-standard encodings must be registered (to avoid collision)
              and approved by the appropriate approving authority (e.g. Comtech). Values from 0 to 255 are reserved 
              for standard-encodings. Custom encodings start at 256(0x0100) and extend to 65535 (0xFFFF).\n
				\n
				This is not the same as defining in XID a raw datatype or json datatype which are NOT changeable are run-time.
				\n
			  Example: \n
				\t The message XMF but a field is defined to be encoded as JSON.\n
				\t Likewise, the message is JSON, but a field is run-time encoded to be XMF.\n
				\n
              Data encoding format type. If 0, value is not encoded. See ResrvedEncodingFormats
              for a list of standard format specifiers.
            </comment>
            <lang name="c" type="uint16_t" include="stdint.h" />
            <lang name="cpp" type="uint16_t" include="cstdint" />
            <lang name="java" type="XidShort" include="com.comtechtel.tensor.xid.XidShort" />
            <lang name="node" type="XidUShort" />
        </type>

        <!-- ReservedEncodingFormats standard encoding formats.-->
        <enum name="ReservedEncodingFormats" type="Tensor.uint16"  default="native">
            <comment>
               Reserved encoding formats define standard encodings known to all implementations.  
            </comment>
            <literal name="native" value="0">
                <comment>
                    Data is not encoded, information is in the default format for the particular wireline interface.\n
                    This is the default value if not defined explicitly.
                </comment>
            </literal>
            <literal name="raw" value="1">
                <comment>
                    Data is in an unspecified binary format.  The interpretation of the data is
                    falls to the producer and consumer of the information.
					For textual wireline encodings like JSON, the data will be valid within the representation.
                </comment>
            </literal>
            <literal name="xmf" value="2">
                <comment>
                    Data is XMF binary format.  The binary data is structured using atoms and atom lists.
					For textual wireline encodings like JSON, this is XMF base64 encoded.
                </comment>
            </literal>
            <literal name="json" value="3">
                <comment>
                    Data is formatted as JSON compliant ascii text.
                </comment>
            </literal>
        </enum> 
    </namespace>
</specification>