Skip to content

Commit a21cd06

Browse files
authored
Merge pull request aeron-io#674 from agmt/master
[C++] Remove the dimension member from the codec classes.
2 parents 20f4e0c + f0ce21d commit a21cd06

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

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

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,32 +201,32 @@ private static void generateGroupClassHeader(
201201
indent + " std::uint64_t m_count;\n" +
202202
indent + " std::uint64_t m_index;\n" +
203203
indent + " std::uint64_t m_offset;\n" +
204-
indent + " std::uint64_t m_actingVersion;\n" +
205-
indent + " %2$s m_dimensions;\n\n" +
204+
indent + " std::uint64_t m_actingVersion;\n\n" +
206205

207206
indent + " std::uint64_t *sbePositionPtr() SBE_NOEXCEPT\n" +
208207
indent + " {\n" +
209208
indent + " return m_positionPtr;\n" +
210209
indent + " }\n\n" +
211210

212211
indent + "public:\n",
213-
formatClassName(groupName), dimensionsClassName));
212+
formatClassName(groupName)));
214213

215214
sb.append(String.format(
216215
indent + " inline void wrapForDecode(char *buffer, std::uint64_t *pos," +
217216
" const std::uint64_t actingVersion, const std::uint64_t bufferLength)\n" +
218217
indent + " {\n" +
218+
indent + " %2$s dimensions;\n" +
219219
indent + " m_buffer = buffer;\n" +
220220
indent + " m_bufferLength = bufferLength;\n" +
221-
indent + " m_dimensions.wrap(m_buffer, *pos, actingVersion, bufferLength);\n" +
222-
indent + " m_blockLength = m_dimensions.blockLength();\n" +
223-
indent + " m_count = m_dimensions.numInGroup();\n" +
221+
indent + " dimensions.wrap(m_buffer, *pos, actingVersion, bufferLength);\n" +
222+
indent + " m_blockLength = dimensions.blockLength();\n" +
223+
indent + " m_count = dimensions.numInGroup();\n" +
224224
indent + " m_index = -1;\n" +
225225
indent + " m_actingVersion = actingVersion;\n" +
226226
indent + " m_positionPtr = pos;\n" +
227227
indent + " *m_positionPtr = *m_positionPtr + %1$d;\n" +
228228
indent + " }\n",
229-
dimensionHeaderLength));
229+
dimensionHeaderLength, dimensionsClassName));
230230

231231
final long minCount = numInGroupToken.encoding().applicableMinValue().longValue();
232232
final String minCheck = minCount > 0 ? "count < " + minCount + " || " : "";
@@ -235,6 +235,7 @@ private static void generateGroupClassHeader(
235235
indent + " inline void wrapForEncode(char *buffer, const %3$s count," +
236236
" std::uint64_t *pos, const std::uint64_t actingVersion, const std::uint64_t bufferLength)\n" +
237237
indent + " {\n" +
238+
indent + " %7$s dimensions;\n" +
238239
indent + "#if defined(__GNUG__) && !defined(__clang__)\n" +
239240
indent + "#pragma GCC diagnostic push\n" +
240241
indent + "#pragma GCC diagnostic ignored \"-Wtype-limits\"\n" +
@@ -248,9 +249,9 @@ private static void generateGroupClassHeader(
248249
indent + "#endif\n" +
249250
indent + " m_buffer = buffer;\n" +
250251
indent + " m_bufferLength = bufferLength;\n" +
251-
indent + " m_dimensions.wrap(m_buffer, *pos, actingVersion, bufferLength);\n" +
252-
indent + " m_dimensions.blockLength((%1$s)%2$d);\n" +
253-
indent + " m_dimensions.numInGroup((%3$s)count);\n" +
252+
indent + " dimensions.wrap(m_buffer, *pos, actingVersion, bufferLength);\n" +
253+
indent + " dimensions.blockLength((%1$s)%2$d);\n" +
254+
indent + " dimensions.numInGroup((%3$s)count);\n" +
254255
indent + " m_index = -1;\n" +
255256
indent + " m_count = count;\n" +
256257
indent + " m_blockLength = %2$d;\n" +
@@ -260,7 +261,8 @@ private static void generateGroupClassHeader(
260261
indent + " }\n",
261262
cppTypeForBlockLength, blockLength, cppTypeForNumInGroup, dimensionHeaderLength,
262263
minCheck,
263-
numInGroupToken.encoding().applicableMaxValue().longValue()));
264+
numInGroupToken.encoding().applicableMaxValue().longValue(),
265+
dimensionsClassName));
264266

265267
sb.append(String.format("\n" +
266268
indent + " static SBE_CONSTEXPR std::uint64_t sbeHeaderSize() SBE_NOEXCEPT\n" +

0 commit comments

Comments
 (0)