File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed 
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -584,16 +584,25 @@ private void generateChoiceSet(final List<Token> tokens) throws IOException
584584 out .append (generateClassDeclaration (bitSetName ));
585585 out .append (generateFixedFlyweightCode (bitSetName , tokens .get (0 ).encodedLength ()));
586586
587-  out .append (String .format (" \n "  + 
587+  out .append (String .format (
588588 " %1$s &clear()\n "  +
589589 " {\n "  +
590590 " %2$s zero = 0;\n "  +
591591 " std::memcpy(m_buffer + m_offset, &zero, sizeof(%2$s));\n "  +
592592 " return *this;\n "  +
593-  " }\n \n " ,
593+  " }\n " ,
594594 bitSetName ,
595595 cppTypeName (tokens .get (0 ).encoding ().primitiveType ())));
596596
597+  out .append (String .format ("\n "  +
598+  " bool isEmpty() const\n "  +
599+  " {\n "  +
600+  " %1$s val;\n "  +
601+  " std::memcpy(&val, m_buffer + m_offset, sizeof(%1$s));\n "  +
602+  " return 0 == val;\n "  +
603+  " }\n " ,
604+  cppTypeName (tokens .get (0 ).encoding ().primitiveType ())));
605+ 
597606 out .append (generateChoices (bitSetName , tokens .subList (1 , tokens .size () - 1 )));
598607 out .append ("};\n " );
599608 out .append (CppUtil .closingBraces (ir .namespaces ().length )).append ("#endif\n " );
                         You can’t perform that action at this time. 
           
                  
0 commit comments