TOC PREV NEXT INDEX


Information Object


NOTE: Information Object code generation is available for -tables option only.
 
This additional code is generated to support the processing required to verify table constraints. This is intended for use only in compiler-generated code. Therefore, it is not necessary for the average user to understand the mappings in order to use the product. The information presented here is informative only to provide a better understanding of how the compiler handles table constraints.
 


Information Object code will be generated in a header and source file with a C struct / C++ class to hold the values. The name of the header and source file are of the following format:

<ModuleName>Table.h
<ModuleName>Table.c/cpp

In this definition, <ModuleName> would be replaced with the name of the ASN.1 module in which the information object is defined.

C Code Generation:
For C, a global variable is generated to hold the information object definition. This is very similar to the code generated for a value definition.

An example of an information object definition that is derived from the ASN.1 ATTRIBUTE class above is as follows:

    name ATTRIBUTE  ::=  {
 
        WITH SYNTAX     VisibleString
 
        ID              { 0 1 1 } }
 

This results in the generation of the following C constant:
   
 
   ATTRIBUTE name;
 

 
Code generated in information object initialization function:
   
 
   name.TypeSize = sizeof(_name_Type);
 
   name.encodeType = &asn1E__name_Type;
 
   name.decodeType = &asn1D__name_Type;
 
   name.id.numids = 3;
 
   name.id.subid[0] = 0;
 
   name.id.subid[1] = 1;
 
   name.id.subid[2] = 1;
 

 
C++ Code Generation:
The C++ classes generated for ASN.1 information objects are derived from the ASN.1 class objects. The constructors in these classes populate the fixed-type field member variables with the values specified in the information object. The classes also implement the virtual methods generated for the information object type fields. All non-optional methods are required to be implemented. The optional methods are only implemented if they are defined in the information object definition.

An example of an information object definition that is derived from the ASN.1 class above is as follows:

    name ATTRIBUTE  ::=  {
 
        WITH SYNTAX     VisibleString
 
        ID              { 0 1 1 } }
 

This results in the generation of the following C++ class:

class EXTERN name : public ATTRIBUTE {
 
 public:
 
   name();
 

 
   virtual int encodeBERType
 
      (ASN1CTXT* pctxt, ASN1TObject& object);
 

 
   virtual int decodeBERType
 
      (ASN1CTXT* pctxt, ASN1TObject& object);
 
} ;
 

The constructor implementation for this class (not shown) sets the fixed type fields (id) to the assigned values ({0 1 1}). The class also implements the virtual methods for the type field virtual methods defined in the base class. These methods simply call the BER encode or decode method for the assigned type (this example assumes -ber was specified for code generation - other encode rules could have been used as well).

Generated Type Assignments

If the information object contains an embedded type definition, it is extracted from the definition to form a new type to be added to the generated C or C++ code. The format of the new type name is as follows:

	_<ObjectName>_<FieldName>
 

 
where <ObjectName> is replaced with the information object name and <FieldName> is replaced with the name of the field from within the object.


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