Generated C++ decoding methods use the control classes
and the OSJSONDecodeBuffer
and OSJSONInputStream
classes to accomplish decoding,
as in the following code snippet:
OSJSONDecodeBuffer encodeBuffer (filename); decodeBuffer.setDiag (verbose); ASN1T_PersonnelRecord msgData; ASN1C_PersonnelRecord employee (decodeBuffer, msgData); /* Populate structure of generated type here */ // Decode if ((stat = employee.Decode ()) == 0) { if (trace) { printf ("Encoding was successful\n"); printf ("%s\n", (const char *)decodeBuffer.getMsgPtr()); } }
The generated control class
(ASN1C_PersonnelRecord
) contains methods for
encoding (Encode
). It unites the message data
(held in ASN1T_PersonnelRecord
) and the encoding
buffer (OSJSONEncodeBuffer
) to encode the JSON
message.