Skip to content

Commit 07278ec

Browse files
committed
[c++] Add static setter for bitset choice.
1 parent 0bfb0f8 commit 07278ec

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppGenerator.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,16 @@ private CharSequence generateChoices(final String bitsetClassName, final List<To
674674
typeName,
675675
choiceBitPosition));
676676

677+
sb.append(String.format(
678+
"\n" +
679+
" static %2$s %1$s(const %2$s bits, const bool value)\n" +
680+
" {\n" +
681+
" return value ? (bits | (0x1L << %3$s)) : (bits & ~(0x1L << %3$s));\n" +
682+
" }\n\n",
683+
choiceName,
684+
typeName,
685+
choiceBitPosition));
686+
677687
sb.append(String.format(
678688
" bool %1$s() const\n" +
679689
" {\n" +

0 commit comments

Comments
 (0)