Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

Using Self Defining Data Structures to Map APIs to Objects

IP.com Disclosure Number: IPCOM000107644D
Original Publication Date: 1992-Mar-01
Included in the Prior Art Database: 2005-Mar-22
Document File: 2 page(s) / 63K

Publishing Venue

IBM

Related People

Baber, RL: AUTHOR [+2]

Abstract

The data structures returned as a result of an API call are often very complex. When such an API is called from an Object-Oriented (OO) language, knowledge of the sizes of each part of the data structure must be explicitly known by the caller. This violates the principle of data encapsulation and makes for difficult maintenance since the caller's source code must be modified for every change in the structures returned by the API. A simple change of compilers could be enough to alter the offsets of the structure and require such a maintenance effort.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 56% of the total text.

Using Self Defining Data Structures to Map APIs to Objects

       The data structures returned as a result of an API call
are often very complex.  When such an API is called from an
Object-Oriented (OO) language, knowledge of the sizes of each part of
the data structure must be explicitly known by the caller.  This
violates the principle of data encapsulation and makes for difficult
maintenance since the caller's source code must be modified for every
change in the structures returned by the API.  A simple change of
compilers could be enough to alter the offsets of the structure and
require such a maintenance effort.

      The solution is to write a simple C buffer to interface between
the OO program and the API.  This C buffer implements self-describing
data structures; that is, it maps the complicated API returns into a
simple linked list.  Each node of the linked list is instantiated
into an object by the OO program.  Three pieces of information must
be shared between the OO program and the C buffer for this to take
place.  They are:
      1)   Which API from the set of those supported by the C buffer
is to be called.
      2)   Sizes of the individual data fields within a linked list
node.
      3)   The address of the each node in the linked list. The first
item is passed as a code number from the OO program to the C buffer.
The C buffer makes the proper API call, receives the data in return,
builds a linked list and copies the dat...