
Generated C++ files
In general, the generation logic for C++ is similar to the logic for C. Instead of the .c file extension, .cpp is used:
<moduleName>.cpp Common definitions and functions (for example, asn1Free_<type>) and/or global value constant definitions. This file also contains constructors, destructors and all methods for ASN1C_<Type> and ASN1T_<Type> control classes.
<moduleName>Dec.cpp C decode functions and C++ decode methods.
If additional options are used (such as -genPrint, -genCopy, etc), additional files will be generated:
<moduleName>Copy.c pp copy functions, generated if -genCopy is specified
<moduleName>Print.cpp print functions, generated if -genPrint is specified
<moduleName>Compare.cpp comparison functions, generated if -genCompare is specified
<moduleName>PrtToStr.cpp print-to-string functions, generated if -genPrtToStr is specified
<moduleName>PrtToStrm.cpp print-to-stream functions, generated if -genPrtToStrm is specified
<moduleName>Table.cpp table constraint functions, generated if -genTable option is specified
The -maxcfiles option for C++ works very similar to how it works for C. The only differences are a few additional files are generated and the .cpp extension is used instead of .c. Additional files are generated to hold ASN1C_<Type> and ASN1T_<Type> control classes. The format of the filenames of these files is as follows:
asn1<suffix>_<prodname>.cpp ASN1C_<prodname>.cpp ASN1T_<prodname>.cppFor the example presented previously in the C Files section, the following files would be generated for the Name production in the Employee.asn file:
asn1D_Name.cpp asn1E_Name.cpp ASN1T_Name.cpp ASN1C_Name.cppThese contain the functions to decode Name and encode Name respectively. The ASN1T_Name.cpp file contains the type class methods, and the ASN1C_Name.cpp files contains the control class methods. Note that not all productions have a control class (only PDU types do for BER or PER) therefore the ASN1C_<type>.cpp file may not be generated.
Note that for C++, the code reduction effect is less than that for pure C. This is because most of the linkers cannot omit virtual methods even if they are not being used by the application. These virtual methods refer to separate C functions and these functions are being linked into the application even if they are not actually used. But, still, the size of the final application created with -maxcfiles option should be less than the size of the application created without this option.
Objective Systems, Inc.102 Pickering Way, Suite #506Exton, Pennsylvania 19341 http://www.obj-sys.com Phone: (484) 875-9841 Toll-free: (877) 307-6855 (US only) Fax: (484) 875-9830 info@obj-sys.com |