Bounded Case

XSD type:

   <xs:simpleType name="TypeName">
       <xs:restriction>
         <xs:simpleType>
           <xs:list itemType="type"/>
         </xs:simpleType>
         <xs:length value="length"/>
       </xs:restriction>
   </xs:simpleType>

Generated C code:

   typedef struct TypeName {
      OSUINT32 n;
      TYPE elem[length];
   } typeName;

Generated C++ code:

   class TypeName : public OSRTBaseType {
      OSUINT32 n;
      TYPE elem[length];
      ...
   } ;

The one exception to this mapping occurs when the referenced item type is an enumeration. In this case, a structure is generated with each enumerated item represented as a single bit. This is a more compact structure that is easier to work with for specifying enumerated items and for validation to make sure there are no duplicates in the list. The mapping for this special case is as follows:

XSD type:

   <xsd:simpleType name="EnumType">
      <xsd:restriction base="xsd:string">
         <xsd:enumeration value="enum1"/>
         <xsd:enumeration value="enum2"/>
         ...
         <xsd:enumeration value="enumN"/>
      </xsd:restriction>
   </xsd:simpleType>

   <xsd:simpleType name="TypeName">
      <xsd:list itemType="EnumType"/>
   </xsd:simpleType>

Generated C code:

   typedef struct TypeName {
      unsigned enum1Bit : 1;
      unsigned enum2Bit : 1;
      ...
      unsigned enumNBit : 1;
      OSRTDList* _extItems;
   } TypeName;

Generated C++ code:

   class TypeName : public OSRTBaseType {
   public:
      unsigned enum1Bit : 1;
      unsigned enum2Bit : 1;
      ...
      unsigned enumNBit : 1;
      OSRTDListClass* _extItems;

      ...
   } ;

Each of the bit fields in this type represents a declared enumeration item in the XSD definition. The _extItemsfield is added for extensibility purposes (i.e. if an unknown item is received it is added to this list). This construct will be used if a declared enumerated type is referenced (as is the case above) or if the list type contains an anonymous type with an enumeration list.