Previous Table of Contents Next


10.5.4 Container


   The base interface Container is used to form a containment hierarchy in the Interface Repository. A Container can contain any number of objects derived from the Contained interface. All Containers, except for Repository, are also derived from Contained.

   module CORBA { typedef sequence <Contained> ContainedSeq;

   interface Container : IRObject { // read interface

   Contained lookup (in ScopedName search_name);

   ContainedSeq contents ( in DefinitionKind limit_type, in boolean exclude_inherited

   );

   ContainedSeq lookup_name ( in Identifier search_name, in long levels_to_search, in DefinitionKind limit_type, in boolean exclude_inherited

   );

   struct Description { Contained contained_object; DefinitionKind kind; any value;

   }; typedef sequence<Description> DescriptionSeq;

   DescriptionSeq describe_contents ( in DefinitionKind limit_type, in boolean exclude_inherited, in long max_returned_objs

   );

   // write interface

   ModuleDef create_module ( in RepositoryId id, in Identifier name, in VersionSpec version

   );

   ConstantDef create_constant ( in RepositoryId id, in Identifier name, in VersionSpec version, in IDLType type, in any value

   );

   StructDef create_struct ( in RepositoryId id, in Identifier name, in VersionSpec version, in StructMemberSeq members

   );

   UnionDef create_union ( in RepositoryId id, in Identifier name, in VersionSpec version, in IDLType discriminator_type, in UnionMemberSeq members

   );

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

   );

   AliasDef create_alias ( in RepositoryId id, in Identifier name, in VersionSpec version, in IDLType original_type );

   InterfaceDef create_interface (

   in RepositoryId id,

   in Identifier name,

   in VersionSpec version,

   in InterfaceDefSeq base_interfaces, );

   ExceptionDef create_exception(

   in RepositoryId id,

   in Identifier name,

   in VersionSpec version,

   in StructMemberSeq members );

   ValueDef create_value(

   in RepositoryId id,

   in Identifier name,

   in VersionSpec version,

   in boolean is_custom,

   in boolean is_abstract,

   in ValueDef base_value,

   in boolean is_truncatable,

   in ValueDefSeq abstract_base_values,

   in InterfaceDefSeq supported_interfaces,

   in InitializerSeq initializers );

   ValueBoxDef create_value_box(

   in RepositoryId id,

   in Identifier name,

   in VersionSpec version,

   in IDLType original_type_def );

   NativeDef create_native(

   in RepositoryId id,

   in Identifier name,

   in VersionSpec version );

   AbstractInterfaceDef create_abstract_interface(

   in RepositoryId id,

   in Identifier name,

   in VersionSpec version,

   in AbstractInterfaceDefSeq base_interfaces, );

   LocalInterfaceDef create_local_interface( in RepositoryId id,

   in Identifier name,

   in VersionSpec version,

   in InterfaceDefSeq base_interfaces

   );

   ExtValueDef create_ext_value (

in RepositoryId id,
in Identifier name,
in VersionSpec version,
in boolean is_custom,
in boolean is_abstract,
in ValueDef base_value,
in boolean is_truncatable,
in ValueDefSeq abstract_base_values,
in InterfaceDefSeq supported_interfaces,
in ExtInitializerSeq initializers
);
};
};

   10.5.4.1 Read Interface

   The lookup operation locates a definition relative to this container given a scoped name using OMG IDL’s name scoping rules. An absolute scoped name (beginning with “::?) locates the definition relative to the enclosing Repository. If no object is found, a nil object reference is returned.

   The contents operation returns the list of objects directly contained by or inherited into the object. The operation is used to navigate through the hierarchy of objects. Starting with the Repository object, a client uses this operation to list all of the objects contained by the Repository, all of the objects contained by the modules within the Repository, and then all of the interfaces and value types within a specific module, and so on.

   limit_type If limit_type is set to dk_all “all,? objects of all interface types are returned. For example, if this is an InterfaceDef, the attribute, operation, and exception objects are all returned. If limit_type is set to a specific interface, only objects of that interface type are returned. For example, only attribute objects are returned if limit_type is set to dk_Attribute “AttributeDef?.

   exclude_inherited If set to TRUE, inherited objects (if there are any) are not returned. If set to FALSE, all contained objects—whether contained due to inheritance or because they were defined within the object—are returned.

   The lookup_name operation is used to locate an object by name within a particular object or within the objects contained by that object. Use of values of levels_to_search of 0 or of negative numbers other than -1 is undefined.

search_name Specifies which name is to be searched for.
levels_to_search Controls whether the lookup is constrained to the object the operation is invoked on or whether it should search through objects contained by the object as well.

   Setting levels_to_search to -1 searches the current object and all contained objects. Setting levels_to_search to 1 searches only the current object. Use of values of levels_to_search of 0 or of negative numbers other than -1 is undefined.

   The describe_contents operation combines the contents operation and the describe operation. For each object returned by the contents operation, the description of the object is returned (i.e., the object’s describe operation is invoked and the results returned).

   max_returned_objs Limits the number of objects that can be returned in an invocation of the call to the number provided. Setting the parameter to -1 means return all contained objects.

   contents and describe_contents return a list of elements in their original order (i.e., the order in which the elements were created in or moved into the container). If exclude_inherited is false, the ordering of inherited elements is undefined.

   10.5.4.2 Write Interface

   The Container interface provides operations to create ModuleDefs, ConstantDefs, StructDefs, UnionDefs, EnumDefs, AliasDefs, InterfaceDefs, ValueDefs ValueBoxDefs, and NativeDefs as contained objects. The defined_in attribute of a definition created with any of these operations is initialized to identify the Container on which the operation is invoked, and the containing_repository attribute is initialized to its Repository.

   The create_<type> operations all take id and name parameters that are used to initialize the identity of the created definition. A BAD_PARAM exception is raised with minor code 2 if an object with the specified id already exists in the Repository. A BAD_PARAM exception with minor code 3 is raised if the specified name already exists within this Container and multiple versions are not supported.Certain interfaces derived from Container may restrict the types of definitions that they may contain. Any create_<type> operation that would insert a definition that is not allowed by a Container will raise the BAD_PARAM exception with minor code 4.

   The create_module operation returns a new empty ModuleDef. Definitions can be added using Container::create_<type> operations on the new module, or by using the Contained::move operation.

   The create_constant operation returns a new ConstantDef with the specified type and value.

   The create_struct operation returns a new StructDef with the specified members. The type member of the StructMember structures is ignored, and should be set to TC_void . See Section 10.5.10, “StructDef,? on page 10-26 for more information.

   The create_union operation returns a new UnionDef with the specified discriminator_type and members. The type member of the UnionMember structures is ignored, and should be set to TC_void . See Section 10.5.11, “UnionDef,? on page 10-27 for more information.

   The create_enum operation returns a new EnumDef with the specified members. See Section 10.5.12, “EnumDef,? on page 10-27 for more information.

   The create_alias operation returns a new AliasDef with the specified original_type.

   The create_interface operation returns a new empty ExtInterfaceDef with the specified base_interfaces. Type, exception, and constant definitions can be added using Container::create_<type> operations on the new InterfaceDef. OperationDefs can be added using InterfaceDef::create_operation and AttributeDefs can be added using InterfaceDef::create_attribute. Definitions can also be added using the Contained::move operation.

   The create_abstract_interface operation returns a new empty ExtAbstractInterfaceDef with the specified base_interfaces. Type, exception, and constant definitions can be added using Container::create_<type> operations on the new AbstractInterfaceDef. OperationDefs can be added using AbstractInterfaceDef::create_operation and AttributeDefs can be added using AbstractInterfaceDef::create_attribute. Definitions can also be added using the Contained::move operation.

   The create_local_interface operation returns a new empty ExtLocalInterfaceDef with the specified base_interfaces. Type, exception, and constant definitions can be added using Container::create_<type> operations on the new LocalInterfaceDef. OperationDefs can be added using LocalInterfaceDef::create_operation and AttributeDefs can be added using LocalInterfaceDef::create_attribute. Definitions can also be added using the Contained::move operation.

   The create_value operation returns a new empty ValueDef with the specified base interfaces and values (base_value, supported_interfaces, and abstract_base_values) as well as the other information describing the new values characteristics (is_custom, is_abstract, is_truncatable, and initializers). Type, exception, and constant definitions can be added using Container::create_<type> operations on the new ValueDef. OperationDefs can be added using

   ValueDef::create_operation and AttributeDefs can be added using ValueDef::create_attribute. Definitions can also be added using the Contained::move operation.

   The create_value_box operation returns a new ValueBoxDef with the specified original_type_def.

   The create_exception operation returns a new ExceptionDef with the specified members. The type member of the StructMember structures should be set to TC_void.

   The create_native operation returns a new NativeDef with the specified name.

   The create_ext_value operation returns a new empty ExtValueDef with the specified base interfaces and values (base_value, supported_interfaces, and abstract_base_values) as well as the other information describing the new values characteristics (is_custom, is_abstract, is_truncatable, and initializers). The initializers argument is of type ExtInitializerSeq allowing one to specify user exceptions for initializers. Type, exception, and constant definitions can be added using Container::create_<type> operations on the new ExtValueDef. OperationDefs can be added using ExtValueDef::create_operation and ExtAttributeDefs can be added using ExtValueDef::create_ext_attribute. Definitions can also be added using the Contained::move operation.