[Enterprise Extensions only]

Container::create_enum

Overview The create_enum operation creates a new enumeration definition (EnumDef) in the Interface Repository.
Original interface CORBA module: Container Interface
Exceptions CORBA::SystemException


Intended Usage

The create_enum operation creates a new enumeration definition in the Interface Repository persistent database, and returns a pointer to a new EnumDef object associated with the enumeration definition.

IDL Syntax

  EnumDef create_enum (in RepositoryId id,
                       in Identifier name,
                       in VersionSpec version,
                       in EnumMemberSeq members);

Input parameters

members
This is a reference to a CORBA::EnumMemberSeq that provides the list of the elements will comprise the new enumeration (EnumDef). The length of the CORBA::EnumMemberSeq must be greater than zero. The CORBA::EnumMemberSeq contains a distinct name for each possible value of the enumeration.
name
The name that will be associated with this EnumDef object in the Interface Repository.
id
The id represents the CORBA::RepositoryId that will uniquely identify this EnumDef within the Interface Repository.
version
The version number that will be associated with this EnumDef object in the Interface Repository.

Return values

EnumDef_ptr
A pointer to the created EnumDef object is returned to the caller. The memory associated with this object can later be released by invoking CORBA::release.

Example

  // C++
     // assume that 'repository_ptr' had already been intitialized . . .
     CORBA::Repository * repository_ptr;
 
     // establish the id, name, and version values for the enumeration
     CORBA::RepositoryId rep_id;
     CORBA::Identifier name;
     CORBA::VersionSpec version;
     rep_id = CORBA::string_dup ("unique RepositoryID for my enumeration");
     name = CORBA::string_dup ("enumeration new");
     version = CORBA::string_dup ("1.0");
 
     /// instantiate an EnumMemberSeq and set the length to 2
     CORBA::EnumMemberSeq enum_members;
     enum_members.length(2);
 
     // establish the EnumMemberSeq to represent an enumeration with two 
     // elements
     enum_members[0] = (char *) CORBA::string_dup ("enum_value_0");
     enum_members[1] = (char *) CORBA::string_dup ("enum_value_1");
 
     // create the new enumeration . . .
     CORBA::EnumDef * new_enum;
     new_enum = repository_ptr-> create_enum (rep_id, name, version, 
        enum_members);