Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sbe-benchmarks/src/main/cpp/SbeCarCodecBench.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class SbeCarCodecBench : public CodecBench<SbeCarCodecBench>
{
car.wrapForDecode((char *)buffer, 0, Car::sbeBlockLength(), Car::sbeSchemaVersion(), bufferLength);

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
int64_t tmpInt;
const char *tmpChar;
double tmpDouble;
Expand Down Expand Up @@ -132,6 +134,7 @@ class SbeCarCodecBench : public CodecBench<SbeCarCodecBench>

tmpChar = car.manufacturer();
tmpChar = car.model();
#pragma GCC diagnostic pop

return car.encodedLength();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,22 +294,28 @@ private static void generateGroupClassHeader(
dimensionHeaderLength, blockLength, formatClassName(groupName)));

sb.append(
indent + "#if __cplusplus < 201103L\n" +
indent + " template<class Func> inline void forEach(Func& func)\n" +
indent + " {\n" +
indent + " while (hasNext())\n" +
indent + " {\n" +
indent + " next(); func(*this);\n" +
indent + " }\n" +
indent + " }\n\n" +
indent + "#else\n" +
indent + " }\n" +
indent + "#if __cplusplus >= 201103L\n" +
indent + " template<class Func> inline void forEach(Func&& func)\n" +
indent + " {\n" +
indent + " while (hasNext())\n" +
indent + " {\n" +
indent + " next(); func(*this);\n" +
indent + " }\n" +
indent + " }\n\n" +
indent + " }\n" +
indent + " template<class Func> inline void forEach(Func const& func)\n" +
indent + " {\n" +
indent + " while (hasNext())\n" +
indent + " {\n" +
indent + " next(); func(*this);\n" +
indent + " }\n" +
indent + " }\n" +
indent + "#endif\n\n");
}

Expand Down Expand Up @@ -1285,17 +1291,21 @@ private static CharSequence generateFixedFlyweightCode(final String className, f
" m_offset(codec.m_offset),\n" +
" m_actingVersion(codec.m_actingVersion){}\n\n" +
"#if __cplusplus >= 201103L\n" +
" %1$s(%1$s&& codec) :\n" +
" %1$s(%1$s&& codec) SBE_NOEXCEPT :\n" +
" m_buffer(codec.m_buffer),\n" +
" m_bufferLength(codec.m_bufferLength),\n" +
" m_offset(codec.m_offset),\n" +
" m_actingVersion(codec.m_actingVersion){}\n\n" +
" m_actingVersion(codec.m_actingVersion)\n" +
" {\n" +
" codec.reset(%1$s())\n" +
" }\n\n" +
" %1$s& operator=(%1$s&& codec) SBE_NOEXCEPT\n" +
" {\n" +
" m_buffer = codec.m_buffer;\n" +
" m_bufferLength = codec.m_bufferLength;\n" +
" m_offset = codec.m_offset;\n" +
" m_actingVersion = codec.m_actingVersion;\n" +
" if (this != &codec);\n" +
" {\n" +
" reset(codec);\n" +
" codec.reset(%1$s());\n" +
" }\n" +
" return *this;\n" +
" }\n\n" +
"#endif\n\n" +
Expand Down Expand Up @@ -1350,22 +1360,27 @@ private static CharSequence generateConstructorsAndOperators(final String classN
" {\n" +
" reset(codec);\n" +
" }\n\n" +
"#if __cplusplus >= 201103L\n" +
" %1$s(%1$s&& codec)\n" +
" %1$s& operator=(const %1$s& codec) SBE_NOEXCEPT\n" +
" {\n" +
" reset(codec);\n" +
" return *this;\n" +
" }\n\n" +
" %1$s& operator=(%1$s&& codec)\n" +
"#if __cplusplus >= 201103L\n" +
" %1$s(%1$s&& codec) SBE_NOEXCEPT : \n" +
" {\n" +
" reset(codec);\n" +
" return *this;\n" +
" codec.reset(%1$s());\n" +
" }\n\n" +
"#endif\n\n" +
" %1$s& operator=(const %1$s& codec)\n" +
" %1$s& operator =(%1$s&& codec) SBE_NOEXCEPT : \n" +
" {\n" +
" reset(codec);\n" +
" if (this != &codec)\n" +
" {\n" +
" reset(codec);\n" +
" codec.reset(%1$s());\n" +
" }\n" +
" return *this;\n" +
" }\n\n",
" }\n" +
"#endif\n\n",
className);
}

Expand Down