Skip to content

Commit a7e800a

Browse files
author
Egor Seredin
committed
[C++] add isConstLength() to check if message contains variable-length items
1 parent 7709a7e commit a7e800a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3009,6 +3009,11 @@ private CharSequence generateMessageLength(
30093009
final StringBuilder sb = new StringBuilder();
30103010

30113011
new Formatter(sb).format("\n" +
3012+
indent + "SBE_NODISCARD static SBE_CONSTEXPR bool isConstLength() SBE_NOEXCEPT\n" +
3013+
indent + "{\n" +
3014+
indent + " return " + ((groups.isEmpty() && varData.isEmpty()) ? "true" : "false") + ";\n" +
3015+
indent + "}\n\n" +
3016+
30123017
indent + "SBE_NODISCARD static SBE_CONSTEXPR_14 size_t computeLength(%1$s)\n" +
30133018
indent + "{\n" +
30143019
"#if defined(__GNUG__) && !defined(__clang__)\n" +

0 commit comments

Comments
 (0)