Language Mapping for Unions
  • The Auction system does not use any IDL unions
    • A sample union in IDL:
        module Test
        {
            union Sample switch (long)
            {
                 case 0: long intVal;
                 case 1: string strVal;
            };
        };
        
  • This is mapped to the class shown in Code Sample 6
    • Each field of the union is mapped to a pair of methods
      • One for setting the value
      • One for getting the value
    • Actually the string valued field gets a number of routines for setting the value because of memory management issues
    • There are also methods for getting/setting the descriminant
    • And finally, various constructors and an assignment operator

Next Slide >>