TOC PREV NEXT INDEX


Procedure for Using the C++ Interface



SAX handler methods are added to the C++ control class generated for each ASN.1 production.

The procedure to invoke the generated decode method is similar to that for the other encoding rules. It is as follows:






A program fragment that could be used to decode an employee record is as follows:

int main (int argc, char* argv[])
 
{
 
   const char*  filename = "employee.xml";
 
   int          stat;
 

 
   // steps 1, 2, and 3: instantiate an instance of the XER  
 
   // decoding classes.  This example specifies an XML file 
 
   // as the message input source..
 

 
   ASN1T_PersonnelRecord employee;
 
   ASN1XERDecodeBuffer decodeBuffer (filename);
 
   ASN1C_PersonnelRecord employeeC (decodeBuffer, employee);
 

 
   // step 4: invoke the decode method
 

 
   stat = employeeC.Decode ();
 

 
   if (0 == stat) {
 
      employeeC.Print ("employee");
 
   }
 
   else
 
      decodeBuffer.printErrorInfo ();
 

 
   // step 5: dynamic memory is released when employeeC and 
 
   // decode buffer objects go out of scope.
 

 
   return (stat);
 

 
}
 


Objective Systems, Inc.

55 Dowlin Forge Road
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