Skip to content

Commit

Permalink
[C++] Use constructor rather than wrap method for dimensions of group…
Browse files Browse the repository at this point in the history
… and tidy up formatting after merge of PR #674.
  • Loading branch information
mjpt777 committed May 3, 2019
1 parent a21cd06 commit 9233964
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,15 @@ private static void generateGroupClassHeader(
formatClassName(groupName)));

sb.append(String.format(
indent + " inline void wrapForDecode(char *buffer, std::uint64_t *pos," +
" const std::uint64_t actingVersion, const std::uint64_t bufferLength)\n" +
indent + " inline void wrapForDecode(\n" +
indent + " char *buffer,\n" +
indent + " std::uint64_t *pos,\n" +
indent + " const std::uint64_t actingVersion,\n" +
indent + " const std::uint64_t bufferLength)\n" +
indent + " {\n" +
indent + " %2$s dimensions;\n" +
indent + " %2$s dimensions(buffer, *pos, bufferLength, actingVersion);\n" +
indent + " m_buffer = buffer;\n" +
indent + " m_bufferLength = bufferLength;\n" +
indent + " dimensions.wrap(m_buffer, *pos, actingVersion, bufferLength);\n" +
indent + " m_blockLength = dimensions.blockLength();\n" +
indent + " m_count = dimensions.numInGroup();\n" +
indent + " m_index = -1;\n" +
Expand All @@ -232,10 +234,13 @@ private static void generateGroupClassHeader(
final String minCheck = minCount > 0 ? "count < " + minCount + " || " : "";

sb.append(String.format("\n" +
indent + " inline void wrapForEncode(char *buffer, const %3$s count," +
" std::uint64_t *pos, const std::uint64_t actingVersion, const std::uint64_t bufferLength)\n" +
indent + " inline void wrapForEncode(\n" +
indent + " char *buffer,\n" +
indent + " const %3$s count,\n" +
indent + " std::uint64_t *pos,\n" +
indent + " const std::uint64_t actingVersion,\n" +
indent + " const std::uint64_t bufferLength)\n" +
indent + " {\n" +
indent + " %7$s dimensions;\n" +
indent + "#if defined(__GNUG__) && !defined(__clang__)\n" +
indent + "#pragma GCC diagnostic push\n" +
indent + "#pragma GCC diagnostic ignored \"-Wtype-limits\"\n" +
Expand All @@ -249,7 +254,7 @@ private static void generateGroupClassHeader(
indent + "#endif\n" +
indent + " m_buffer = buffer;\n" +
indent + " m_bufferLength = bufferLength;\n" +
indent + " dimensions.wrap(m_buffer, *pos, actingVersion, bufferLength);\n" +
indent + " %7$s dimensions(buffer, *pos, bufferLength, actingVersion);\n" +
indent + " dimensions.blockLength((%1$s)%2$d);\n" +
indent + " dimensions.numInGroup((%3$s)count);\n" +
indent + " m_index = -1;\n" +
Expand Down

0 comments on commit 9233964

Please sign in to comment.