Union Type
An xsd:union type is used to specify that one of several simple types can be used for a specific value. This type is mapped to a C structured type that contains an identifier for the selected type and a union of all of the possible types. Atomic types (i.e. those that use a single processor storage unit such as integer or Boolean) are stored as values in the union whereas compound or structured types (such as the structure used to represent a hexBinary type) are stored as pointers.
The general mapping is as follows:
1. Where typename begins with a lowercase letter above (for example, Type1 is shown as type1 in places), it means the actual typename is used with the first letter set to lowercase.
2. The choice tag constants (T_TypeName_type) are the identifiers of each of the particular values in the union. The selected value is stored in the t member variable of the generated structure. In the case of C++, the tag values are in the form of an enum construct within the class containing enumerations of the form T_type.
3. The member variables in the union may be stored as values (if atomic) or as pointers to a value of the item (if structured).
Copyright © Objective Systems 2002-2008 This document may be distributed in any form, electronic or otherwise, provided that it is distributed in its entirety and that the copyright and this notice are included. |
Objective Systems, Inc.55 Dowlin Forge RoadExton, 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 |