Next: 4.9 Mapping for Sequences Up: 4. OMG IDL to Previous: 4.7 Mapping for Unions

#
4.8 Mapping for Structures

An IDL structure is mapped into a Python class. The Python class contains a public attribute for each member of the structure. The class's constructor takes a parameter for each member of the structure in the order listed in the IDL. e.g. consider the following IDL:

    module Example {
        struct Foo {
            string bar;
            long baz;
        };
    };

In Python the structure can be used as follows:

    >>> import Example
    >>> struct = Example.Foo("Hello", 99)
    >>> struct.bar
    `Hello'
    >>> struct.baz
    99
    >>> struct.bar = "Goodbye"
    >>> struct.bar
    `Goodbye'
    >>>