Previous Table of Contents Next


9.8 IDL Mapping Templates

   Model specific IDL is produced by traversing the containment hierarchy of a top-level M2-level Package. The CORBA module structure of the resulting IDL directly reflects the containment hierarchy of the source Package. If element X contains element Y in the source model, then the IDL corresponding to X will have the IDL corresponding to Y embedded in it (assuming that IDL is produced for Y).

    The IDL mapping supports the containment hierarchy for ModelElements as described in 7.3.4, “The MOF Model Containment Hierarchy,? on page 40 , except as stated in 9.5, “Preconditions for IDL Generation,? on page 192. Further restrictions on meta-models that can be successfully mapped are described in the same sub clause.

   The mapping rules are described in terms of IDL templates. Each Template describes the maximum IDL that could be generated when mapping MOF Model objects. In any specific case, the actual IDL generated will depend on the properties of the corresponding MOF Model object.

   Throughout the following Template descriptions, the IDL is said to be “generated by? the Templates. Clearly the Templates do not generate IDL in a literal sense. Instead, the reader should imagine that each Template is a parameter to a hypothetical generator function. When it is called with the appropriate kind of MOF ModelElement object as a second parameter, the function “elaborates? the template to produce an appropriate fragment of CORBA IDL. A similar “elaboration? process gives the required semantics for the IDL from the descriptions following the templates and the specifications given earlier in 9.3, “Computational Semantics for the IDL Mapping,? on page 165.

   NOTE: The Template approach used here is a notational convenience, not a required or suggested implementation strategy.

9.8.1 Template Notation

   The following table is a guide to interpreting the IDL generation templates.

Appearance (by example) Meaning
typedef The literal characters in bold font should be generated.
<AttributeType> The characters should be substituted for the described identifier using Identifier Format 1. The <> do not appear in the generated IDL.
<attribute_name> The characters should be substituted for the described identifier using the Identifier Format 2. The <> do not appear in the generated IDL.
<CONSTANT_NAME> The characters should be substituted for the described identifier using the Identifier Format 3. The <> do not appear in the generated IDL.
<CONSTANTVALUE> The characters should be substituted for the described identifier without formatting (i.e., as is). Typically, these are literal values. The <> do not appear in the generated IDL.
<<XYZ TEMPLATE>> Apply the named template. The <<>> do not appear in the generated IDL.
some phrase , . . . The ellipsis characters “. . .? following the “,? indicate that this generates a comma separated list of “some phrase.? It is implicit that there is no comma at the end of the list.
[ some phrase ] The square bracket characters “[]? surrounding a phrase in a template indicate that the phrase may or may not be required, depending on context.
// for each parameter Gives the rules on when and how to perform the IDL generation, or some general commentary on the process. The rules themselves do not appear in the generated IDL.

9.8.2 Package Module Template

   This sub clause describes the rules for mapping a MOF Package object to a CORBA IDL module as expressed in the Package Module Template.

   The Package Module Template generates a CORBA IDL module that contains the IDL for each of the M2-level Constants, DataTypes, Exceptions, Constraints, Imports, Classes, and Associations in an M2-level Package. It also contains the IDL for the M1-level Package and Package Factory interfaces, and type declarations for various collection types. Most of this is defined in subsidiary templates. IDL generation is suppressed if the Package “visibility? is not “public_vis.?

   Template

<<ANNOTATION TEMPLATE>>

   // if this Package has visibility of private or protected, no IDL is// generated for itmodule <PackageName> {// if this Package has an idl_version Tag#pragma version <PackageName> <version>

   interface <PackageName>Package; // forward declaration

   // for each Class contained in the Package

<<CLASS FORWARD DECLARATION TEMPLATE>>

   // for each Package, DataType, Exception, Class, Association, Constraint, // and Constant contained by the Package, generate the appropriate IDL

   <<PACKAGE MODULE TEMPLATE>><<DATATYPE TEMPLATE>><<EXCEPTION TEMPLATE>><<CLASS TEMPLATE>><<ASSOCIATION TEMPLATE>><<CONSTRAINT TEMPLATE>><<CONSTANT TEMPLATE>>

   // Generate the Package Factory interface

<<PACKAGE FACTORY TEMPLATE>>

   // Generate the Package interface

   <<PACKAGE TEMPLATE>>

}; // end of module <PackageName>

   Description

   The Package Module Template starts by rendering the M2-level Package’s “annotation? attribute as a comment using the Annotation Template. This is followed by the IDL module header for the Package’s module. The module name is <PackageName>.

   The template generates forward declarations for some IDL interfaces. First, it forward declares the M1-level Package interface, giving it the name <PackageName>Package. Then, it forward declares the Class proxy and Instance interfaces for all M2-level Classes in the current M2-level Package’s “contents? using the template defined in 9.8.5, “Class Forward Declaration Template,? on page 209 .

   Next, IDL must be generated for the current M2-level Package’s “contents? as follows:

   The IDL for the contained ModelElements must be generated in an order that reflects their dependencies. For example, the IDL for a DataType should appear before the IDL for other ModelElements that use it.

   Finally, the Package Module Template generates the Package Factory and Package interfaces for the current M2-level Package using the templates respectively defined in 9.8.3, “Package Factory Template,? on page 205 and 9.8.4, “Package Template,? on page 206 .

9.8.3 Package Factory Template

    The Package Factory Template defines the IDL generation rules for the Package Factory interface; see 9.2.1.1, “Package objects and Package Factory objects,? on page 162 and 9.2.2, “The Meta Object Interface Hierarchy,? on page 163.

   A Package Factory interface is generated for top-level M2 Packages only. The interface is named <PackageName>PackageFactory and it contains a single “factory? operation, as described below.

   Template

   // if the this Package is top-levelinterface <PackageName>PackageFactory {

   // if this Package has an idl_version Tag#pragma version <PackageName>PackageFactory <version>

   <PackageName>Package create_<package_name>_package (// for each non-derived class-level Attribute of any directly or // indirectly contained Class within this Package and its closure// under Package generalization and clustering.in <AttributeType>[<CollectionKind>]

   <qualified_attribute_name>, ...

   )raises (Reflective::MofError);};

   IDL Supertypes

   none

   Operations

   create_<package_name>_package


return type:

parameters:

exceptions:

<PackageName>Package
<qualified_attribute_name> : in <AttributeType>[<CollectionKind>], ...
MofError (Overflow, Underflow, Duplicate)

   The parameters for “create_<package_name>_package? give the initial values for any non-derived classifier-scoped Attributes for all Classes that belong to this M2-level Package’s extent.

   As Attributes in different Classes can have the same name, the parameter name <qualified_attribute_name> is qualified relative to the Package (e.g., “class1_attribute1?).

   When the Attribute multiplicity is not [1..1], the <AttributeType> has an appropriate CollectionKind suffix appended; see 9.7.1.5, “Literal String Values,? on page 200.

   The parameters are declared in a sequence defined by a recursive depth-first traversal of the Package’s ancestors clusters and components, visiting a Package’s supertypes before its contents. The following ordering rules apply:

   The MofError exception can be raised if there is a Structural, Constraint, or Semantic error. In particular, “Overflow,? “Underflow,? and “Duplicate? occur if an Attribute initialization parameter does not conform to the respective Attribute’s multiplicity specification.

9.8.4 Package Template

    The Package Factory Template defines the IDL generation rules for the Package interface; see 9.2.1.1, “Package objects and Package Factory objects,? on page 162 and 9.2.2, “The Meta Object Interface Hierarchy,? on page 163.

   A Package interface is named <PackageName>Package and it contains read-only IDL attributes giving the dependent Package, Association, and Class proxy objects for a Package object.

   Template

   interface <PackageName>Package :// if Package has no super-Packages

   Reflective::RefPackage

   // else for each public super-Package (in order)<SuperPackage>Package, ...// if Package has a “Package Supertypes? Tag// for each supertype defined by the Tag (in order), <PackageSupertypeName>, ...

   {

   // if this Package has an idl_version Tag#pragma version <PackageName>Package <version>

   // for each Package for an Import where:// is_clustered == true and// Import.visibility == public and// importedNamespace.visibility == publicreadonly attribute <ClusteredPackageName>Package

   <clustered_package_name>_ref;// for each public contained Packagereadonly attribute <NestedPackageName>Package

   <nested_package_name>_ref;// for each public contained Classreadonly attribute <ClassName>Class <class_name>_ref;// for each public contained Associationreadonly attribute <AssociationName> <association_name>_ref;

   };

   Supertypes

   If the M2-level Package inherits from other M2-level Packages with “visibility? of “public_vis,? the Package interface inherits from the interfaces corresponding super-Packages. Otherwise, the Package interface inherits from Reflective::RefPackage.

    If the M2-level Package has a “Package Supertypes? Tag (see 9.6.3, “Tags for Specifying IDL Inheritance,? on page 196), the generated Package interface also inherits from the IDL interfaces specified by the Tag.

   Attributes

   clustered_package_name>_ref

   An attribute of this form is generated for each public clustered Package of the current M2-level Package. The attribute is generated if and only if:

   4. the clustered Package has “visibility? of “public_vis.? The attribute holds the object reference for the M1-level Package’s M1-level clustered Package object.

reflective analog:

ref_package_ref(<clustered_package_designator>); 10.2.5, “Reflective::RefPackage (abstract),? on page 269.

type: <ClusteredPackageName>Package
multiplicity: exactly one
changeable: no

   <nested_package_name>_ref

   An attribute of this form is generated for each nested Package in the current M2-level Package whose “visibility? is “public_vis.? The attribute holds the object reference for the M1-level Package’s M1-level nested Package object.

reflective analog:

ref_package_ref(<nested_package_designator>); 10.2.5, “Reflective::RefPackage (abstract),? on page 269.

type: <NestedPackageName>Package
multiplicity: exactly one
changeable: no

   <class_name>_ref

   An attribute of this form is generated for each Class in the current Package whose “visibility? is “public_vis.? The attribute holds the object reference for the M1-level Package’s M1-level Class Proxy object.

reflective analog:

ref_class_ref(<class_designator>)

type: <ClassName>Class
multiplicity: exactly one
changeable: no

   <association_name>_ref

   An attribute of this form is generated for each Association in the current Package whose “visibility? is “public_vis.? The attribute holds the object reference for the M1-level Package’s M1-level Association object.

reflective analog:

ref_package_ref(<association_designator>);

type: <AssociationName>
multiplicity: exactly one
changeable: no

   Operations

   none

9.8.5 Class Forward Declaration Template

   The Class Forward Declaration Template defines the IDL generation rules for the forward interface declarations for an M2-level Class whose “visibility? is “public_vis.? It also produces any Class collection type declarations required by the IDL of the containing Package(s).

   Template

   // if the Class has visibility of protected or private, no IDL// is generated.

   interface <ClassName>Class;interface <ClassName>;

   typedef sequence < <ClassName> > <ClassName>Set; // if this Class has an idl_version Tag #pragma version <ClassName>Set <version>

   typedef sequence < <ClassName> > <ClassName>Bag; // if this Class has an idl_version Tag #pragma version <ClassName>Bag <version>

   typedef sequence < <ClassName> > <ClassName>List; // if this Class has an idl_version Tag #pragma version <ClassName>List <version>

   typedef sequence < <ClassName> > <ClassName>UList; // if this Class has an idl_version Tag #pragma version <ClassName>UList <version>

   Description

   The Class Forward Declaration Template generates a forward declaration for the Instance and Class proxy interfaces for an M2-level Class. These have IDL identifiers <ClassName> and <ClassName>Class respectively. The synthesized collection type declarations for the Class follow the forward declarations.

9.8.6 Class Template

   The Class Template defines the IDL generation rules for an M2-level Class whose “visibility? is “public_vis.? The IDL is generated within the module for the Class’s containing Package and consists of a comment followed by the complete Classes Class Proxy and Instance interfaces.

   Template

   // if the Class has visibility of protected or private, no IDL// is generated

   <<ANNOTATION TEMPLATE>><<CLASS PROXY TEMPLATE>><<INSTANCE TEMPLATE>>

   Description

   See 9.8.7, “Class Proxy Template,? on page 210 and 9.8.6, “Class Template,? on page 209.

9.8.7 Class Proxy Template

   The Class Proxy Template defines the IDL generation rules for the <ClassName>Class interface for an M2-level Class whose “visibility? is “public_vis.? This interface has operations for any classifier-scoped Attributes and Operations, along with a factory operation and IDL attributes that give access to the extant Instance objects. It also contains IDL declarations corresponding to any DataTypes, Exceptions, Constants, and Constraints in the M2-level Class.

   Template

   interface <ClassName>Class :// if Class has no super-Classes

   Reflective::RefObject

   // else for each super-Class<SuperClass>Class, ...// if Class has a “Class Proxy Supertypes? Tag// for each supertype defined by the Tag (in order), <ClassProxySupertypeName>, ... {

    // if this Class has an idl_version Tag#pragma version <ClassName>Class <version>

    // all <ClassName> including subclasses of <ClassName>readonly attribute <ClassName>Set all_of_type_<class_name>;

   // if the Class is not abstract// all <ClassName> excluding subclasses of <ClassName>readonly attribute <ClassName>Set all_of_class_<class_name>;

   // for each Constant, DataType, Exception, Constraint,// classifier-scoped Attribute and classifier-scoped Operation// in the Class, generate the appropriate IDL

   <<DATATYPE TEMPLATE>><<CONSTRAINT TEMPLATE>><<CONSTANT TEMPLATE>><<EXCEPTION TEMPLATE>><<ATTRIBUTE TEMPLATE>> // public classifier-level only<<OPERATION TEMPLATE>> // public classifier-level only

   // if the Class is not abstract

   <<CLASS CREATE TEMPLATE>>

   }; // end of interface <ClassName>Class

   Supertypes

   If the M2-level Class inherits from other M2-level Classes, the generated Class Proxy interface inherits from the corresponding supertype Class Proxy interfaces. Otherwise, the Class Proxy interface inherits from Reflective::RefObject.

    If the M2-level Class has a “Class Proxy Supertypes? Tag (see 9.6.3, “Tags for Specifying IDL Inheritance,? on page 196), the generated Class Proxy interface also inherits from the IDL interfaces specified by the Tag.

   Attributes

   all_of_class_<class_name>

   The “all_of_class_<class_name>? attribute gives all Instance objects in the current extent for the corresponding M2-level Class. The attribute is only generated if “isAbstract? is false for the Class.

reflective analog:

type:

multiplicity:

changeable:

ref_all_objects(<class_designator>, false)

<ClassName> (multiplicity zero or more, unique, non ordered)
exactly one
no

    The value of this attribute mirrors the definition of Instance object lifetimes; see 9.3.4.2, “Instance object lifecycle semantics,? on page 171. It does not include any deleted Instance objects.

   all_of_type_<class_name>

   The “all_of_type_<class_name>? attribute gives all Instance objects in the current extent for the corresponding M2-level Class or for any M2-level subClasses.

reflective analog:

type:

multiplicity:

changeable:

ref_all_objects(<class_designator>, true)

<ClassName> (multiplicity zero or more, unique, non ordered)
exactly one
no

    The value of this attribute mirrors the definition of Instance object lifetimes; see 9.3.4.2, “Instance object lifecycle semantics,? on page 171. It does not include any deleted Instance objects.

   Operations

   The operations for a <ClassName>Class interface are produced by the Attribute, Operation, and Class Create Templates. Note that the operations for the M2-level Classes instance-scoped features do not appear in this interface.

   © ISO/IEC 2005 - All rights reserved

9.8.8 Instance Template

   The Instance Template defines the IDL generation rules for the <ClassName> interface for an M2-level Class whose “visibility? is “public_vis.? This interface contains operations for the M2-level Classes instance-scoped Attributes and Operations, along with any References.

   Template

   interface <ClassName> :// (The Instance interface inherits the Class Proxy interface// for the Class and Instance interfaces for any super-Classes)<ClassName>Class// for each super-Class of this Class (in order), <SuperClassName>, ...// if Class has an “Instance Supertypes? Tag// for each supertype defined by the Tag (in order), <InstanceSupertypeName>, ... {

    // if this Class has an idl_version Tag#pragma version <ClassName> <version>

   // for each Attribute, Reference, Operation contained in // this Class, generate the appropriate IDL

   <<ATTRIBUTE TEMPLATE>> // public instance-level only<<REFERENCE TEMPLATE>> // public only<<OPERATION TEMPLATE>> // public instance-level only

   }; // end of interface <ClassName>

   Supertypes

   The Instance interface for an M2-level Class inherits from the Class’s Class Proxy interface, along with the Instance interfaces for all of its M2-level super-Classes.

    If the M2-level Class has an “Instance Supertypes? Tag (see 9.6.3, “Tags for Specifying IDL Inheritance,? on page 196), the generated Instance interface also inherits from the IDL interfaces specified by the Tag.

   Attributes

   none

   Operations

   The operations for an Instance interface are generated by the Attribute, Reference, and Operation Templates. Note that the operations for instance-scoped Attributes and Operations only appear here.

9.8.9 Class Create Template

   The Class Create Template defines the IDL generation rules for the Instance factory operation for a non-abstract M2-level Class whose “visibility? is “public_vis.?

   Template

   <ClassName> create_<class_name> (

   // for each non-derived direct or inherited attribute

   in <AttributeType>[<CollectionKind>] <attribute_name>, ...)raises (Reflective::MofError);

   Operations

   create_<class_name>

   The “create_<class_name>? operation creates new Instance objects for the M2-level Class (i.e., instances of the Class's <ClassName> interface).

reflective analog: ref_create_instance(<class_designator>, <attr_name>,...)
return type: <ClassName>
parameters: in <AttrTypeName>[<CollectionType>] <attr_name>, ...
exceptions: MofError (Overflow, Underflow, Duplicate, Composition Closure, Supertype Closure, Already Created)

   The parameters to “create_<class_name>? provide initial values for the M2-level Class’s non-derived attributes. Parameter declarations are generated in an order defined by a recursive depth-first traversal of the inheritance graph. More precisely:

   When an Attribute has multiplicity bounds other than [1..1], the type of the corresponding initial value parameter’s type will be a collection type; see 9.7.1.5, “Literal String Values,? on page 200.

   “Overflow,? “Underflow,? and “Duplicate? occur if an argument that gives the initial value for an Attribute does not match the Attribute’s multiplicity specification.

   “Composition Closure? occurs if the initial value for a “composite? Attribute contains an Instance object in another extent; see 8.11.2, “The Composition Closure Rule,? on page 155 .

   “Supertype Closure? occurs if the extent for the current object cannot create Instance objects for this super-Class; see 9.3.11, “The Supertype Closure Rule,? on page 182.

   “Already Created? occurs if the M2-level Class has “isSingleton? set to true, and this object’s extent already includes an Instance object for the Class.

9.8.10 Association Template

   The Association Template defines the generation rules for the Association interface corresponding to an M2-level Association whose “visibility? is “public_vis.? This interface contains the IDL operations for accessing and updating the Association’s M1-level link set. It also contains IDL declarations corresponding to any Constraints in the M2-level Association.

   Template

   // If the Association has visibility of protected or private,// no IDL is generated

   // data types for Association <AssociationName>

   struct <AssociationName>Link {<AssociationEnd1ClassName> <associationend1_name>;<AssociationEnd2ClassName> <associationend2_name>;

   };

   // if this Association has an idl_version Tag #pragma version <AssociationName>Link <version>typedef sequence < <AssociationName>Link ><AssociationName>LinkSet;// if this Association has an idl_version Tag #pragma version <AssociationName>LinkSet <version>

<<ANNOTATION TEMPLATE>>

   interface <AssociationName> : Reflective::RefAssociation// if Association has an “Association Supertypes? Tag// for each supertype defined by the Tag (in order), <AssociationSupertypeName>, ... {

    // if this Association has an idl_version Tag#pragma version <AssociationName> <version>

    // for each Constraint in the Association, generate the IDL

    <<CONSTRAINT TEMPLATE>>

   // list of associated elements

   <AssociationName>LinkSet all_<association_name>_links ()

raises (Reflective::MofError);

   boolean exists (in <AssociationEnd1Class> <association_end1_name>,in <AssociationEnd2Class> <association_end2_name>)raises (Reflective::MofError);

   // if association_end1 is_navigable

   <AssociationEnd1Class>[<CollectionKind>] <association_end1_name> (in <AssociationEnd2Class> <association_end2_name>)raises (Reflective::MofError);

   // if association_end2 is_navigable

   <AssociationEnd2Class>[<CollectionKind>] <association_end2_name> (in <AssociationEnd1Class> <association_end1_name>)raises (Reflective::MofError);

   // if association_end1 is_changeable // and association_end2 is_changeable

   void add (in <AssociationEnd1Class> <association_end1_name>,in <AssociationEnd2Class> <association_end2_name>)raises (Reflective::MofError);

   // if association_end1 is_changeable and is_navigable// and association_end2 is_changeable// and association_end1 has upper > 1 and is_orderedvoid add_before_<association_end1_name> (

   in <AssociationEnd1Class> <association_end1_name>,in <AssociationEnd2Class> <association_end2_name>,in <AssociationEnd1Class> before)raises (Reflective::NotFound, Reflective::MofError);

   // if association_end1 is_changeable// and association_end2 is_changeable and is_navigable// and association_end2 has upper > 1 and is_orderedvoid add_before_<association_end2_name> (

   in <AssociationEnd1Class> <association_end1_name>,in <AssociationEnd2Class> <association_end2_name>,in <AssociationEnd2Class> before)raises (Reflective::NotFound, Reflective::MofError);

   // if association_end1 is_navigable and is_changeable

   void modify_<association_end1_name> (in <AssociationEnd1Class> <association_end1_name>,in <AssociationEnd2Class> <association_end2_name>,in <AssociationEnd1Class> new_<association_end1_name>)raises (Reflective::NotFound, Reflective::MofError);

   // if association_end2 is_navigable and is_changeable

   void modify_<association_end2_name> (in <AssociationEnd1Class> <association_end1_name>,in <AssociationEnd2Class> <association_end2_name>,in <AssociationEnd2Class> new_<association_end2_name>)raises (Reflective::NotFound, Reflective::MofError);

   // if association_end1 is_changeable// and association_end2 is_changeable

   void remove (in <AssociationEnd1Class> <association_end1_name>,in <AssociationEnd2Class> <association_end2_name>)raises (Reflective::NotFound, Reflective::MofError);

   };

   Data Types

   The Association Template generates data type declarations that are used to pass a link set for the M2-level Association. The <AssociationName>Link and <AssociationName>LinkSet type declarations precede the Association interface declaration.

   Supertypes

   Every generated Association interface inherits from Reflective::RefAssociation. If the M2-level Association has an “Association Supertypes? Tag (see 9.6.3, “Tags for Specifying IDL Inheritance,? on page 196 ), the generated Association interface also inherits from the IDL interfaces specified by the Tag.

   Attributes

   none

   Operations

   all_<association_name>_links

   The “all_<association_name>_links? operation creates new Instance objects for the M2-level Class (i.e., instances of the Class’s <ClassName> interface).

reflective analog:

return type:

parameters:

query:

exceptions:

ref_all_links()

<AssociationName>LinkSet
none
yes
MofError()

   The “all_<association_name>_links? operation returns the current link set for this Association expressed using the <AssociationName>LinkSet type.

   While the definitions in 8.9.2.1, “A Mathematical Model of Association State,? on page 150 state that an ordered Association implies a partial ordering over the LinkSet, the result of the “all_<association_name>_links? operation is defined to be a Set. A client should not draw any conclusions from the ordering of the returned links.

   The operation’s signature raises Reflective::MofError to allow Constraint error and Semantic error conditions to be signalled.

   exists

   The “exists? operation queries whether a link currently exists between a given pair of Instance objects in the current M1level Association extent.

reflective analog: ref_link_exists( Link{<assoc_end1_name>, <assoc_end2_name>})
return type: boolean
parameters: in <AssocEnd1ClassName> <assoc_end1_name> in <AssocEnd2ClassName> <assoc_end2_name>
query: yes
exceptions: MofError (Invalid Object, Nil Object, Inaccessible Object)

   The parameters to the “exists? operation are a pair of Instance values of the appropriate type for the Association. Since MOF link relationships are implicitly directional, the order of the parameters is significant.

   “Invalid Object,? “Nil Object,? and “Inaccessible Object? occurs if either of the parameters is a non-existent, nil, or inaccessible Instance object.

   <association_end1_name>

   The “<association_end1_name>? operation queries the Instance object or objects that are related to a particular Instance object by a link in the current M1-level Association extent. When “isNavigable? is set to false for the AssociationEnd, the “<association_end1_name>? operation is suppressed.

reflective analog:

ref_query( <assoc_end1_designator>, <assoc_end1_name>)

return type: <AssocEnd2ClassName>[<CollectionType>]
parameters: in <AssocEnd1ClassName> <assoc_end1_name>
query: yes
exceptions: MofError (Invalid Object, Nil Object, Inaccessible Object, Underflow)

   The <association_end1_name> parameter is the Instance object from which the caller wants to “navigate.? “Invalid Object,? “Nil Object,? and “Inaccessible Object? occur when the parameter is a non-existent, nil object or inaccessible Instance object.

   The result type of the operation depends on the multiplicity of <AssociationEnd2>. If it has bounds of [1..1], the result type is the Instance type corresponding to the AssociationEnd’s “type.? Otherwise, it is a collection of the same Instance type, as described in “Literal String Values? on page 200.

   “Underflow? occurs when <AssociationEnd2> has bounds [0..1] or [1..1] and the Instance object given by the parameter is not related in the current Association extent. It should not occur in other cases where the result type is a collection type. (If there is a multiplicity underflow, it is signalled by returning a collection value with too few elements as opposed to raising an exception.)

   The result of the operation gives the object or collection of objects related to the parameter object by a Link or Links in this Association. If the multiplicity is [1..1], the result will be a non-nil object reference. If the multiplicity is [0..1], the operation will return a non-nil object reference if there is a related object, and a nil object reference otherwise. In other cases, the operation will return a (possibly zero length) sequence of non-nil object references. If the association end being queried is ordered, the order of the contents of the returned collection is significant.

   <association_end2_name>

   This operation is the equivalent of “<association_end1_name>,? with the “end1? and “end2? interchanged.

   add

   The “add? operation creates a link in this Association between a pair of Instance objects. When “isChangeable? is set to false for either of the M2-level Association’s AssociationEnd, the “add? operation is suppressed.

reflective analog: ref_add_link( Link{<assoc_end1_name>, <assoc_end2_name>})
return type: none
parameters: in <AssocEnd1ClassName> <assoc_end1_name> in <AssocEnd2ClassName> <assoc_end2_name>
exceptions: MofError (Invalid Object, Nil Object, Inaccessible Object, Overflow, Duplicate, Reference Closure, Composition Closure, Composition Cycle)

   The two parameters to the “add? operation give the Instance objects at the two ends of the new link. “Invalid Object,? “Nil Object,? and “Inaccessible Object? occur if either of the parameter values is a non-existent, nil or inaccessible Instance object.

   If one or other end of the Association has “isOrdered? set to true, the new link must be added so that it is the last member of the projection for the ordered AssociationEnd. The operation must also preserve ordering of the existing members of the ordered projection.

   “Overflow? occurs when adding the new link would cause the size of the projection of either the first or second parameter object to exceed the upper bound for the opposite AssociationEnd. “Duplicate? occurs when the link set for the current Association extent already contains the link whose creation is requested.

   “Reference Closure? occurs when either (or both) of the AssociationEnds has References, and the corresponding Instance object parameter does not belong to the same outermost Package extent as the Association object; see 8.11.1, “The Reference Closure Rule,? on page 153 .

   “Composition Closure? occurs when either AssociationEnd has “aggregation? set to “composite,? and either of the Instance object parameters does not belong to the same outermost Package extent as this Association object; see 8.11.2, “The Composition Closure Rule,? on page 155.

   “Composition Cycle? occurs when adding the new link would create a cycle of composite / component relationships such that one of the Instance object parameters is a (ultimately) component of itself; see 8.10.2, “Aggregation “composite?,? on page 153 .

   add_before_<association_end1_name>

   The “add_before_<association_end1_name>? operation creates a link between a pair of Instance objects at a given place in this Association. This operation is only generated when “isChangeable? is true for both AssociationEnds, and when the first AssociationEnd is multi-valued, ordered, and navigable.

reflective analog: ref_add_link_before( Link{<assoc_end1_name>, <assoc_end2_name>}, <assoc_end1_designator>, before); (see 10.2.4, “Reflective::RefAssociation (abstract),? on page 265).
return type: none
parameters: in <AssocEnd1ClassName> <assoc_end1_name> in <AssocEnd2ClassName> <assoc_end2_name> in <AssociationEnd1ClassName> before
exceptions: NotFound, MofError (Invalid Object, Nil Object, Inaccessible Object, Overflow, Duplicate, Reference Closure, Composition Closure, Composition Cycle)

   The first two parameters to the “add_before_<association_end1_name>? operation give the Instance objects at the two ends of the new link. “Invalid Object,? “Nil Object,? and “Inaccessible Object? occur if either of the parameter values is a non-existent, nil, or inaccessible Instance object.

   The third parameter (“before?) gives an Instance object that determines the point at which the new link is inserted. “Invalid Object,? “Nil Object,? and “Inaccessible Object? also apply to the “before? parameter value.

   © ISO/IEC 2005 - All rights reserved

   The “before? value should be present in the projection of the “<assoc_end2_name>? parameter value. If this is so, the insertion point for the new link is immediately before the “before? value, otherwise the “NotFound? error occurs.

   “Overflow,? “Duplicate,? “Reference Closure,? “Composition Closure,? and “Composition Cycle? occur as described for the “add? operation above.

   add_before_<association_end2_name>

   This operation is the equivalent of “add_before_<association_end1_name>,? with the “end1? and “end2? interchanged.

   NOTE: The preconditions for generating the “add_before_<association_end1_name>? and “add_before_<association_end2_name>? operations are such that at most one of them may appear in an Association interface.

   modify_<association_end1_name>

   The “modify_<association_end1_name>? operation updates a link between a pair of Instance objects, replacing the Instance at AssociationEnd1 with a new Instance object. When AssociationEnd1 has “isChangeable? or “isNavigable? set to false, this operation is suppressed.

reflective analog: ref_modify_link( Link{<assoc_end1_name>, <assoc_end2_name>}, <assoc_end1_designator> new_<assoc_end1_name>); (see 10.2.4, “Reflective::RefAssociation (abstract),? on page 265).
return type: none
parameters: in <AssocEnd1ClassName> <assoc_end1_name> in <AssocEnd2ClassName> <assoc_end2_name> in <AssocEnd2ClassName> new_<assoc_end1_name>
exceptions: NotFound, MofError (Invalid Object, Nil Object, Inaccessible Object, Overflow, Underflow, Duplicate, Reference Closure, Composition Closure, Composition Cycle)

   The first two parameters to the “modify_<association_end1_name>? operation should give the Instance objects at the ends of an existing link. “Invalid Object,? “Nil Object,? and “Inaccessible Object? occur if either of the parameter values are non-existent, nil, or inaccessible Instance objects. “NotFound? occurs if the link does not exist in the current extent.

   The third parameter (“new_<assoc_end1_name>?) gives the Instance object that is to replace the Instance at AssociationEnd1 for the selected link. “Invalid Object,? “Nil Object,? and “Inaccessible Object? also occurs if this parameter’s value is a non-existent, nil, or inaccessible Instance object.

   If the “<assoc_end1_name>? and “new_<assoc_end1_name>? parameters give the same Instance object, this operation is required to have no effect on the Association’s link set.

   NOTE: The following error conditions apply to the state of the M1-level Association after the completion of the operation, not to any intermediate states.

   “Underflow? occurs if completion of the operation would leave the M1-level Association in a state where

   size(Projection(<assoc_end1_name>)) less than <AssocEnd2>.lower

   “Overflow? occurs if completion of the operation would leave the M1-level Association in a state where

    ISO/IEC 19502:2005(E)

   size(Projection(new_<assoc_end1_name>)) greater than<AssocEnd2>.upper

   Note that the “Underflow? condition for the “new_<assoc_end1_name>? Instance should be treated as a deferred constraint.

   “Duplicate? occurs if the operation would create a duplicate link in this M1-level Association extent. Similarly, “Composition Cycle? occurs if the operation creates a link that (on completion of the operation) would make the “<assoc_end2_name>? or “new_<assoc_end1_name>? objects components of themselves.

   “Reference Closure? and “Composition Closure? occur if the operation would create a link that violates the corresponding closure rules; see 8.11.1, “The Reference Closure Rule,? on page 153 and 8.11.2, “The Composition Closure Rule,? on page 155 .

   • If either AssociationEnd has “isOrdered? set to true, this operation must preserve ordering of the remaining members in the relevant projections of the ordered end.

   In addition:

   modify_<association_end2_name>

   This operation is the equivalent of “modify_<association_end1_name>? with the “end1? and “end2? interchanged.

   remove

   The “remove? operation removes a link between a pair of Instance objects in the current Association extent. When either AssociationEnd or AssociationEnd2 has “isChangeable? set to false, the “remove? operation is suppressed.

reflective analog: ref_remove_link( Link{<assoc_end1_name>, <assoc_end2_name>}); (see 10.2.4, “Reflective::RefAssociation (abstract),? on page 265).
return type: none
parameters: in <AssocEnd1ClassName> <assoc_end1_name> in <AssocEnd2ClassName> <assoc_end2_name>
exceptions: NotFound, MofError (Nil Object, Underflow)

   The two parameters to this operation give the Instance objects at both ends of the link that is to be removed from the current Association object’s link set. “Nil Object? occurs if either parameter value is a nil object reference.

   “NotFound? occurs if the link to be deleted does not exist in the current Association extent.

   NOTE: “Invalid Object? and “Inaccessible Object? does occur here. The “remove? operation needs to be capable of deleting links that involve Instance objects that have been deleted or that are inaccessible. In the latter case, an implementation can usually fall back on local comparison of object references. If that fails (e.g., because there are multiple references for an Instance object), the implementation will typically be unable to distinguish the case from “NotFound.?

   “Underflow? occurs if deleting the link would cause the size of the projection of either the “<assoc_end1_name>? or “<assoc_end2_name>? parameter value to be less than the corresponding “lower? bound.

   If either AssociationEnd1 or AssociationEnd2 has “isOrdered? set to true, the “remove? operation must preserve the ordering of the remaining members of the corresponding projection.

9.8.11 Attribute Template

   The Attribute Template defines the generation rules for M2-level Attributes whose “visibility? is “public_vis.? The Attribute Template declares operations to query and update the value of an Attribute. These operations appear on different interfaces, depending on the Attribute’s “scope.?

   The operations generated for an Attribute and their signatures depend heavily on the Attribute’s properties. For the purposes of defining the generated IDL, Attribute multiplicities fall into three groups:

   Template

   // if Attribute visibility is private or protected no IDL// is generated

   <<ANNOTATION TEMPLATE>>

   // if lower = 0 and upper = 1<AttributeType> <attribute_name> ()raises (Reflective::NotSet, Reflective::MofError);

   // if this Attribute has an idl_version Tag #pragma version <attribute_name> <version>

   // if lower = 1 and upper = 1<AttributeType> <attribute_name> ()raises (Reflective::MofError);

   // if this Attribute has an idl_version Tag #pragma version <attribute_name> <version>

   // if upper > 1<AttributeType><CollectionKind> <attribute_name> ()raises (Reflective::MofError);

   // if this Attribute has an idl_version Tag #pragma version <attribute_name> <version>

   // if upper = 1 and is_changeablevoid set_<attribute_name> (in <AttributeType> new_value)raises (Reflective::MofError);

   // if this Attribute has an idl_version Tag #pragma version set_<attribute_name> <version>

   // if upper > 1 and is_changeablevoid set_<attribute_name> (in <AttributeType><CollectionKind> new_value)raises (Reflective::MofError);

   // if this Attribute has an idl_version Tag #pragma version set_<attribute_name> <version>

   // if lower = 0 and upper = 1 and is_changeablevoid unset_<attribute_name> ()raises (Reflective::MofError);

   // if this Attribute has an idl_version Tag #pragma version unset_<attribute_name> <version>

   // if upper > 1 and is_changeablevoid add_<attribute_name> (in <AttributeType> new_element)raises (Reflective::MofError);

   // if this Attribute has an idl_version Tag #pragma version add_<attribute_name> <version>

   // if upper > 1 and is_changeable and is_ordered

   void add_<attribute_name>_before (in <AttributeType> new_element,in <AttributeType> before_element)raises (Reflective::NotFound, Reflective::MofError);

   // if this Attribute has an idl_version Tag #pragma version add_<attribute_name>_before <version>

   // if upper > 1 and is_changeable and is_ordered and not is_unique

   void add_<attribute_name>_at (in <AttributeType> new_element,in unsigned long position)raises (Reflective::BadPosition, Reflective::MofError);

   // if this Attribute has an idl_version Tag #pragma version add_<attribute_name>_at <version>

   // if upper > 1 and is_changeable

   void modify_<attribute_name> (in <AttributeType> old_element,in <AttributeType> new_element)raises (Reflective::NotFound, Reflective::MofError);

   // if this Attribute has an idl_version Tag #pragma version modify_<attribute_name> <version>

   // if upper > 1 and is_changeable and is_ordered and not is_uniquevoid modify_<attribute_name>_at (in <AttributeType> new_element,in unsigned long position)raises (Reflective::BadPosition, Reflective::MofError);

   // if this Attribute has an idl_version Tag #pragma version modify_<attribute_name>_at <version>

   // if upper > 1 and upper != lower and is_changeablevoid remove_<attribute_name> (in <AttributeType> old_element)raises (Reflective::NotFound, Reflective::MofError);

   // if this Attribute has an idl_version Tag #pragma version remove_<attribute_name> <version>

   // if upper > 1 and upper != lower and is_changeable and// is_ordered and not is_uniquevoid remove_<attribute_name>_at (in unsigned long position)

   raises (Reflective::BadPosition, Reflective::MofError);

   // if this Attribute has an idl_version Tag #pragma version remove_<attribute_name>_at <version>

   Operations <attribute_name>

   The “<attribute_name>? operation returns the value of the named Attribute.

reflective analog: ref_value(<attribute_designator>); (see 10.2.3, “Reflective::RefObject (abstract),? on page 254).
return type: [0..1] - <AttributeType> [1..1] - <AttributeType> other - <AttributeType><CollectionKind>
parameters: none
query: yes
exceptions: [0..1] - Unset, MofError [1..1] - MofError other - MofError

   The signature of the “<attribute_name>? operation depends on the Attribute’s multiplicity as indicated above. Its behavior is as follows:

   If the Attribute is instance-scoped, the operation is only available on Instance objects, and invoking it returns a value that is related to this Instance object. If the Attribute is classifier-scoped, the operation can be invoked on both Class Proxy and Instance objects. In both cases, the operation returns a value that is related to all Instances for the Attribute’s Class in the current extent. For a more detailed comparison of classifier versus instance-scoped Attributes, see 8.6, “Semantics of Attributes,? on page 141.

   The MofError exception may be raised to signal meta-model defined Constraint errors and implementation specific Semantic errors. However, an implementation generally should avoid doing this, for the reasons given in 8.13.6, “Access operations should avoid raising Constraint exceptions,? on page 159 .

   set_<attribute_name>

   The “set_<attribute_name>? operation sets the value of the named Attribute.


return type:

parameters:

exceptions:

none
[0..1] -in <AttributeType> new_value [1..1] -in <AttributeType> new_value other -in <AttributeType><CollectionKind> new_value
[0..1] -MofError (Invalid Object, Inaccessible Object, Composition Closure, Composition Cycle) [1..1] -MofError (Invalid Object, Inaccessible Object, Composition Closure, Composition Cycle) other -MofError (Overflow, Underflow, Duplicate, Invalid Object, Inaccessible Object, Composition Closure, Composition Cycle)

   The signature of the “set_<attribute_name>? operation depends on the Attribute’s multiplicity as indicated above. Its behavior is as follows:

   When the Attribute has a lower bound of 0, its value can legally be empty:

   “Composition Closure? and “Composition Cycle? are only possible when the type of the Attribute is a Class, and the Attribute has “composite? aggregation semantics:

   “Overflow,? “Underflow,? and “Duplicate? can only occur in the case of a multi-valued Attribute:

   “Invalid Object? and “Inaccessible Object? occur when some Instance object is found to be non-existent or inaccessible. An implementation should only signal one of these conditions when it prevents other consistency checking (e.g., testing for composition cycles).

   unset_<attribute_name>

   The “unset_<attribute_name>? operation sets the value of an optional-valued Attribute to empty. This operation is suppressed in the single-valued and multi-valued cases.

reflective analog:

return type:

parameters:

exceptions:

ref_unset_value(<attribute_designator>); (see 10.2.3, “Reflective::RefObject (abstract),? on page 254).

none
none
MofError

   The “unset_<attribute_name>? operation is the only way to update an optional-valued Attribute to the “empty? state.

   The MofError exception may be raised to signal meta-model defined Constraint errors and implementation specific Semantic errors.

   add_<attribute_name>

   The “add_<attribute_name>? operation updates a multi-valued Attribute by adding a new member value to its collection value. This operation is suppressed for optional and single-valued Attributes and for Attributes with “isChangeable? set to false.

reflective analog:

return type:

parameters:

exceptions:

ref_add_value(<attribute_designator>, new_element); (see 10.2.3, “Reflective::RefObject (abstract),? on page 254).
none
in <AttributeType> new_element
MofError (Overflow, Duplicate, Invalid Object, Inaccessible Object, Composition Closure, Composition Cycle)

   The “add_<attribute_name>? operation adds “new_element? to the collection of a changeable multi-valued Attribute. If the Attribute’s “multiplicity? has “isOrdered? set to true, the “new_element? is added after that current last element of the collection.

   “Overflow? occurs if adding another element to the collection makes the number of elements it contains greater than the Attribute’s upper bound.

   “Duplicate? occurs if the Attribute’s “multiplicity? has “isOrdered? set to true, and the “new_element? value is equal to an element of the Attribute’s current value.

   “Composition Closure? and “Composition Cycle? are only possible when the type of the Attribute is a Class, and the Attribute has “composite? aggregation semantics:

   “Invalid Object? and “Inaccessible Object? occur when some Instance Object is found to be non-existent or inaccessible. An implementation should only signal one of these conditions when it prevents other consistency checking (e.g., testing for composition cycles).

   add_<attribute_name>_before

   The “add_<attribute_name>_before? operation updates a multi-valued Attribute by adding a new element at given position in its current collection value. The operation is suppressed for optional and single-valued Attributes, and for Attributes with “isChangeable? or “isOrdered? set to false.

reflective analog:

return type:

parameters:

exceptions:

ref_add_value_before( <attribute_designator>, new_element, before_element); (see 10.2.3, “Reflective::RefObject (abstract),? on page 254).
none
in <AttributeType> new_element in <AttributeType> before_element
NotFound, MofError (Overflow, Duplicate, Invalid Object, Inaccessible Object, Composition Closure, Composition Cycle)

   The “add_<attribute_name>_before? operation adds “new_element? to the collection at a given place within the collection value of an ordered, changeable, multi-valued Attribute. Insertion is required to preserve the initial order of the collection’s elements.

   The “new_element? is inserted before the first occurrence in the Attribute’s collection of the value supplied as the “before_element? parameter (i.e., the occurrence with the smallest index). “NotFound? occurs when the “before_element? value is not present in the collection.

   “Overflow,? “Duplicate,? “Composition Closure,? and “Composition Cycle? occur in equivalent situations to those for “add_<attribute_name>? above.

   “Invalid Object? and “Inaccessible Object? occur when some Instance object is found to be non-existent or inaccessible. An implementation should only signal one of these conditions when it prevents other consistency checking (e.g., testing for composition cycles).

   add_<attribute_name>_at

   The “add_<attribute_name>_at? operation updates a multi-valued Attribute by adding a new element at a given position in its current collection value. It is provided for non-unique Attributes where an insertion point must be specified using an index. The operation is suppressed for optional and single-valued Attributes, for Attributes with “isChangeable? or “isOrdered? set to false, and for Attributes with “isUnique? set to true.

   reflective analog:

   ref_add_value_at( <attribute_designator>, new_element, position); (see 10.2.3, “Reflective::RefObject (abstract),? on page 254 ).

return type:

parameters:

exceptions:

none

in <AttributeType> new_element in unsigned long position
BadPosition, MofError (Overflow, Duplicate, Invalid Object, Inaccessible Object, Composition Closure, Composition Cycle).

   The “add_<attribute_name>_at? operation adds “new_element? at a given point within the collection value of an ordered, non-unique changeable, multi-valued Attribute. Insertion is required to preserve the initial order of the collection’s elements.

   The insertion point is given by the value of the “position? parameter. This is the index of the collection member before which “new_element? should be inserted, with zero being the index for the first member. A “position? value equal to the current number of elements means that “new_element? should be added to the end of the collection. “BadPosition? occurs when the “position? value is greater than the number of elements in the collection. (It is not possible to create a collection value with “gaps? by adding elements with “position? values larger that the collection size.)

   “Overflow,? “Duplicate,? “Composition Closure,? and “Composition Cycle? occur in equivalent situations to those described for “add_<attribute_name>? above.

   “Invalid Object? and “Inaccessible Object? occur when some Instance object is found to be non-existent or inaccessible. An implementation should only signal one of these conditions when it prevents other consistency checking (e.g., testing for composition cycles).

   modify_<attribute_name>

   The “modify_<attribute_name>? operation updates a multi-valued Attribute by replacing an existing member of its collection value. This operation is suppressed for optional and single-valued Attributes and for Attributes with “isChangeable? set to false.

reflective analog:

return type:

parameters:

exceptions:

ref_modify_value( <attribute_designator>, old_element, new_element); (see 10.2.3, “Reflective::RefObject (abstract),? on page 254).
none
in <AttributeType> old_element in <AttributeType> new_element
NotFound, MofError (Duplicate, Invalid Object, Inaccessible Object, Composition Closure, Composition Cycle)

   The “modify_<attribute_name>? operation replaces an occurrence of the value passed in the “old_element? parameter with the value of “new_element.? “NotFound? occurs if the “old_element? value is not present in the Attribute’s initial collection value.

   If the Attribute has “isOrdered? set to true, the operation is required to preserve the initial order of the collection’s elements. If it also has “isUnique? set to false, then the operation is defined to replace the first occurrence (i.e., the one with the smallest index).

   “Duplicate,? “Composition Closure,? and “Composition Cycle? occur in similar situations to those described for “add_<attribute_name>? above.

   “Invalid Object? and “Inaccessible Object? occur when some Instance object is found to be non-existent or inaccessible. An implementation should only signal one of these conditions when it prevents other consistency checking (e.g., testing for composition cycles).

   modify_<attribute_name>_at

   The “modify_<attribute_name>_at? operation updates a multi-valued Attribute by replacing a member of its collection value at a given position. It is provided for non-unique Attributes where the member to be modified must be specified using an index. This operation is suppressed for optional and single-valued Attributes and for Attributes with “isChangeable? set to false.

reflective analog:

return type:

parameters:

exceptions:

ref_modify_value_at( <attribute_designator>, new_element, position); (see 10.2.3, “Reflective::RefObject (abstract),? on page 254).
none
in <AttributeType> new_element in unsigned long position
BadPosition, MofError (Duplicate, Invalid Object, Inaccessible Object, Composition Closure, Composition Cycle)

   The “modify_<attribute_name>_at? operation replaces the value whose index in the collection is given by the “position? parameter. “BadPosition? occurs if the “position? parameter is greater than or equal to the number of elements in the Attribute collection.

   The replacement value is given by the “new_value? parameter. The operation is required to preserve the order of the collection’s elements.

   “Duplicate,? “Composition Closure,? and “Composition Cycle? occur in similar situations to those described for “add_<attribute_name>? above.

   “Invalid Object? and “Inaccessible Object? occur when some Instance object is found to be non-existent or inaccessible. An implementation should only signal one of these conditions when it prevents other consistency checking (e.g., testing for composition cycles).

   remove_<attribute_name>

   The “remove_<attribute_name>? operation removes an existing member from a multi-valued Attribute. This operation is suppressed for optional and single-valued Attributes and for Attributes with “isChangeable? set to false. It is also suppressed when the lower and upper bounds are equal.


return type:

parameters:

exceptions:

none

in <AttributeType> old_element
NotFound, MofError(Underflow)

   The “remove_<attribute_name>? operation removes an occurrence of the value passed in the “old_element? parameter. “NotFound? occurs if the “old_element? value is not present in the Attribute’s collection value.

   If the Attribute has “isOrdered? set to true, the operation is required to preserve the initial order of the collection’s elements. If it also has “isUnique? set to false, then the operation is defined to remove the first occurrence (i.e., the one with the smallest index).

   “Underflow? occurs if removing an element makes the number of elements in the collection less than the Attribute’s lower bound.

   NOTE: The “remove_<attribute_name>? operation should not signal an exception if it finds that some Instance object is nonexistent or inaccessible. If the object in question is the object to be removed from the Attribute, it should be removed. Otherwise, the condition should be silently ignored.

   remove_<attribute_name>_at

   The “remove_<attribute_name>_at? operation removes the member at a given position from a multi-valued Attribute. This operation is suppressed for optional and single-valued Attributes, and for Attributes with “isChangeable? or “isOrdered? set to false or “isUnique? set to true. It is also suppressed when the lower and upper bounds are equal.

reflective analog:

return type:

parameters:

exceptions:

ref_remove_value_at(<attribute_designator>, position); (see 10.2.3, “Reflective::RefObject (abstract),? on page 254).

none
in unsigned long position
BadPosition, MofError(Underflow)

   The “remove_<attribute_name>_at? operation removes the element of an Attribute’s collection value whose (zero based) index is given by the “position? parameter. “BadPosition? occurs if the “position? value is greater than or equal to the number of elements in the Attribute’s collection value.

   “Underflow? occurs if removing an element makes the number of elements in the collection less than the Attribute’s lower bound.

9.8.12 Reference Template

   The Reference Template defines the IDL generation rules for a Reference whose “visibility? is “public_vis.? The IDL generated for a Reference is declared within the scope of <ClassName>Class interface definition. The IDL generated by the Reference Template provides the operations to return the value of the Reference as well as operations to modify it. The IDL generated is dependent upon the multiplicity, mutability, and ordering of the specified Reference.

   The Reference Template defines the IDL generation rules for References. It declares operations on the Instance interface to query and update links in the Association object for the current extent.

   The operations generated for a Reference and their signatures depend heavily on the properties of the referenced AssociationEnd, which are also mirrored on the Reference itself. For the purposes of defining the generated IDL, Reference multiplicities fall into three groups:

   The generated operations for a Reference are designed to have similar signatures and behaviors to those for an instancescoped Attribute with the same multiplicity and changeability settings.

   NOTE: Recall that Reference is only well formed if the referenced AssociationEnd has “isNavigable? set to true. Similarly, a Reference’s “isChangeable? can only be true if the referenced AssociationEnd’s “isChangeable? is also true.

   Template

   // If the Reference has visibility of protected or private, no IDL// is generated

<<ANNOTATION TEMPLATE>>

   // operations to return the Reference value// if lower = 0 and upper = 1<ReferenceClass> <reference_name> ()

   raises (Reflective::NotSet, Reflective::MofError);

   // if this Reference has an idl_version Tag #pragma version <reference_name> <version>

   // if lower = 1 and upper = 1<ReferenceClass> <reference_name> ()

   raises (Reflective::MofError);

   // if this Reference has an idl_version Tag #pragma version <reference_name> <version>

   // if upper > 1<ReferenceClass><Multiplicity> <reference_name> ()

   raises (Reflective::MofError);

   // if this Reference has an idl_version Tag #pragma version <reference_name> <version>

   // operations to modify the Reference value// if upper = 1 and is_changeablevoid set_<reference_name> (

   in <ReferenceClass> new_value)

raises (Reflective::MofError);

   // if this Reference has an idl_version Tag #pragma version set_<reference_name> <version>

   // if upper > 1 and is_changeable

   void set_<reference_name> (in <ReferenceClass><Multiplicity> new_value)raises (Reflective::MofError);

   // if this Reference has an idl_version Tag #pragma version set_<reference_name> <version>

   // if lower = 0 and upper = 1 and is_changeablevoid unset_<reference_name> ()raises (Reflective::MofError);

   // if this Reference has an idl_version Tag #pragma version unset_<reference_name> <version>

   // if upper > 1 and is_changeable

   void add_<reference_name> (in <ReferenceClass> new_element)raises (Reflective::MofError);

   // if this Reference has an idl_version Tag #pragma version add_<reference_name> <version>

   // if upper > 1 and is_changeable and is_ordered

   void add_<reference_name>_before (in <ReferenceClass> new_element,in <ReferenceClass> before_element)raises (Reflective::NotFound, Reflective::MofError);

   // if this Reference has an idl_version Tag #pragma version add_<reference_name>_before <version>

   // if upper > 1 and is_changeable

   void modify_<reference_name> (in <ReferenceClass> old_element,in <ReferenceClass> new_element)raises (Reflective::NotFound, Reflective::MofError);

   // if this Reference has an idl_version Tag #pragma version modify_<reference_name> <version>

   // if upper > 1 and lower != upper and is_changeble

   void remove_<reference_name> (

   in <ReferenceClass> old_element)

   raises (Reflective::NotFound, Reflective::MofError);

   // if this Reference has an idl_version Tag #pragma version remove_<reference_name> <version>

   <reference_name>

   The “<reference_name>? operation reads the value of Reference. The signature of the operation depends on the multiplicity of the Reference.

reflective analog: ref_value(<reference_designator>); (see 10.2.3, “Reflective::RefObject (abstract),? on page 254).
return type: [0..1] - <ReferenceClass> [1..1] - <ReferenceClass> other - <ReferenceClass><CollectionKind>
parameters: none
exceptions: [0..1] - NotSet, MofError [1..1] - MofError (Underflow) other - MofError

   The “<reference_name>? operation’s signature is determined by the multiplicity of the Reference, and hence the referenced AssociationEnd, as shown above.

   In each case, the operation calculates and returns the projection of “this? object in the link set of the referenced AssociationEnd’s Association for the current outermost extent:

   NOTE: Under no circumstances should the “<reference_name>? operation return a nil object reference or a sequence that includes a nil object reference.

   set_<reference_name>

   The “set_<reference_name>? operation assigns a new value to a Reference. The signature of the operation depends on the multiplicity of the Reference. If “isChangeable? is set to false for the Reference, this operation is suppressed.

reflective analog:

return type:

parameters:

exceptions:

ref_set_value(<reference_designator>, new_value); (See 10.2.3, “Reflective::RefObject (abstract),? on page 254.)
none
[0..1] - in <ReferenceClass> new_value [1..1] - in <ReferenceClass> new_value other -in <ReferenceClass><CollectionKind> new_value
[0..1] - MofError (Overflow, Underflow, Invalid Object, Nil Object, Inaccessible Object, Composition Closure, Composition Cycle, Reference Closure) [1..1] - MofError (Overflow, Underflow, Invalid Object, Nil Object, Inaccessible Object, Composition Closure, Composition Cycle, Reference Closure) other -MofError (Overflow, Underflow, Duplicate, Nil Object, Inaccessible Object, Invalid Object, Composition Closure, Composition Cycle, Reference Closure)

   The “set_<reference_name>? operation’s signature is determined by the multiplicity of the Reference, and hence the referenced AssociationEnd, as shown above.

   In each case, the operation replaces the set of links in the extent for the referenced AssociationEnd’s Association. The behavior is as follows:

   The projection for an optional-valued Reference can only be set to “empty? using the “unset_<reference_name>? operation; see below.

   The ordering semantics of the “set_<reference_name>? operation depend on the setting of “isOrdered? in the “multiplicity? for the Reference’s “referencedEnd? and “exposedEnd? AssociationEnds:

   unset_<reference_name>

   The “unset_<reference_name>? operation sets an optional-valued Reference to empty. If “isChangeable? is set to false for the Reference, or if the bounds are not [0..1], this operation is suppressed.

reflective analog:

return type:

parameters:

exceptions:

ref_reset_value(<reference_designator>); (See 10.2.3, “Reflective::RefObject (abstract),? on page 254.)

none
none
MofError

   The “unset_<reference_name>? operation removes the link for this object from the link set of the referenced Association, should it exist. If no such link exists, the operation does nothing.

   If the “exposedEnd? AssociationEnd has “isOrdered? set to true, the operation preserves the ordering of the projection that initially contains “this? Instance object.

   © ISO/IEC 2005 - All rights reserved

   add_<reference_name>

The “add_<reference_name>? operation adds an Instance object to a Reference collection. If “isChangeable? is set to false for the Reference, or the Reference’s upper bound is 1, this operation is suppressed.

reflective analog:

return type:

parameters:

exceptions:

ref_add_value(<reference_designator>, new_element); (See 10.2.3, “Reflective::RefObject (abstract),? on page 254.)
none
in <ReferenceClass> new_element
MofError (Overflow, Duplicate, Invalid Object, Nil Object, Inaccessible Object, Reference Closure, Composition Closure, Composition Cycle)

   The “add_<reference_name>? operation adds the “new_element? Instance to a multi-valued Reference collection by creating a link in the corresponding Association’s link set. “Invalid Object,? “Nil Object,? or “Inaccessible Object? occur if the “new_element? parameter is a non-existent, nil, or inaccessible Instance object.

   If the “referencedEnd? AssociationEnd has “isOrdered? set to true, the new link should be created so that “new_element? is the last element of the projection of “this? object. Alternatively, if the “exposedEnd? AssociationEnd has “isOrdered? set to true, the new link should be created so that “this? object is the last element of the projection of the “new_element? object. In either case, the operation should preserve the order of other elements in the respective ordered projections.

   “Overflow? occurs if the number of elements in the projections of either the “this? object or the “new_element? object already equals the respective AssociationEnd’s upper bound.

   “Duplicate? occurs if the operation would create a duplicate link in the link set for the referenced Association. For example, when the “new_element? value is a duplicate of a value in the current Reference collection.

   “Reference Closure,? “Composition Closure,? and “Composition Cycle? all occur in similar situations to those described above for the “set_<reference_name>? operation.

   add_<reference_name>_before

The “add_<reference_name>_before? operation adds an Instance object at a particular place in an ordered Reference collection. If “isChangeable? or “isOrdered? is set to false for the Reference, this operation is suppressed.

reflective analog:

return type:

parameters:

exceptions:

ref_add_value_before( <reference_designator>, new_element, before_element); (see 10.2.3, “Reflective::RefObject (abstract),? on page 254).
none
in <ReferenceClass> new_element in <ReferenceClass> before_element
NotFound, MofError (Overflow, Duplicate, Invalid Object, Nil Object, Inaccessible Object, Reference Closure, Composition Closure, Composition Cycle).

   The “add_<reference_name>_before? operation is a more specialized version of the “add_<reference_name>? operation described previously. It creates a link between “this? object and the “new_element? Instance object so that it appears in a designated place in “this? object’s projection.

   The “before_element? parameter gives the Instance object in the projection of “this? before which the “new_element? object should be inserted. “Invalid Object,? “Nil Object,? and “Inaccessible Object? occur if either “new_element? or “before_element? is a non-existent, nil or inaccessible Instance object. “Not Found? occurs if “before_element? is not present in the projection of “this? object.

   The new link is created such that the “new_element? object appears immediately before the “before_element? value in the projection of “this? object. Apart from this, the order of the projection’s elements is unchanged.

   “Overflow,? “Duplicate,? “Reference Closure,? “Composition Closure? and “Composition Cycle? all occur in equivalent situations to those described above for the “add_<reference_name>? and “set_<reference_name>? operations.

   modify_<reference_name>

   The “modify_<reference_name>? operation updates a Reference collection, replacing one element with another. If the Reference is not multi-valued or its “isChangeable? multiplicity flag is set to false, this operation is suppressed.

reflective analog:

return type:

parameters:

exceptions:

ref_modify_value( <reference_designator>, old_element, new_element); (see 10.2.3, “Reflective::RefObject (abstract),? on page 254).
none
in <ReferenceClass> old_element in <ReferenceClass> new_element
NotFound, MofError (Underflow, Overflow, Duplicate, Invalid Object, Nil Object, Inaccessible Object, Reference Closure, Composition Closure, Composition Cycle)

   The “modify_<reference_name>? operation updates the link set so that the projection of “this? object has “new_element? in place of “old_element.? The operation is notionally equivalent to either

   <the_association>.modify_<association_end1>(old_element, <this>, new_element)

   or

   <the_association>.modify_<association_end2>(<this>, old_element, new_element)

   where <the_association> is the current outermost extent’s M1-level Association object for the referenced M2-level Association.

   The “old_element? and “new_element? parameters must both give usable Instance objects. “Invalid Object,? “Nil Object,? or “Inaccessible Object? occur if either is a non-existent, nil or inaccessible object.

   The “old_element? object must be an element of the projection of “this? object; that is, a link must already exist between “this? and “old_element.? “NotFound? occurs if this is not the case. If “old_element? and “new_element? are the same Instance object, the operation is required to do nothing at all.

   If the referenced Association is ordered, the operation is required to preserve ordering as follows:

   “Overflow? occurs when the number of elements in the projection of “new_element? would be greater than the upper bound for the “exposedEnd? AssociationEnd.

   “Underflow? occurs when the number of elements in the projection of “old_element? would be decreased, and it would be less than the lower bound of the “exposedEnd? AssociationEnd. (In the case where “old_element? and “new_element? are the same object, the operation does not alter the number of elements in the projection. Hence “Overflow? cannot be signalled, even if the number of elements is less than the bound.)

   “Duplicate? occurs if the “modify_<reference_name>? operation would introduce a duplicate into the projection. (Care should be taken to avoid signalling “Duplicate? in the case where “old_element? and “new_element? are the same object.)

   “Reference Closure,? “Composition Closure,? and “Composition Cycle? all occur in equivalent situations to those described above for the “add_<reference_name>? and “set_<reference_name>? operations.

   remove_<reference_name>

   The “remove_<reference_name>? operation updates a Reference collection by removing an element. If the Reference is not multi-valued or its “isChangeable? multiplicity flag is set to false, this operation is suppressed. It is also suppressed if the Reference’s lower and upper bounds are equal.

reflective analog:

return type:

parameters:

exceptions:

ref_remove_value( <reference_designator>, old_element); (see 10.2.3, “Reflective::RefObject (abstract),? on page 254).

none
in <ReferenceClass> old_element
NotFound, MofError (Underflow)

   The “remove_<reference_name>? operation updates the link set (i.e., by removing a link) so that the projection of “this? object no longer contains “old_element.? “NotFound? occurs if there is no link to be deleted.

   NOTE: The “remove_<reference_name>? operation should be able to cope with removal of a link when the object at the other end of a link is non-existent or inaccessible.

   If the referenced Association is ordered, the operation is required to preserve the ordering of the projection with the ordered collection value.

   “Underflow? occurs when the number of elements in the projections of “old_element? and “this? would be less than the lower bounds of the respective AssociationEnds.

9.8.13 Operation Template

   The Operation Template defines the IDL generation rules for M2-level Operations whose “visibility? is “public_vis.? It generates an IDL operation within the scope of an Instance or Class Proxy interface, depending on the scope of the M2level Operation.

   Template

   // If the Operation has visibility of protected or private, no IDL// is generated

<<ANNOTATION TEMPLATE>>

   // if Operation contains no “return? Parameter void <operation_name>(// else <ReturnParamType>[<CollectionKind>] <operation_name>(

   // for each contained “in?, “out? or “inout? Parameter

   <direction> <ParamType>[<CollectionKind>] <param_name>, ...)raises (

    // for each Exception raised by the Operation<ExceptionName>, ... // (a trailing comma is required)Reflective::MofError);

   // if this Operation has an idl_version Tag #pragma version <operation_name> <version>

   // for each Constraint contained by this Operation

<<CONSTRAINT_TEMPLATE>>

   <operation_name>

   An “<operation_name>? operation invokes an implementation specific method to perform the behavior implied by the M2-level Operation model element.

reflective analog: ref_invoke_operation( <reference_designator>, old_element); (see 10.2.3, “Reflective::RefObject (abstract),? on page 254).
return type: no return param -void [0..1] return param -<ParamType>Bag <param_name> [1..1] return param -<ParamType> <param_name> other return param -<ParamType><CollectionKind> <param_name>
parameters: <direction> <ParamType>[<CollectionKind>], ...
exceptions: <ExceptionName>, ... MofError (Overflow, Underflow, Duplicate, Invalid Object, Semantic Error)

   An “<operation_name>? operation invokes an implementation specific method. While the behavior of the method itself is beyond the scope of the IDL mapping, the signature of the IDL operation is defined by the mapping, along with some parameter checking semantics.

   The return type for an “<operation_name>? operation is generated from the M2-level Operation’s (optional) return Parameter. For example, the contained Parameter object whose “direction? attribute has the value “return_dir.? The return type is as follows:

   The parameter declarations for an “<operation_name>? operation are generated from the M2-level Operation’s Parameter, excluding the return Parameter (if any). For each non-return Parameter of the Operation, in the defined order, the “<operation_name>? declaration has a parameter declaration consisting of the following:

   The list of exceptions raised by an “<operation_name>? operation is generated from the M2-level Operation’s “exceptions.? The generated “raises? list consists of an appropriately qualified identifier for each M2-level Exception in the Operation’s “exceptions? list, followed by the qualified identifier for the MofError exception. The “raises? list should of course be comma separated as required by the syntax for OMG IDL.

   While meta-model specific error conditions should be signalled by raising exceptions corresponding to the Operation’s “exceptions? list, MofError is used to signal the following structural errors relating to the values supplied by the caller for “in? and “inout? parameters.

   deleted) or inaccessible object. This condition will occur if duplicate checking finds an Instance object that it cannot test for equality. It can also occur if the semantics of the Operation require an Instance object reference to be usable.

   Like all other operations that have MofError in their signature, an “<operation_name>? operation can use MofError to signal Constraint errors and Semantic errors.

   If an Operation has a multi-valued ’out,’ ’inout,’ or ’return’ Parameter, or if it can raise an Exception with a multi-valued field, its implementation shall ensure that the returned collection or collections satisfy the Parameters’ multiplicity constraints. If they do not, the implementation shall use MofError to signal a Semantic Error. (Since this case is deemed to be an error in the implementation, “Overflow,? “Underflow,? “Duplicate,? or “Invalid? Object must not be signalled here.)

9.8.14 Exception Template

   The Exception template defines the IDL generation rules for M2-level Exceptions whose “visibility? is “public_vis.?

   Template

   // If the Exception has visibility of protected or private, no IDL// is generated

   <<ANNOTATION TEMPLATE>>

   exception <ExceptionName> {

   // for each Parameter

   <ParameterType>[<CollectionKind>] <parameter_name>; ...};

   // if this Exception has an idl_version Tag #pragma version <ExceptionName> <version>

   Description

   The generated IDL for an M2-level Exception is an IDL exception. The declaration appears within an IDL interface or module corresponding to the Exception’s M2-level container. In the case of an M2-level Class, this is the Class Proxy interface so that the IDL exception is available to be raised by classifier-scoped Operations.

   The fields of the IDL exception are generated from the Exception’s Parameters in a way that is similar to Operation Parameters:

    200 .

   Constant Template

   The Constant Template defines the rules for generating IDL constant declarations from M2-level Constants.

   Template

   <<ANNOTATION TEMPLATE>>const <ConstantType> <CONSTANT_NAME> = <CONSTANTVALUE>;// if this Constant has an idl_version Tag

    #pragma version <CONSTANT_NAME> <version>

   The generated IDL for an M2-level Constant is an IDL constant declaration. The IDL appears an interface or module corresponding to the Constant’s M2-level container. In the container is a Class, the declaration appears within the Class Proxy interface.

   The IDL generation process needs to produce a valid IDL literal value of the appropriate type from the Constant’s “value.?

9.8.15 DataType Template

   The DataType Template defines the rules for generating IDL for an M2-level DataType subtypes whose “visibility? is “public_vis.? This typically consists of an IDL type declaration for the data type, followed by one or more collection type declarations, as required.

   NOTE: If the IDL mapping preconditions are strictly observed, the template will only generate IDL declarations for the DataType’s type in cases where this is appropriate.

   Template

   // If the DataType’s visibility is protected or private, no IDL// is generated

<<ANNOTATION TEMPLATE>>

   // generate the DataType’s type declaration// if the DataType is an AliasTypetypedef <type.TYPESPEC> <DatatypeName>;// if this DataType has an idl_version Tag

    #pragma version <DatatypeName> <version>

   // else if the DataType is a CollectionTypetypedef sequence < <type.TYPESPEC> > <DatatypeName>;// if this DataType has an idl_version Tag

    #pragma version <DatatypeName> <version>

   // else if the DataType is an EnumerationTypeenum <DatatypeName> { <label> , ... };// if this DataType has an idl_version Tag

    #pragma version <DatatypeName> <version>

   // else if the DataType is a StructureType

   struct <DatatypeName> {

   // for each StructureField of the StructureType

   <StructField.type.TYPESPEC> <struct_field.name> ; ...

   };

   // if this DataType has an idl_version Tag #pragma version <DatatypeName> <version>

   // else no declaration. The PrimitiveTypes do not require IDL// declarations. All supported PrimitiveTypes map to builtin// CORBA IDL types.// For each Constraint contained by this DataType

<<CONSTRAINT_TEMPLATE>>

   typedef sequence < <DataTypeName> > <DataTypeName>Bag;// if this DataType has an idl_version Tag

    #pragma version <DatatypeName>Bag <version>

   typedef sequence < <DataTypeName> > <DataTypeName>Set;// if this DataType has an idl_version Tag

    #pragma version <DatatypeName>Set <version>

   typedef sequence < <DataTypeName> > <DataTypeName>List;// if this DataType has an idl_version Tag

#pragma version <DatatypeName>List <version>

   typedef sequence < <DataTypeName> > <DataTypeName>UList;// if this DataType has an idl_version Tag

#pragma version <DatatypeName>UList <version>

   Description

   A DataType template generates IDL M2-level DataType subclass instances for the technology neutral and CORBA specific data types. The template produces the following declarations:

9.8.16 Constraint Template

   The Constraint template defines the rules for generating the requisite error kind string declaration for an M2-level Constraint.

   Template

   <<ANNOTATION TEMPLATE>>const string <CONSTRAINT_NAME> = "<constraint.string>";// if this Constraint has an idl_version Tag

    #pragma version <CONSTRAINT_NAME> <version>

   Description

   The Constraint template generates an IDL string constant whose name is based on the M2-level Constraint name. If the Constraint is contained by an M2-level DataType or Operation, the constant declaration is generated within the scope of the Constraint container’s container. If this results in a name collision, the meta-modeler can solve the problem using a substitute name tag as described in 9.6.2.1, “Substitute Name,? on page 196.

   The “<constraint.string>? value is generated to match the following syntax (expressed in EBNF):

   <constraint.string> ::= [ <IDL prefix> ] ‘:constraint.’ ( <container_name> ‘.’ )+ <constraint_name>

   The components of the error kind string value are as follows:

9.8.17 Annotation Template

   The Annotation template optionally generates IDL comments for an M2-level ModelElement’s “annotation.? This template should be regarded as indicative rather than normative.

   Template

   // Annotation comments may optionally be suppressed by the IDL// generator

   // Annotation comments may use the "/*…*/" style

   /* <line 1 of the ANNOTATION><line 2 of the ANNOTATION>. . . <line N of the ANNOTATION> */

   // or the "//" style

   // <line 1 of ANNOTATION>// <line 2 of ANNOTATION>// . . .// <line N of the ANNOTATION>

   Description

   The Annotation template optionally includes the “annotation? for a ModelElement in the generated IDL as an IDL comment. It is anticipated that a vendor’s IDL generator would give some control over the way that these comments are generated. For example, allowing the user to