Skip to content

Commit 16cefad

Browse files
authored
Merge pull request #66 from donmendelson/issue64
Support for easy constant value setting in fields #64
2 parents b6b8df0 + db70464 commit 16cefad

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

v2-0-RC1/doc/02FieldEncoding.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Attributes are optional unless specified otherwise.
135135
| Schema attribute | Description |
136136
|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
137137
| presence=required | The field must always be set. This is the default presence. Mutually exclusive with nullValue. |
138-
| presence=constant | The field has a constant value that need not be transmitted on the wire. Mutually exclusive with value attributes. |
138+
| presence=constant | The field has a constant value that need not be transmitted on the wire. Mutually exclusive with nullValue, minValue, and maxValue attributes. |
139139
| presence=optional | The field need not be populated. A special null value indicates that a field is not set. The presence attribute may be specified on either on a field or its encoding. |
140140
| nullValue | A special value that indicates that an optional value is not set. See encodings below for default nullValue for each type. Mutually exclusive with presence=required and constant. |
141141
| minValue | The lowest valid value of a range. Applies to scalar data types, but not to String or data types. |
@@ -567,10 +567,9 @@ M S F T
567567
A character array constant specification
568568

569569
```xml
570-
<type name="EurexMarketID" primitiveType="char" length="4" description="MIC code"
571-
presence="constant">XEUR</type>
570+
<type name="MarketID" primitiveType="char" length="4" description="MIC code"/>
572571

573-
<field type="EurexMarketID" name="MarketID" id="1301" semanticType="Exchange"/>
572+
<field name="EurexMarketID" type="MarketID" id="1301" semanticType="Exchange" presence="constant">XEUR</field>
574573
```
575574

576575
### Variable-length string encoding

v2-0-RC1/resources/Examples.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
<type name="enumEncoding" primitiveType="char"/>
1010
<type name="idString" length="8" primitiveType="char"/>
1111
<type name="intEnumEncoding" primitiveType="uint8"/>
12+
<type name="currency" length="3" primitiveType="char" description="ISO 4217"/>
1213
<composite name="DATA">
1314
<type name="length" primitiveType="uint16"/>
1415
<type name="varData" length="0" primitiveType="uint8"/>
@@ -122,4 +123,14 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
122123
<field name="Price" id="44" type="decimalEncoding" offset="38" presence="optional" semanticType="Price"/>
123124
<field name="StopPx" id="99" type="decimalEncoding" offset="46" presence="optional" semanticType="Price"/>
124125
</sbe:message>
126+
<sbe:message name="MarketOrder" id="100" blockLength="54" semanticType="D" description="Demonstration of constants">
127+
<field name="ClOrdId" id="11" type="idString" offset="0" semanticType="String"/>
128+
<field name="Account" id="1" type="idString" offset="8" semanticType="String"/>
129+
<field name="Symbol" id="55" type="idString" offset="16" semanticType="String"/>
130+
<field name="Side" id="54" type="sideEnum" offset="24"/>
131+
<field name="TransactTime" id="60" type="timestampEncoding" offset="25" semanticType="UTCTimestamp"/>
132+
<field name="OrderQty" id="38" type="qtyEncoding" offset="33" semanticType="Qty"/>
133+
<field name="OrdType" id="40" type="ordTypeEnum" presence="constant" valueRef="ordTypeEnum.Market"/>
134+
<field name="Currency" id="15" type="currency" presence="constant">USD</field>
135+
</sbe:message>
125136
</sbe:messageSchema>

v2-0-RC1/resources/sbe.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
</xs:extension>
293293
</xs:simpleContent>
294294
</xs:complexType>
295-
<xs:complexType name="fieldType">
295+
<xs:complexType name="fieldType" mixed="true">
296296
<xs:annotation>
297297
<xs:documentation>
298298
A field of a message of a specified dataType

0 commit comments

Comments
 (0)