// **********************************************************************
//
// Copyright (c) 1999
// Object Oriented Concepts, Inc.
// Billerica, MA, USA
//
// All Rights Reserved
//
// **********************************************************************

const long ConstLong = -1234;
const unsigned long ConstULong = (5432 + ConstLong ) * 100 % 124;
const double ConstDouble = 50.23 - ConstLong * (ConstULong - 3.14);
const float ConstFloat = ConstDouble * 1.11;
const short ConstShort = -23 % 10;
const boolean ConstBoolean = TRUE;
const string ConstString = "This is ConstString";

interface TestConstInterface
{
    const long ConstLong = (0xf | 0xf000) & 0xfffe;
    const char ConstChar1 = 'c';
    const char ConstChar2 = '\n';
    const char ConstChar3 = '\377';
    const char ConstChar4 = '\x88';
    const char ConstChar5 = '\'';
    const string ConstString = "\n\t\v\b\r\f\a\\\?\'\"\xff\377\7";
};

struct TestStruct1
{
    short s;
    long l;
    double d;
    boolean b;
    char c;
    octet o;
    string str;
};

enum TestEnum
{
    A, B, C
};

typedef sequence<octet> OctetSeq;
typedef sequence<char> CharSeq;
typedef sequence<double> DoubleSeq;
typedef sequence<TestStruct1> TestStruct1Seq;
typedef sequence<TestEnum> TestEnumSeq;

typedef string<10> BoundedString;

typedef sequence<double, 10> Double10Seq;
typedef sequence<Double10Seq, 10> Double10Seq10Seq;
typedef sequence<TestStruct1, 20> TestStruct120Seq;
typedef sequence<TestEnum, 30> TestEnum30Seq;
typedef sequence<string, 40> String40Seq;

typedef double DoubleArray[10][20][30];

struct TestStruct2
{
    TestStruct1 s;
    any a;
    DoubleArray da;
    string sa[100];
};

typedef sequence<TestStruct2> TestStruct2Seq;

struct TestStruct3
{
    long l;
    sequence<TestStruct3> seq;
};

struct TestStruct4
{
    TestStruct3 a;
    sequence< TestStruct3 > b;
};

interface TestInterface;

union TestUnion1 switch(long)
{
case -1: long l;
case -2: DoubleArray a;
case -3: string s;
case 0:
case 1:
case 2:
case 3:
case -4:
case -5: TestStruct2 str;
default: CORBA::TypeCode tc;
};

union TestUnion2 switch(TestEnum)
{
case A:
case B: sequence<long> seq;
case C: TestUnion1 un;
};

union TestUnion3 switch(char)
{
case 'a':
case 'b': char c;
case 'c': any a;
case 'd': string ar[10][20];
case 'x': string s;
};

union TestUnion4 switch(short)
{
case 0: sequence<TestUnion4> seq;
case 1: char c;
};

interface TestInterface
{
    enum TestEnum
    {
	TestEnum1,
	TestEnum2,
	TestEnum3
    };

    struct FixedStruct
    {
	short s;
	long l;
    };

    struct VariableStruct
    {
	string s;
    };

    union FixedUnion switch(unsigned short)
    {
    case 0: short s;
    case 1: long l;
    case 2: double d;
    case 3: FixedStruct st;
    default: boolean b;
    };

    union VariableUnion switch(boolean)
    {
    case FALSE: TestInterface ti;
    case TRUE: VariableStruct st;
    };

    typedef sequence<string> StringSequence;
    typedef short FixedArray[2][3][4];
    typedef string VariableArray[2][3];
    typedef sequence<FixedArray> FixedArraySequence;
    typedef sequence<VariableArray> VariableArraySequence;

    // --------------------------------------------------
    void opVoid();
    
    // --------------------------------------------------
    StringSequence opContext(in string pattern) context("A*", "C*", "X", "Z");
    
    // --------------------------------------------------
    attribute short attrShort;
    short opShort(in short a0,
		  inout short a1,
		  out short a2);
    
    // --------------------------------------------------
    attribute long attrLong;
    long opLong(in long a0,
		inout long a1,
		out long a2);
    
    // --------------------------------------------------
    attribute unsigned short attrUShort;
    unsigned short opUShort(in unsigned short a0,
			    inout unsigned short a1,
			    out unsigned short a2);
    
    // --------------------------------------------------
    attribute unsigned long attrULong;
    unsigned long opULong(in unsigned long a0,
			  inout unsigned long a1,
			  out unsigned long a2);
    
    // --------------------------------------------------
    attribute float attrFloat;
    float opFloat(in float a0,
		  inout float a1,
		  out float a2);
    
    // --------------------------------------------------
    attribute double attrDouble;
    double opDouble(in double a0,
		    inout double a1,
		    out double a2);
    
    // --------------------------------------------------
    attribute boolean attrBoolean;
    boolean opBoolean(in boolean a0,
		      inout boolean a1,
		      out boolean a2);
    
    // --------------------------------------------------
    attribute char attrChar;
    char opChar(in char a0,
		inout char a1,
		out char a2);
    
    // --------------------------------------------------
    attribute octet attrOctet;
    octet opOctet(in octet a0,
		  inout octet a1,
		  out octet a2);

    // --------------------------------------------------
    attribute string attrString;
    string opString(in string a0,
		    inout string a1,
		    out string a2);

    // --------------------------------------------------
    attribute any attrAny;
    any opAny(in any a0,
	      inout any a1,
	      out any a2);
    
    // --------------------------------------------------
    attribute TestEnum attrTestEnum;
    TestEnum opTestEnum(in TestEnum a0,
			inout TestEnum a1,
			out TestEnum a2);
    
    // --------------------------------------------------
    attribute TestInterface attrTestInterface;
    TestInterface opTestInterface(in TestInterface a0,
				  inout TestInterface a1,
				  out TestInterface a2);
    
    // --------------------------------------------------
    attribute FixedStruct attrFixedStruct;
    FixedStruct opFixedStruct(in FixedStruct a0,
			      inout FixedStruct a1,
			      out FixedStruct a2);
    
    // --------------------------------------------------
    attribute VariableStruct attrVariableStruct;
    VariableStruct opVariableStruct(in VariableStruct a0,
				    inout VariableStruct a1,
				    out VariableStruct a2);
    
    // --------------------------------------------------
    attribute FixedUnion attrFixedUnion;
    FixedUnion opFixedUnion(in FixedUnion a0,
			    inout FixedUnion a1,
			    out FixedUnion a2);
    
    // --------------------------------------------------
    attribute VariableUnion attrVariableUnion;
    VariableUnion opVariableUnion(in VariableUnion a0,
				  inout VariableUnion a1,
				  out VariableUnion a2);
    
    // --------------------------------------------------
    attribute StringSequence attrStringSequence;
    StringSequence opStringSequence(in StringSequence a0,
				    inout StringSequence a1,
				    out StringSequence a2);
    
    // --------------------------------------------------
    attribute FixedArray attrFixedArray;
    FixedArray opFixedArray(in FixedArray a0,
 			    inout FixedArray a1,
 			    out FixedArray a2);
    
    // --------------------------------------------------
    attribute VariableArray attrVariableArray;
    VariableArray opVariableArray(in VariableArray a0,
 				  inout VariableArray a1,
 				  out VariableArray a2);

    // --------------------------------------------------
    attribute FixedArraySequence attrFixedArraySequence;
    FixedArraySequence
	opFixedArraySequence(in FixedArraySequence a0,
			     inout FixedArraySequence a1,
			     out FixedArraySequence a2);
    
    // --------------------------------------------------
    attribute VariableArraySequence attrVariableArraySequence;
    VariableArraySequence
	opVariableArraySequence(in VariableArraySequence a0,
				inout VariableArraySequence a1,
				out VariableArraySequence a2);

    // --------------------------------------------------
    void deactivate();
};
