Skip to content

Commit 9233964

Browse files
committed
[C++] Use constructor rather than wrap method for dimensions of group and tidy up formatting after merge of PR #674.
1 parent a21cd06 commit 9233964

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,15 @@ private static void generateGroupClassHeader(
212212
formatClassName(groupName)));
213213

214214
sb.append(String.format(
215-
indent + " inline void wrapForDecode(char *buffer, std::uint64_t *pos," +
216-
" const std::uint64_t actingVersion, const std::uint64_t bufferLength)\n" +
215+
indent + " inline void wrapForDecode(\n" +
216+
indent + " char *buffer,\n" +
217+
indent + " std::uint64_t *pos,\n" +
218+
indent + " const std::uint64_t actingVersion,\n" +
219+
indent + " const std::uint64_t bufferLength)\n" +
217220
indent + " {\n" +
218-
indent + " %2$s dimensions;\n" +
221+
indent + " %2$s dimensions(buffer, *pos, bufferLength, actingVersion);\n" +
219222
indent + " m_buffer = buffer;\n" +
220223
indent + " m_bufferLength = bufferLength;\n" +
221-
indent + " dimensions.wrap(m_buffer, *pos, actingVersion, bufferLength);\n" +
222224
indent + " m_blockLength = dimensions.blockLength();\n" +
223225
indent + " m_count = dimensions.numInGroup();\n" +
224226
indent + " m_index = -1;\n" +
@@ -232,10 +234,13 @@ private static void generateGroupClassHeader(
232234
final String minCheck = minCount > 0 ? "count < " + minCount + " || " : "";
233235

234236
sb.append(String.format("\n" +
235-
indent + " inline void wrapForEncode(char *buffer, const %3$s count," +
236-
" std::uint64_t *pos, const std::uint64_t actingVersion, const std::uint64_t bufferLength)\n" +
237+
indent + " inline void wrapForEncode(\n" +
238+
indent + " char *buffer,\n" +
239+
indent + " const %3$s count,\n" +
240+
indent + " std::uint64_t *pos,\n" +
241+
indent + " const std::uint64_t actingVersion,\n" +
242+
indent + " const std::uint64_t bufferLength)\n" +
237243
indent + " {\n" +
238-
indent + " %7$s dimensions;\n" +
239244
indent + "#if defined(__GNUG__) && !defined(__clang__)\n" +
240245
indent + "#pragma GCC diagnostic push\n" +
241246
indent + "#pragma GCC diagnostic ignored \"-Wtype-limits\"\n" +
@@ -249,7 +254,7 @@ private static void generateGroupClassHeader(
249254
indent + "#endif\n" +
250255
indent + " m_buffer = buffer;\n" +
251256
indent + " m_bufferLength = bufferLength;\n" +
252-
indent + " dimensions.wrap(m_buffer, *pos, actingVersion, bufferLength);\n" +
257+
indent + " %7$s dimensions(buffer, *pos, bufferLength, actingVersion);\n" +
253258
indent + " dimensions.blockLength((%1$s)%2$d);\n" +
254259
indent + " dimensions.numInGroup((%3$s)count);\n" +
255260
indent + " m_index = -1;\n" +

0 commit comments

Comments
 (0)