Chapter 21. Generated Sample Programs

The –writer and -reader options cause writer and reader sample programs to be generated.

The writer program contains sample code to populate and encode an instance of ASN.1 data. The main purpose is to provide a code template to users for writing code to populate objects. This is quite useful to users because generated classes can become very complex as the ASN.1 schemas become more complex. The writer code also shows users how to instantiate an encode buffer object and how to use encode functions. The writer program writes the encoded data to a file. If the writer program is generated by using both -writer and -getset options, then the generated writer program uses getset functions to populate data.

The reader program on the other hand reads the encoded data from a file. It shows users how to use a decode buffer object to decode data and populate the corresponding class object. On successful decode, it prints the decoded data to standard output.