Next Previous Up Top Contents Index

A.4 Mapping in more detail

A.4.13 Mapping for struct

An IDLstruct is mapped to a Lisp type whose name is the corresponding scoped symbol. Each member of thestruct is mapped to an initialization keyword, a reader, and a writer. The initialization keyword is a symbol whose name is the name of the member and whose package is the keyword package.

The reader is named by a symbol that follows the conventions for attribute accessors. In the case of a reader, its package is the operation package, and its name is the name of the member. The writer is formed by usingsetf on the generalized place named by the reader.

The typecorba:struct is supertype of all such generated types.

An IDLstruct has a corresponding constructor whose name is the same as the name of the mapped Lisp type. This constructor takes keyword arguments whose package is the keyword package and whose name equals the name of the corresponding member.

For example, in IDL:

module structmodule{
  struct struct_type {
    long field1;
    string field2;
  };
};

In generated Lisp:

(defpackage :structmodule)
(defstruct structmodule:struct_type ...)

And a usage example:

(setq struct (structmodule:struct_type
  :field1 100000
  :field2 "The value of field2"))

(op:field1 struct) > 100000

(setf (op:field1 struct) -500) > -500

(op:field1 struct) > -500


Developing Component Software with CORBA - 22 Jan 1999

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker