Parse the .dbc file and generate C++ code to represent classes/struct for each message( for target ECU )

  c++, code-generation, codegen

I am trying to generate C++ code from a .dbc file.

e.g. A message is defined like following in .dbc file

BO_ 500 IO_DEBUG: 5 IO
 SG_ IO_DEBUG_test_unsigned : 0|[email protected]+ (1,0) [0|0] "" DBG
 SG_ IO_DEBUG_test_signed : 8|[email protected] (1,-128) [0|0] "" DBG
 SG_ IO_DEBUG_test_float1 : 16|[email protected]+ (0.1,0) [0|0] "" DBG
 SG_ IO_DEBUG_test_float2 : 24|[email protected]+ (0.01,-20.48) [-20.48|20.47] "" DBG
 SG_ IO_DEBUG_test_enum : 38|[email protected]+ (1,0) [0|0] "" DBG

BA_ "FieldType" SG_ 500 IO_DEBUG_test_enum "IO_DEBUG_test_enum";
VAL_ 500 IO_DEBUG_test_enum 2 "IO_DEBUG_test2_enum_two" 1 "IO_DEBUG_test2_enum_one" ;

I am trying to generate C++ code something like this.

//IoDebug.h — ProcessMessageInterface is an interface.

class IoDebug : public ProcessMessageInterface {
   // ProcessMessageInterface implementation
   void processMessage();

   uint8_t testUnSigned;
   int8_t  testSigned;
   float   testFloat1;
   float   testFloat2; 
   IO_DEBUG_test_enum testEnum;


#include "IoDebug.h"

   // like to add signal comparison here.

Is there any dbc parser and code generation tool(s) exists which can generate code like above?

Source: Windows Questions C++