CORBA enumerations can be used in many situations. The following examples show how to use the enumeration that appears in the Project Catalog after the IDL is cataloged.
module CorbaTests
{
interface EnumTest
{
enum Slot { s1, s2, s3 };
union UnionTest switch(Slot)
{
case s1: string stringMember;
case s2: long longMember;
default: boolean booleanMember;
};
void enumOp(in Slot aSlot);
void unionOp(in UnionTest aUnionTest);
Slot retEnumOp(in Slot aSlot);
void outEnumOp(out Slot aSlot);
void inoutEnumOp(inout Slot aSlot);
};
};
s1 = Module1.CorbaTests.EnumTest.Slot.s1
enumTest = Module1.CorbaTests.EnumTest("EnumTest")
enumOp enumTest using aSlot = s1
enumTest = Module1.CorbaTests.EnumTest("EnumTest")
outEnumOp enumTest returning s3 = aSlot
enumTest = Module1.CorbaTests.EnumTest("EnumTest")
inoutEnumOp enumTest using aSlot = s2 returning s4 = aSlot
s2 = Module1.CorbaTests.EnumTest.Slot.s2
enumTest = Module1.CorbaTests.EnumTest("EnumTest")
retEnumOp enumTest using aSlot = s2 returning s1
enumTest = Module1.CorbaTests.EnumTest("EnumTest")
unionTest = Module1.CorbaTests.EnumTest.UnionTest()
unionTest.longMember = 10
unionOp enumTest using aUnionTest = unionTest
unionTest.stringMember = "aString"
unionOp enumTest using aUnionTest = unionTest
unionTest.booleanMember = true
unionOp enumTest using aUnionTest = unionTest