TOC PREV NEXT INDEX


Information Object Set


NOTE: Information Object Set code generation is available for -tables option only.
 
This additional code is generated to support the processing required to verify table constraints. This code 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.
 


Table constraint processing code to support Information Object Sets is 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:
A C global variable is generated containing an array of values for the ASN.1 CLASS definition. Each structure in the array is the equivalent C structure representing the corresponding ASN.1 information object

As of this writing, a static array is used to hold the objects, but this could be changed to something like a linked list or hash.

An example of an Information Object Set definition that is derived from the ASN.1 ATTRIBUTE class above is as follows:

   SupportedAttributes  ATTRIBUTE  ::= { name | commonName }
 

This results in the generation of the following C constant:

   ATTRIBUTE SupportedAttributes[2];
 
   int SupportedAttributes_Size = 2;
 

 
Code generated in the Information Object Set initialization function:
    
 
   SupportedAttributes[0].TypeSize = sizeof(_name_Type);
 
   SupportedAttributes[0].encodeType = &asn1E__name_Type;
 
   SupportedAttributes[0].decodeType = &asn1D__name_Type;
 
   SupportedAttributes[0].id.numids = 3;
 
   SupportedAttributes[0].id.subid[0] = 0;
 
   SupportedAttributes[0].id.subid[1] = 1;
 
   SupportedAttributes[0].id.subid[2] = 1;
 

 
   SupportedAttributes[1].TypeSize = sizeof(_commonName_Type);
 
   SupportedAttributes[1].encodeType = &asn1E__commonName_Type;
 
   SupportedAttributes[1].decodeType = &asn1D__commonName_Type;
 
   SupportedAttributes[1].id.numids = 3;
 
   SupportedAttributes[1].id.subid[0] = 0;
 
   SupportedAttributes[1].id.subid[1] = 1;
 
   SupportedAttributes[1].id.subid[2] = 1;
 
   SupportedAttributes[1].id.subid[3] = 1;
 

C++ Code Generation:
In C++, ASN.1 information object sets are mapped to C++ classes. In this case, a C++ singleton class is generated. This class contains a container to hold an instance of each of the ASN.1 information object C++ objects. As of this writing, a static array is used to hold the objects, but this could be changed to something like a linked list or hash without affecting the public interface to the class. The class also contains an object lookup method for each of the key fields. Key fields are identified in the class as either a) fields that are marked unique, or b) fields that are referenced in table constraints with the `@' notation.

The generated constructor initializes all required values and information objects.

An example of an information object set that uses the information object class defined above is as follows:

   SupportedAttributes  ATTRIBUTE  ::= { name | commonName }
 

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

   class EXTERN SupportedAttributes {
 
    protected:
 
      ATTRIBUTE* mObjectSet[2];
 
      const size_t mNumObjects;
 
      static SupportedAttributes* mpInstance;
 
      SupportedAttributes (ASN1CTXT* pctxt);
 

 
    public:
 
      ATTRIBUTE* lookupObject (ASN1TObjId _id);
 

 
      static SupportedAttributes* instance(ASN1CTXT* pctxt);
 
   } ;
 

 

The mObjectSet array is the container for the information object classes. These objects are created and this array populated in the class constructor. Note that this is a singleton class (as evidenced by the protected constructor and instance methods). Therefore, the object set array is only initialized once the first time the instance method is invoked.

The other method of interest is the lookupObject method. This was generated for the id field because it was identified as a key field. This determination was made because id was declared to be UNIQUE in the class definition above. A field can also be determined to be a key field if it is referenced via the `@' notation in a table constraint in a standard type definition. For example, in the following element assignment:

argument OPERATION.&Type ({SupportedAttributes}{@opcode})

the opcode element's ATTRIBUTE class field is identified as a key field.


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