@@ -2625,6 +2625,44 @@ void ClientSession::sendMsg14()
26252625 sendMessage (msg);
26262626}
26272627```
2628+
2629+ Also since ** v6.1** of the [ CommsDSL] ( https://github.com/commschamp/CommsDSL-Specification )
2630+ specification it is allowed to check the size of the sequence fields like ` <string> ` , ` <data> ` ,
2631+ or ` <list> ` int the ` <optional> ` field conditions. To do so there is a need to use ` # ` character
2632+ after the sibling field reference prefix ` $ ` .
2633+ The ` Msg18 ` message (defined inside [ dsl/msg18.xml] ( dsl/msg18.xml ) and implemented in
2634+ [include/tutorial2/message/Msg18.h](include/tutorial2/message/Msg18.h)) demonstrates that.
2635+ ```xml
2636+ <message name=" Msg18" id=" MsgId.M18" displayName=" Message 18" >
2637+ <string name=" F1" >
2638+ <lengthPrefix>
2639+ <int name=" Length" type=" uint8" />
2640+ </lengthPrefix>
2641+ </string>
2642+ <optional name=" F2" cond=" $#F1 != 0" defaultMode=" missing" >
2643+ <int name=" ActF2" type=" uint16" />
2644+ </optional>
2645+ ...
2646+ </message>
2647+ ```
2648+ In the example above the optional field ` F2 ` exists if the size of the ` F1 ` is not 0, i.e.
2649+ it is not empty.
2650+
2651+ The ** v6.1** of the [ CommsDSL] ( https://github.com/commschamp/CommsDSL-Specification ) specification
2652+ also allows check of whether the mode of the previously encountered ` <optional> ` field is ** exists** .
2653+ To do so there is a need to use ` ? ` character after the sibling field reference prefix ` $ ` .
2654+ ``` xml
2655+ <message name =" Msg18" id =" MsgId.M18" displayName =" Message 18" >
2656+ ...
2657+ <optional name =" F2" cond =" $#F1 != 0" defaultMode =" missing" >
2658+ <int name =" ActF2" type =" uint16" />
2659+ </optional >
2660+ <optional name =" F3" cond =" !$?F2" defaultMode =" exists" >
2661+ <int name =" ActF3" type =" uint8" />
2662+ </optional >
2663+ </message >
2664+ ```
2665+ In the example above the optional field ` F3 ` exists if the ` F2 ` does NOT exist (due to negation operator ` ! ` ).
26282666
26292667## Reusing Fields Definitions
26302668In many cases some fields may share some portions of their definitions. To avoid various
0 commit comments