public abstract class Union extends Struct
 Equivalent to C/C++ union; this class works in the same
     way as Struct (sub-class) except that all members are mapped
     to the same location in memory.
Here is an example of C union:
     union Number {
         int   asInt;
         float asFloat;
         char  asString[12];
     };
     public class Number extends Union {
         Signed32   asInt    = new Signed32();
         Float32    asFloat  = new Float32();
         Utf8String asString = new Utf8String(12);
     }Struct, fields are directly accessible:
     Number num = new Number();
     num.asInt.set(23);
     num.asString.set("23"); // Null terminated (C compatible)
     float f = num.asFloat.get();Struct.BitField, Struct.Bool, Struct.Enum16<T extends Enum<T>>, Struct.Enum32<T extends Enum<T>>, Struct.Enum64<T extends Enum<T>>, Struct.Enum8<T extends Enum<T>>, Struct.Float32, Struct.Float64, Struct.Member, Struct.Reference32<S extends Struct>, Struct.Reference64<S extends Struct>, Struct.Signed16, Struct.Signed32, Struct.Signed64, Struct.Signed8, Struct.Unsigned16, Struct.Unsigned32, Struct.Unsigned8, Struct.UTF8StringMAXIMUM_ALIGNMENT| Constructor and Description | 
|---|
Union()
Default constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
isUnion()
Returns  
true. | 
Copyright © 2005-2013 Javolution. All Rights Reserved.