Generated encode functions are invoked through the class interface by calling the base class Encode method. The calling sequence for this method is as follows:
stat = <object>.Encode ();
In this definition, <object> is an object of the class generated for the given
production. The function result variable stat
returns the status value
from the OER encode function. This status value will be 0 (0) if encoding was
successful or a negative error status value if encoding fails. Return status values
are defined in the "asn1type.h" include file.
The user must call the encode buffer class methods getMsgPtr and getMsgLen to obtain the starting address and length of the encoded message component.
If the code is generated using the -coer switch, then the encoding will be canonical. If the code is generated using the -oer switch, the encoding can be made canonical by setting the appropriate flag in the context prior to calling the encode function:
ASN1OEREncodeBuffer encodeBuffer;; OSCTXT* pctxt = encodeBuffer.getCtxtPtr(); rtxCtxtSetFlag(pctxt, ASN1CANON);