File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -669,6 +669,24 @@ private void generateChoiceSet(final List<Token> tokens) throws IOException
669669 " }\n " ,
670670 cppTypeName (tokens .get (0 ).encoding ().primitiveType ())));
671671
672+ out .append (String .format ("\n " +
673+ " SBE_NODISCARD %1$s rawValue() const\n " +
674+ " {\n " +
675+ " %1$s val;\n " +
676+ " std::memcpy(&val, m_buffer + m_offset, sizeof(%1$s));\n " +
677+ " return val;\n " +
678+ " }\n " ,
679+ cppTypeName (tokens .get (0 ).encoding ().primitiveType ())));
680+
681+ out .append (String .format ("\n " +
682+ " %1$s &rawValue(%2$s value)\n " +
683+ " {\n " +
684+ " std::memcpy(m_buffer + m_offset, &value, sizeof(%2$s));\n " +
685+ " return *this;\n " +
686+ " }\n " ,
687+ bitSetName ,
688+ cppTypeName (tokens .get (0 ).encoding ().primitiveType ())));
689+
672690 out .append (generateChoices (bitSetName , tokens .subList (1 , tokens .size () - 1 )));
673691 out .append (generateChoicesDisplay (bitSetName , tokens .subList (1 , tokens .size () - 1 )));
674692 out .append ("};\n " );
You can’t perform that action at this time.
0 commit comments