//---------------------------------------------------------------------------
// Copyright (C) DSTC Pty Ltd (ACN 052 372 577) 1997, 1998, 1999
// All Rights Reserved.
//
// The software contained on this media is the property of the DSTC Pty
// Ltd.  Use of this software is strictly in accordance with the
// license agreement in the accompanying LICENSE.HTML file.  If your
// distribution of this software does not contain a LICENSE.HTML file
// then you have no rights to use this software in any manner and
// should contact DSTC at the address below to determine an appropriate
// licensing arrangement.
// 
//      DSTC Pty Ltd
//      Level 7, GP South
//      Staff House Road
//      University of Queensland
//      St Lucia, 4072
//      Australia
//      Tel: +61 7 3365 4310
//      Fax: +61 7 3365 4311
//      Email: enquiries@dstc.edu.au
// 
// This software is being provided "AS IS" without warranty of any
// kind.  In no event shall DSTC Pty Ltd be liable for damage of any
// kind arising out of or in connection with the use or performance of
// this software.
//
// Project:      Fnorb
// File:         $Source: /units/arch/src/Fnorb/examples/unions/RCS/Unions.idl,v $
// Version:      @(#)$RCSfile: Unions.idl,v $ $Revision: 1.5 $
//
//---------------------------------------------------------------------------

#pragma prefix "dstc.edu.au"

module Unions {

	// Union with a boolean discriminator and complete case coverage.
	union A switch(boolean) {

	case TRUE:
		short t;

	case FALSE:
		string f;

	};

	// Union with a boolean discriminator and incomplete case coverage.
	union B switch(boolean) {

	case TRUE:
		short t;

	};

	// Union with a boolean discriminator and a default case.
	union C switch(boolean) {

	case TRUE:
		short t;

	default:
		string d;

	};

	// An enum for switching.
	enum color {red, green, blue};

	// Union with an enum discriminator and complete case coverage.
	union D switch(color) {

	case red:
		short r;

	case green:
		float g;

	case blue:
		string b;
	};

	// Union with an enum discriminator and incomplete case coverage.
	union E switch(color) {

	case red:
		short r;
	};

	// Union with an enum discriminator and a default case.
	union F switch(color) {

	case red:
		short r;

	default:
		string d;
	};

	// Define an interface using the unions.
	interface test {
	
		// 'in' parameters.
		void in_a(in A a);
		void in_b(in B b);
		void in_c(in C c);
		void in_d(in D d);
		void in_e(in E e);
		void in_f(in F f);

		// 'inout' parameters.
		void inout_a(inout A a);
		void inout_b(inout B b);
		void inout_c(inout C c);
		void inout_d(inout D d);
		void inout_e(inout E e);
		void inout_f(inout F f);

		// 'out' parameters.
		void out_a(out A a);
		void out_b(out B b);
		void out_c(out C c);
		void out_d(out D d);
		void out_e(out E e);
		void out_f(out F f);

		// Return values.
		A return_a();
		B return_b();
		C return_c();
		D return_d();
		E return_e();
		F return_f();
	};
};
