TOC PREV NEXT INDEX


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 mValue that is of the base type that needs to be populated. For example, the Asn1Integer base class contains the following item:

	public long mValue;
 

Therefore, population of any class variable derived from INTEGER can be done by adding.mValue to the end of the left-hand side of the assignment and an integer value on the right. So for the following assignment:

	X ::= INTEGER
 

A variable of the type can either be populated using the constructor with the following statement:

	X x = new X (25);
 

or via direct access of the member variable as follows:

	X x = new X ();
 
	x.mValue = 25;
 

The only primitive type that does not have a single member called mValue to represent its value is BIT STRING. In this case, the Asn1BitString class contains a second variable called numbits to specify the number of bits in the string.


Objective Systems, Inc.

102 Pickering Way, Suite #506
Exton, 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
TOC PREV NEXT INDEX

Copyright © 1997-2005 Objective Systems,Inc.
All Rights Reserved.


This document may be distributed in any form, electronic
or otherwise, provided that it is distributed in its entirety
and that the copyright and this notice are included.