
Populating Generated Variables for Encoding
Populating generated variables for encoding can be done in most cases either through the object constructors or directly by assigning an object reference to a public member variable.
Constructors are provided for most generated types to allow direct population of the encapsulated member variable(s) on initialization. The exception is the classes generated for SEQUENCE OF or SET OF. These only allow the size of an array to be specified - population of the array elements must be done manually.
All of the base run-time classes except Asn1Null contain public member variables. In practically all cases there is a single variable called value that is of the base type that needs to be populated. For example, the Asn1Integer base class contains the following item:
public long value;Therefore, population of any class variable derived from INTEGER can be done by adding.value to the end of the left-hand side of the assignment and an integer value on the right. So for the following assignment:
X ::= INTEGERX x = new X (25);X x = new X (); x.value = 25;
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 |