This chapter describes the concrete object model that underlies the CORBA architecture The model is derived from the abstract Core Object Model defined by the Object Management Group in the Object Management Architecture Guide Information about the OMA Guide and other books in the CORBA documentation set is provided in this document’s preface Contents This chapter contains the following sections Section Title Page “Overview? 1-1 “Object Semantics? 1-2 “Object Implementation? 1-9 The object model provides an organized presentation of object concepts and terminology It defines a partial model for computation that embodies the key characteristics of objects as realized by the submitted technologies The OMG object model is abstract in that it is not directly realized by any particular technology The model described here is a concrete object model A concrete object model may differ from the abstract object model in several ways • It may elaborate the abstract object model by making it more specific for example by defining the form of request parameters or the language used to specify types • It may populate the model by introducing specific instances of entities defined by the model for example specific objects specific operations or specific types • It may restrict the model by eliminating entities or placing additional restrictions on their use An object system is a collection of objects that isolates the requestors of services clients from the providers of services by a well-defined encapsulating interface In particular clients are isolated from the implementations of services as data representations and executable code The object model first describes concepts that are meaningful to clients including such concepts as object creation and identity requests and operations types and signatures It then describes concepts related to object implementations including such concepts as methods execution engines and activation The object model is most specific and prescriptive in defining concepts meaningful to clients The discussion of object implementation is more suggestive with the intent of allowing maximal freedom for different object technologies to provide different ways of implementing objects There are some other characteristics of object systems that are outside the scope of the object model Some of these concepts are aspects of application architecture some are associated with specific domains to which object technology is applied Such concepts are more properly dealt with in an architectural reference model Examples of excluded concepts are compound objects links copying of objects change management and transactions Also outside the scope of the object model are the details of control structure the object model does not say whether clients and or servers are single-threaded or multi-threaded and does not specify how event loops are programmed nor how threads are created destroyed or synchronized This object model is an example of a classical object model where a client sends a message to an object Conceptually the object interprets the message to decide what service to perform In the classical model a message identifies an object and zero or more actual parameters As in most classical object models a distinguished first parameter is required which identifies the operation to be performed the interpretation of the message by the object involves selecting a method based on the specified operation Operationally of course method selection could be performed either by the object or the ORB An object system provides services to clients A client of a service is any entity capable of requesting the service This section defines the concepts associated with object semantics that is the concepts relevant to clients An object system includes entities known as objects An object is an identifiable encapsulated entity that provides one or more services that can be requested by a client Clients request services by issuing requests The term request is broadly used to refer to the entire sequence of causally related events that transpires between a client initiating it and the last event causally associated with that initiation For example • the client receives the final response associated with that request from the server • the server carries out the associated operation in case of a oneway request or • the sequence of events associated with the request terminates in a failure of some sort The initiation of a Request is an event The information associated with a request consists of an operation a target object zero or more actual parameters and an optional request context A request form is a description or pattern that can be evaluated or performed multiple times to cause the issuing of requests As described in the OMG IDL Syntax and Semantics chapter request forms are defined by particular language bindings An alternative request form consists of calls to the dynamic invocation interface to create an invocation structure add arguments to the invocation structure and to issue the invocation refer to the Dynamic Invocation Interface chapter for descriptions of these request forms A value is anything that may be a legitimate actual parameter in a request More particularly a value is an instance of an OMG IDL data type There are non-object values as well as values that reference objects An object reference is a value that reliably denotes a particular object Specifically an object reference will identify the same object each time the reference is used in a request subject to certain pragmatic limits of space and time An object may be denoted by multiple distinct object references A request may have parameters that are used to pass data to the target object it may also have a request context that provides additional information about the request A request context is a mapping from strings to strings A request causes a service to be performed on behalf of the client One possible outcome of performing a service is returning to the client the results if any defined for the request If an abnormal condition occurs during the performance of a request an exception is returned The exception may carry additional return parameters particular to that exception The request parameters are identified by position A parameter may be an input parameter an output parameter or an input-output parameter A request may also return a single return result value as well as the results stored into the output and input-output parameters The following semantics hold for all requests • Any aliasing of parameter values is neither guaranteed removed nor guaranteed to be preserved • The order in which aliased output parameters are written is not guaranteed • The return result and the values stored into the output and input-output parameters are undefined if an exception is returned For descriptions of the values and exceptions that are permitted see Section 1 2 4 “Types ? on page 1-4 and Section 1 2 8 3 “Exceptions ? on page 1-8 Objects can be created and destroyed From a client’s point of view there is no special mechanism for creating or destroying an object Objects are created and destroyed as an outcome of issuing requests The outcome of object creation is revealed to the client in the form of an object reference that denotes the new object A type is an identifiable entity with an associated predicate a single-argument mathematical function with a boolean result defined over entities An entity satisfies a type if the predicate is true for that entity An entity that satisfies a type is called a member of the type Types are used in signatures to restrict a possible parameter or to characterize a possible result The extension of a type is the set of entities that satisfy the type at any particular time An object type is a type whose members are object references In other words an object type is satisfied only by object references Constraints on the data types in this model are shown in this section 1 2 4 1 Basic types • 16-bit 32-bit and 64-bit signed and unsigned 2’s complement integers • Single-precision 32-bit double-precision 64-bit and double-extended a mantissa of at least 64 bits a sign bit and an exponent of at least 15 bits IEEE floating point numbers • Fixed-point decimal numbers of up to 31 significant digits • Characters as defined in ISO Latin-1 8859 1 and other single- or multi-byte character sets • A boolean type taking the values TRUE and FALSE • An 8-bit opaque detectable guaranteed to not undergo any conversion during transfer between systems • Enumerated types consisting of ordered sequences of identifiers • A string type which consists of a variable-length array of characters the length of the string is a non-negative integer and is available at run-time The length may have a maximum bound defined • A wide character string type which consist of a variable-length array of fixed width wide characters the length of the wide string is a non-negative integer and is available at run-time The length may have a maximum bound defined • A container type “any ? which can represent any possible basic or constructed type • Wide characters that may represent characters from any wide character set • Wide character strings which consist of a length available at runtime and a variable-length array of fixed width wide characters 1 2 4 2 Constructed types • A record type called struct which consists of an ordered set of name value pairs • A discriminated union type which consists of a discriminator whose exact value is always available followed by an instance of a type appropriate to the discriminator value • A sequence type which consists of a variable-length array of a single type the length of the sequence is available at run-time • An array type which consists of a fixed-shape multidimensional array of a single type • An interface type which specifies the set of operations that an instance of that type must support • A value type which specifies state as well as a set of operations that an instance of that type must support Entities in a request are restricted to values that satisfy these type constraints The legal entities are shown in No particular representation for entities is defined Object Reference Value Type Abstract Interface Entity Basic Value Constructed Values Figure 1-1 Legal Values Short Long LongLong UShort Ulong UlongLong Float Double LongDouble Fixed Char Wchar String Wstring Struct Boolean Sequence Octet Union Enum Array Any An interface is a description of a set of possible operations that a client may request of an object through that interface It provides a syntactic description of how a service provided by an object supporting this interface is accessed via this set of operations An object satisfies an interface if it provides its service through the operations of the interface according to the specification of the operations see Section 1 2 8 “Operations ? on page 1-7 The interface type for a given interface is an object type such that an object reference will satisfy the type if and only if the referent object also satisfies the interface Interfaces are specified in OMG IDL Interface inheritance provides the composition mechanism for permitting an object to support multiple interfaces The principal interface is simply the most-specific interface that the object supports and consists of all operations in the transitive closure of the interface inheritance graph Interfaces satisfy the Liskov substitution principle If interface A is derived from interface B then a reference to an object that supports interface A can be used where the formal type of a parameter is declared to be B A value type is an entity which shares many of the characteristics of interfaces and structs It is a description of both a set of operations that a client may request and of state that is accessible to a client Instances of a value type are always local concrete implementations in some programming language A value type in addition to the operations and state defined for itself may also inherit from other value types and through multiple inheritance support other interfaces Value types are specified in OMG IDL An abstract value types describes a value type that is a “pure? bundle of operations with no state An abstract interface is an entity which may at runtime represent either a regular interface see Section 1 2 5 “Interfaces ? on page 1-6 or a value type see Section 1 2 6 “Value Types ? on page 1-6 Like an abstract value type it is a pure bundle of operations with no state Unlike an abstract value type it does not imply pass-by-value semantics and unlike a regular interface type it does not imply pass-byreference semantics Instead the entity's runtime type determines which of these semantics are used An operation is an identifiable entity that denotes the indivisible primitive of service provision that can be requested The act of requesting an operation is referred to as invoking the operation An operation is identified by an operation identifier An operation has a signature that describes the legitimate values of request parameters and returned results In particular a signature consists of • A specification of the parameters required in requests for that operation • A specification of the result of the operation • An identification of the user exceptions that may be raised by an invocation of the operation • A specification of additional contextual information that may affect the invocation • An indication of the execution semantics the client should expect from an invocation of the operation Operations are potentially generic meaning that a single operation can be uniformly invoked on objects with different implementations possibly resulting in observably different behavior Genericity is achieved in this model via interface inheritance in IDL and the total decoupling of implementation from interface specification The general form for an operation signature is [oneway] param1 paramL [raises except1 exceptN ] [context name1 nameM ] where • The optional oneway keyword indicates that best-effort semantics are expected of requests for this operation the default semantics are exactly-once if the operation successfully returns results or at-most-once if an exception is returned • The is the type of the return result • The provides a name for the operation in the interface • The operation parameters needed for the operation they are flagged with the modifiers in out or inout to indicate the direction in which the information flows with respect to the object performing the request • The optional raises expression indicates which user-defined exceptions can be signaled to terminate an invocation of this operation if such an expression is not provided no user-defined exceptions will be signaled • The optional context expression indicates which request context information will be available to the object implementation no other contextual information is required to be transported with the request 1 2 8 1 Parameters A parameter is characterized by its mode and its type The mode indicates whether the value should be passed from client to server in from server to client out or both inout The parameter’s type constrains the possible value which may be passed in the directions dictated by the mode 1 2 8 2 Return Result The return result is a distinguished out parameter 1 2 8 3 Exceptions An exception is an indication that an operation request was not performed successfully An exception may be accompanied by additional exception-specific information The additional exception-specific information is a specialized form of record As a record it may consist of any of the types described in Section 1 2 4 “Types ? on page 1-4 All signatures implicitly include the system exceptions the standard system exceptions are described in Section 4 12 2 “System Exceptions ? on page 4-64 1 2 8 4 Contexts A request context provides additional operation-specific information that may affect the performance of a request 1 2 8 5 Execution Semantics Two styles of execution semantics are defined by the object model • At-most-once if an operation request returns successfully it was performed exactly once if it returns an exception indication it was performed at-most-once • Best-effort a best-effort operation is a request-only operation i e it cannot return any results and the requester never synchronizes with the completion if any of the request The execution semantics to be expected is associated with an operation This prevents a client and object implementation from assuming different execution semantics Note that a client is able to invoke an at-most-once operation in a synchronous or deferred-synchronous manner An interface may have attributes An attribute is logically equivalent to declaring a pair of accessor functions one to retrieve the value of the attribute and one to set the value of the attribute An attribute may be read-only in which case only the retrieval accessor function is defined This section defines the concepts associated with object implementation i e the concepts relevant to realizing the behavior of objects in a computational system The implementation of an object system carries out the computational activities needed to effect the behavior of requested services These activities may include computing the results of the request and updating the system state In the process additional requests may be issued The implementation model consists of two parts the execution model and the construction model The execution model describes how services are performed The construction model describes how services are defined A requested service is performed in a computational system by executing code that operates upon some data The data represents a component of the state of the computational system The code performs the requested service which may change the state of the system Code that is executed to perform a service is called a method A method is an immutable description of a computation that can be interpreted by an execution engine A method has an immutable attribute called a method format that defines the set of execution engines that can interpret the method An execution engine is an abstract machine not a program that can interpret methods of certain formats causing the described computations to be performed An execution engine defines a dynamic context for the execution of a method The execution of a method is called a method activation When a client issues a request a method of the target object is called The input parameters passed by the requestor are passed to the method and the output and input-output parameters and return result value or exception and its parameters are passed back to the requestor Performing a requested service causes a method to execute that may operate upon an object’s persistent state If the persistent form of the method or state is not accessible to the execution engine it may be necessary to first copy the method or state into an execution context This process is called activation the reverse process is called deactivation A computational object system must provide mechanisms for realizing behavior of requests These mechanisms include definitions of object state definitions of methods and definitions of how the object infrastructure is to select the methods to execute and to select the relevant portions of object state to be made accessible to the methods Mechanisms must also be provided to describe the concrete actions associated with object creation such as association of the new object with appropriate methods An object implementation—or implementation for short—is a definition that provides the information needed to create an object and to allow the object to participate in providing an appropriate set of services An implementation typically includes among other things definitions of the methods that operate upon the state of an object It also typically includes information about the intended types of the object The object model provides an organized presentation of object concepts and terminology It defines a partial model for computation that embodies the key characteristics of objects as realized by the submitted technologies The OMG object model is abstract in that it is not directly realized by any particular technology The model described here is a concrete object model A concrete object model may differ from the abstract object model in several ways • It may elaborate the abstract object model by making it more specific for example by defining the form of request parameters or the language used to specify types • It may populate the model by introducing specific instances of entities defined by the model for example specific objects specific operations or specific types • It may restrict the model by eliminating entities or placing additional restrictions on their use An object system is a collection of objects that isolates the requestors of services clients from the providers of services by a well-defined encapsulating interface In particular clients are isolated from the implementations of services as data representations and executable code The object model first describes concepts that are meaningful to clients including such concepts as object creation and identity requests and operations types and signatures It then describes concepts related to object implementations including such concepts as methods execution engines and activation The object model is most specific and prescriptive in defining concepts meaningful to clients The discussion of object implementation is more suggestive with the intent of allowing maximal freedom for different object technologies to provide different ways of implementing objects There are some other characteristics of object systems that are outside the scope of the object model Some of these concepts are aspects of application architecture some are associated with specific domains to which object technology is applied Such concepts are more properly dealt with in an architectural reference model Examples of excluded concepts are compound objects links copying of objects change management and transactions Also outside the scope of the object model are the details of control structure the object model does not say whether clients and or servers are single-threaded or multi-threaded and does not specify how event loops are programmed nor how threads are created destroyed or synchronized This object model is an example of a classical object model where a client sends a message to an object Conceptually the object interprets the message to decide what service to perform In the classical model a message identifies an object and zero or more actual parameters As in most classical object models a distinguished first parameter is required which identifies the operation to be performed the interpretation of the message by the object involves selecting a method based on the specified operation Operationally of course method selection could be performed either by the object or the ORB An object system provides services to clients A client of a service is any entity capable of requesting the service This section defines the concepts associated with object semantics that is the concepts relevant to clients An object system includes entities known as objects An object is an identifiable encapsulated entity that provides one or more services that can be requested by a client Clients request services by issuing requests The term request is broadly used to refer to the entire sequence of causally related events that transpires between a client initiating it and the last event causally associated with that initiation For example • the client receives the final response associated with that request from the server • the server carries out the associated operation in case of a oneway request or • the sequence of events associated with the request terminates in a failure of some sort The initiation of a Request is an event The information associated with a request consists of an operation a target object zero or more actual parameters and an optional request context A request form is a description or pattern that can be evaluated or performed multiple times to cause the issuing of requests As described in the OMG IDL Syntax and Semantics chapter request forms are defined by particular language bindings An alternative request form consists of calls to the dynamic invocation interface to create an invocation structure add arguments to the invocation structure and to issue the invocation refer to the Dynamic Invocation Interface chapter for descriptions of these request forms A value is anything that may be a legitimate actual parameter in a request More particularly a value is an instance of an OMG IDL data type There are non-object values as well as values that reference objects An object reference is a value that reliably denotes a particular object Specifically an object reference will identify the same object each time the reference is used in a request subject to certain pragmatic limits of space and time An object may be denoted by multiple distinct object references A request may have parameters that are used to pass data to the target object it may also have a request context that provides additional information about the request A request context is a mapping from strings to strings A request causes a service to be performed on behalf of the client One possible outcome of performing a service is returning to the client the results if any defined for the request If an abnormal condition occurs during the performance of a request an exception is returned The exception may carry additional return parameters particular to that exception The request parameters are identified by position A parameter may be an input parameter an output parameter or an input-output parameter A request may also return a single return result value as well as the results stored into the output and input-output parameters The following semantics hold for all requests • Any aliasing of parameter values is neither guaranteed removed nor guaranteed to be preserved • The order in which aliased output parameters are written is not guaranteed • The return result and the values stored into the output and input-output parameters are undefined if an exception is returned For descriptions of the values and exceptions that are permitted see Section 1 2 4 “Types ? on page 1-4 and Section 1 2 8 3 “Exceptions ? on page 1-8 Objects can be created and destroyed From a client’s point of view there is no special mechanism for creating or destroying an object Objects are created and destroyed as an outcome of issuing requests The outcome of object creation is revealed to the client in the form of an object reference that denotes the new object A type is an identifiable entity with an associated predicate a single-argument mathematical function with a boolean result defined over entities An entity satisfies a type if the predicate is true for that entity An entity that satisfies a type is called a member of the type Types are used in signatures to restrict a possible parameter or to characterize a possible result The extension of a type is the set of entities that satisfy the type at any particular time An object type is a type whose members are object references In other words an object type is satisfied only by object references Constraints on the data types in this model are shown in this section 1 2 4 1 Basic types • 16-bit 32-bit and 64-bit signed and unsigned 2’s complement integers • Single-precision 32-bit double-precision 64-bit and double-extended a mantissa of at least 64 bits a sign bit and an exponent of at least 15 bits IEEE floating point numbers • Fixed-point decimal numbers of up to 31 significant digits • Characters as defined in ISO Latin-1 8859 1 and other single- or multi-byte character sets • A boolean type taking the values TRUE and FALSE • An 8-bit opaque detectable guaranteed to not undergo any conversion during transfer between systems • Enumerated types consisting of ordered sequences of identifiers • A string type which consists of a variable-length array of characters the length of the string is a non-negative integer and is available at run-time The length may have a maximum bound defined • A wide character string type which consist of a variable-length array of fixed width wide characters the length of the wide string is a non-negative integer and is available at run-time The length may have a maximum bound defined • A container type “any ? which can represent any possible basic or constructed type • Wide characters that may represent characters from any wide character set • Wide character strings which consist of a length available at runtime and a variable-length array of fixed width wide characters 1 2 4 2 Constructed types • A record type called struct which consists of an ordered set of name value pairs • A discriminated union type which consists of a discriminator whose exact value is always available followed by an instance of a type appropriate to the discriminator value • A sequence type which consists of a variable-length array of a single type the length of the sequence is available at run-time • An array type which consists of a fixed-shape multidimensional array of a single type • An interface type which specifies the set of operations that an instance of that type must support • A value type which specifies state as well as a set of operations that an instance of that type must support Entities in a request are restricted to values that satisfy these type constraints The legal entities are shown in No particular representation for entities is defined Object Reference Value Type Abstract Interface Entity Basic Value Constructed Values Figure 1-1 Legal Values Short Long LongLong UShort Ulong UlongLong Float Double LongDouble Fixed Char Wchar String Wstring Struct Boolean Sequence Octet Union Enum Array Any An interface is a description of a set of possible operations that a client may request of an object through that interface It provides a syntactic description of how a service provided by an object supporting this interface is accessed via this set of operations An object satisfies an interface if it provides its service through the operations of the interface according to the specification of the operations see Section 1 2 8 “Operations ? on page 1-7 The interface type for a given interface is an object type such that an object reference will satisfy the type if and only if the referent object also satisfies the interface Interfaces are specified in OMG IDL Interface inheritance provides the composition mechanism for permitting an object to support multiple interfaces The principal interface is simply the most-specific interface that the object supports and consists of all operations in the transitive closure of the interface inheritance graph Interfaces satisfy the Liskov substitution principle If interface A is derived from interface B then a reference to an object that supports interface A can be used where the formal type of a parameter is declared to be B A value type is an entity which shares many of the characteristics of interfaces and structs It is a description of both a set of operations that a client may request and of state that is accessible to a client Instances of a value type are always local concrete implementations in some programming language A value type in addition to the operations and state defined for itself may also inherit from other value types and through multiple inheritance support other interfaces Value types are specified in OMG IDL An abstract value types describes a value type that is a “pure? bundle of operations with no state An abstract interface is an entity which may at runtime represent either a regular interface see Section 1 2 5 “Interfaces ? on page 1-6 or a value type see Section 1 2 6 “Value Types ? on page 1-6 Like an abstract value type it is a pure bundle of operations with no state Unlike an abstract value type it does not imply pass-by-value semantics and unlike a regular interface type it does not imply pass-byreference semantics Instead the entity's runtime type determines which of these semantics are used An operation is an identifiable entity that denotes the indivisible primitive of service provision that can be requested The act of requesting an operation is referred to as invoking the operation An operation is identified by an operation identifier An operation has a signature that describes the legitimate values of request parameters and returned results In particular a signature consists of • A specification of the parameters required in requests for that operation • A specification of the result of the operation • An identification of the user exceptions that may be raised by an invocation of the operation • A specification of additional contextual information that may affect the invocation • An indication of the execution semantics the client should expect from an invocation of the operation Operations are potentially generic meaning that a single operation can be uniformly invoked on objects with different implementations possibly resulting in observably different behavior Genericity is achieved in this model via interface inheritance in IDL and the total decoupling of implementation from interface specification The general form for an operation signature is [oneway] param1 paramL [raises except1 exceptN ] [context name1 nameM ] where • The optional oneway keyword indicates that best-effort semantics are expected of requests for this operation the default semantics are exactly-once if the operation successfully returns results or at-most-once if an exception is returned • The is the type of the return result • The provides a name for the operation in the interface • The operation parameters needed for the operation they are flagged with the modifiers in out or inout to indicate the direction in which the information flows with respect to the object performing the request • The optional raises expression indicates which user-defined exceptions can be signaled to terminate an invocation of this operation if such an expression is not provided no user-defined exceptions will be signaled • The optional context expression indicates which request context information will be available to the object implementation no other contextual information is required to be transported with the request 1 2 8 1 Parameters A parameter is characterized by its mode and its type The mode indicates whether the value should be passed from client to server in from server to client out or both inout The parameter’s type constrains the possible value which may be passed in the directions dictated by the mode 1 2 8 2 Return Result The return result is a distinguished out parameter 1 2 8 3 Exceptions An exception is an indication that an operation request was not performed successfully An exception may be accompanied by additional exception-specific information The additional exception-specific information is a specialized form of record As a record it may consist of any of the types described in Section 1 2 4 “Types ? on page 1-4 All signatures implicitly include the system exceptions the standard system exceptions are described in Section 4 12 2 “System Exceptions ? on page 4-64 1 2 8 4 Contexts A request context provides additional operation-specific information that may affect the performance of a request 1 2 8 5 Execution Semantics Two styles of execution semantics are defined by the object model • At-most-once if an operation request returns successfully it was performed exactly once if it returns an exception indication it was performed at-most-once • Best-effort a best-effort operation is a request-only operation i e it cannot return any results and the requester never synchronizes with the completion if any of the request The execution semantics to be expected is associated with an operation This prevents a client and object implementation from assuming different execution semantics Note that a client is able to invoke an at-most-once operation in a synchronous or deferred-synchronous manner An interface may have attributes An attribute is logically equivalent to declaring a pair of accessor functions one to retrieve the value of the attribute and one to set the value of the attribute An attribute may be read-only in which case only the retrieval accessor function is defined An object system includes entities known as objects An object is an identifiable encapsulated entity that provides one or more services that can be requested by a client Clients request services by issuing requests The term request is broadly used to refer to the entire sequence of causally related events that transpires between a client initiating it and the last event causally associated with that initiation For example • the client receives the final response associated with that request from the server • the server carries out the associated operation in case of a oneway request or • the sequence of events associated with the request terminates in a failure of some sort The initiation of a Request is an event The information associated with a request consists of an operation a target object zero or more actual parameters and an optional request context A request form is a description or pattern that can be evaluated or performed multiple times to cause the issuing of requests As described in the OMG IDL Syntax and Semantics chapter request forms are defined by particular language bindings An alternative request form consists of calls to the dynamic invocation interface to create an invocation structure add arguments to the invocation structure and to issue the invocation refer to the Dynamic Invocation Interface chapter for descriptions of these request forms A value is anything that may be a legitimate actual parameter in a request More particularly a value is an instance of an OMG IDL data type There are non-object values as well as values that reference objects An object reference is a value that reliably denotes a particular object Specifically an object reference will identify the same object each time the reference is used in a request subject to certain pragmatic limits of space and time An object may be denoted by multiple distinct object references A request may have parameters that are used to pass data to the target object it may also have a request context that provides additional information about the request A request context is a mapping from strings to strings A request causes a service to be performed on behalf of the client One possible outcome of performing a service is returning to the client the results if any defined for the request If an abnormal condition occurs during the performance of a request an exception is returned The exception may carry additional return parameters particular to that exception The request parameters are identified by position A parameter may be an input parameter an output parameter or an input-output parameter A request may also return a single return result value as well as the results stored into the output and input-output parameters The following semantics hold for all requests • Any aliasing of parameter values is neither guaranteed removed nor guaranteed to be preserved • The order in which aliased output parameters are written is not guaranteed • The return result and the values stored into the output and input-output parameters are undefined if an exception is returned For descriptions of the values and exceptions that are permitted see Section 1 2 4 “Types ? on page 1-4 and Section 1 2 8 3 “Exceptions ? on page 1-8 Objects can be created and destroyed From a client’s point of view there is no special mechanism for creating or destroying an object Objects are created and destroyed as an outcome of issuing requests The outcome of object creation is revealed to the client in the form of an object reference that denotes the new object A type is an identifiable entity with an associated predicate a single-argument mathematical function with a boolean result defined over entities An entity satisfies a type if the predicate is true for that entity An entity that satisfies a type is called a member of the type Types are used in signatures to restrict a possible parameter or to characterize a possible result The extension of a type is the set of entities that satisfy the type at any particular time An object type is a type whose members are object references In other words an object type is satisfied only by object references Constraints on the data types in this model are shown in this section 1 2 4 1 Basic types • 16-bit 32-bit and 64-bit signed and unsigned 2’s complement integers • Single-precision 32-bit double-precision 64-bit and double-extended a mantissa of at least 64 bits a sign bit and an exponent of at least 15 bits IEEE floating point numbers • Fixed-point decimal numbers of up to 31 significant digits • Characters as defined in ISO Latin-1 8859 1 and other single- or multi-byte character sets • A boolean type taking the values TRUE and FALSE • An 8-bit opaque detectable guaranteed to not undergo any conversion during transfer between systems • Enumerated types consisting of ordered sequences of identifiers • A string type which consists of a variable-length array of characters the length of the string is a non-negative integer and is available at run-time The length may have a maximum bound defined • A wide character string type which consist of a variable-length array of fixed width wide characters the length of the wide string is a non-negative integer and is available at run-time The length may have a maximum bound defined • A container type “any ? which can represent any possible basic or constructed type • Wide characters that may represent characters from any wide character set • Wide character strings which consist of a length available at runtime and a variable-length array of fixed width wide characters 1 2 4 2 Constructed types • A record type called struct which consists of an ordered set of name value pairs • A discriminated union type which consists of a discriminator whose exact value is always available followed by an instance of a type appropriate to the discriminator value • A sequence type which consists of a variable-length array of a single type the length of the sequence is available at run-time • An array type which consists of a fixed-shape multidimensional array of a single type • An interface type which specifies the set of operations that an instance of that type must support • A value type which specifies state as well as a set of operations that an instance of that type must support Entities in a request are restricted to values that satisfy these type constraints The legal entities are shown in No particular representation for entities is defined Object Reference Value Type Abstract Interface Entity Basic Value Constructed Values Figure 1-1 Legal Values Short Long LongLong UShort Ulong UlongLong Float Double LongDouble Fixed Char Wchar String Wstring Struct Boolean Sequence Octet Union Enum Array Any An interface is a description of a set of possible operations that a client may request of an object through that interface It provides a syntactic description of how a service provided by an object supporting this interface is accessed via this set of operations An object satisfies an interface if it provides its service through the operations of the interface according to the specification of the operations see Section 1 2 8 “Operations ? on page 1-7 The interface type for a given interface is an object type such that an object reference will satisfy the type if and only if the referent object also satisfies the interface Interfaces are specified in OMG IDL Interface inheritance provides the composition mechanism for permitting an object to support multiple interfaces The principal interface is simply the most-specific interface that the object supports and consists of all operations in the transitive closure of the interface inheritance graph Interfaces satisfy the Liskov substitution principle If interface A is derived from interface B then a reference to an object that supports interface A can be used where the formal type of a parameter is declared to be B A value type is an entity which shares many of the characteristics of interfaces and structs It is a description of both a set of operations that a client may request and of state that is accessible to a client Instances of a value type are always local concrete implementations in some programming language A value type in addition to the operations and state defined for itself may also inherit from other value types and through multiple inheritance support other interfaces Value types are specified in OMG IDL An abstract value types describes a value type that is a “pure? bundle of operations with no state An abstract interface is an entity which may at runtime represent either a regular interface see Section 1 2 5 “Interfaces ? on page 1-6 or a value type see Section 1 2 6 “Value Types ? on page 1-6 Like an abstract value type it is a pure bundle of operations with no state Unlike an abstract value type it does not imply pass-by-value semantics and unlike a regular interface type it does not imply pass-byreference semantics Instead the entity's runtime type determines which of these semantics are used An operation is an identifiable entity that denotes the indivisible primitive of service provision that can be requested The act of requesting an operation is referred to as invoking the operation An operation is identified by an operation identifier An operation has a signature that describes the legitimate values of request parameters and returned results In particular a signature consists of • A specification of the parameters required in requests for that operation • A specification of the result of the operation • An identification of the user exceptions that may be raised by an invocation of the operation • A specification of additional contextual information that may affect the invocation • An indication of the execution semantics the client should expect from an invocation of the operation Operations are potentially generic meaning that a single operation can be uniformly invoked on objects with different implementations possibly resulting in observably different behavior Genericity is achieved in this model via interface inheritance in IDL and the total decoupling of implementation from interface specification The general form for an operation signature is [oneway] param1 paramL [raises except1 exceptN ] [context name1 nameM ] where • The optional oneway keyword indicates that best-effort semantics are expected of requests for this operation the default semantics are exactly-once if the operation successfully returns results or at-most-once if an exception is returned • The is the type of the return result • The provides a name for the operation in the interface • The operation parameters needed for the operation they are flagged with the modifiers in out or inout to indicate the direction in which the information flows with respect to the object performing the request • The optional raises expression indicates which user-defined exceptions can be signaled to terminate an invocation of this operation if such an expression is not provided no user-defined exceptions will be signaled • The optional context expression indicates which request context information will be available to the object implementation no other contextual information is required to be transported with the request 1 2 8 1 Parameters A parameter is characterized by its mode and its type The mode indicates whether the value should be passed from client to server in from server to client out or both inout The parameter’s type constrains the possible value which may be passed in the directions dictated by the mode 1 2 8 2 Return Result The return result is a distinguished out parameter 1 2 8 3 Exceptions An exception is an indication that an operation request was not performed successfully An exception may be accompanied by additional exception-specific information The additional exception-specific information is a specialized form of record As a record it may consist of any of the types described in Section 1 2 4 “Types ? on page 1-4 All signatures implicitly include the system exceptions the standard system exceptions are described in Section 4 12 2 “System Exceptions ? on page 4-64 1 2 8 4 Contexts A request context provides additional operation-specific information that may affect the performance of a request 1 2 8 5 Execution Semantics Two styles of execution semantics are defined by the object model • At-most-once if an operation request returns successfully it was performed exactly once if it returns an exception indication it was performed at-most-once • Best-effort a best-effort operation is a request-only operation i e it cannot return any results and the requester never synchronizes with the completion if any of the request The execution semantics to be expected is associated with an operation This prevents a client and object implementation from assuming different execution semantics Note that a client is able to invoke an at-most-once operation in a synchronous or deferred-synchronous manner An interface may have attributes An attribute is logically equivalent to declaring a pair of accessor functions one to retrieve the value of the attribute and one to set the value of the attribute An attribute may be read-only in which case only the retrieval accessor function is defined This section defines the concepts associated with object implementation i e the concepts relevant to realizing the behavior of objects in a computational system The implementation of an object system carries out the computational activities needed to effect the behavior of requested services These activities may include computing the results of the request and updating the system state In the process additional requests may be issued The implementation model consists of two parts the execution model and the construction model The execution model describes how services are performed The construction model describes how services are defined A requested service is performed in a computational system by executing code that operates upon some data The data represents a component of the state of the computational system The code performs the requested service which may change the state of the system Code that is executed to perform a service is called a method A method is an immutable description of a computation that can be interpreted by an execution engine A method has an immutable attribute called a method format that defines the set of execution engines that can interpret the method An execution engine is an abstract machine not a program that can interpret methods of certain formats causing the described computations to be performed An execution engine defines a dynamic context for the execution of a method The execution of a method is called a method activation When a client issues a request a method of the target object is called The input parameters passed by the requestor are passed to the method and the output and input-output parameters and return result value or exception and its parameters are passed back to the requestor Performing a requested service causes a method to execute that may operate upon an object’s persistent state If the persistent form of the method or state is not accessible to the execution engine it may be necessary to first copy the method or state into an execution context This process is called activation the reverse process is called deactivation A computational object system must provide mechanisms for realizing behavior of requests These mechanisms include definitions of object state definitions of methods and definitions of how the object infrastructure is to select the methods to execute and to select the relevant portions of object state to be made accessible to the methods Mechanisms must also be provided to describe the concrete actions associated with object creation such as association of the new object with appropriate methods An object implementation—or implementation for short—is a definition that provides the information needed to create an object and to allow the object to participate in providing an appropriate set of services An implementation typically includes among other things definitions of the methods that operate upon the state of an object It also typically includes information about the intended types of the object A requested service is performed in a computational system by executing code that operates upon some data The data represents a component of the state of the computational system The code performs the requested service which may change the state of the system Code that is executed to perform a service is called a method A method is an immutable description of a computation that can be interpreted by an execution engine A method has an immutable attribute called a method format that defines the set of execution engines that can interpret the method An execution engine is an abstract machine not a program that can interpret methods of certain formats causing the described computations to be performed An execution engine defines a dynamic context for the execution of a method The execution of a method is called a method activation When a client issues a request a method of the target object is called The input parameters passed by the requestor are passed to the method and the output and input-output parameters and return result value or exception and its parameters are passed back to the requestor Performing a requested service causes a method to execute that may operate upon an object’s persistent state If the persistent form of the method or state is not accessible to the execution engine it may be necessary to first copy the method or state into an execution context This process is called activation the reverse process is called deactivation A computational object system must provide mechanisms for realizing behavior of requests These mechanisms include definitions of object state definitions of methods and definitions of how the object infrastructure is to select the methods to execute and to select the relevant portions of object state to be made accessible to the methods Mechanisms must also be provided to describe the concrete actions associated with object creation such as association of the new object with appropriate methods An object implementation—or implementation for short—is a definition that provides the information needed to create an object and to allow the object to participate in providing an appropriate set of services An implementation typically includes among other things definitions of the methods that operate upon the state of an object It also typically includes information about the intended types of the object The Common Object Request Broker Architecture CORBA is structured to allow integration of a wide variety of object systems The motivation for some of the features may not be apparent at first but as we discuss the range of implementations policies optimizations and usages we expect to encompass the value of the flexibility becomes more clear Contents This chapter contains the following sections Section Title Page “Structure of an Object Request Broker? 2-1 “Example ORBs? 2-11 “Structure of a Client? 2-12 “Structure of an Object Implementation? 2-13 “Structure of an Object Adapter? 2-15 “CORBA Required Object Adapter? 2-17 “The Integration of Foreign Object Systems? 2-17 Figure 2-1 shows a request being sent by a client to an object implementation The Client is the entity that wishes to perform an operation on the object and the Object Implementation is the code and data that actually implements the object July 2002 Common Object Request Broker Architecture CORBA v3 0 2-1 Client Object Implementation ORB Request Figure 2-1 A Request Being Sent Through the Object Request Broker The ORB is responsible for all of the mechanisms required to find the object implementation for the request to prepare the object implementation to receive the request and to communicate the data making up the request The interface the client sees is completely independent of where the object is located what programming language it is implemented in or any other aspect that is not reflected in the object’s interface Figure 2-2 on page 2-3 shows the structure of an individual Object Request Broker ORB The interfaces to the ORB are shown by striped boxes and the arrows indicate whether the ORB is called or performs an up-call across the interface Client Object Implementation Dynamic Invocation IDL Stubs ORB Interface Dynamic Skeleton Object Adapter ORB Core Static IDL Skeleton Interface identical for all ORB implementations Up-call interface There may be multiple object adapters There are stubs and a skeleton for each object type Normal call interface ORB-dependent interface Figure 2-2 The Structure of Object Request Interfaces To make a request the Client can use the Dynamic Invocation interface the same interface independent of the target object’s interface or an OMG IDL stub the specific stub depending on the interface of the target object The Client can also directly interact with the ORB for some functions The Object Implementation receives a request as an up-call either through the OMG IDL generated skeleton or through a dynamic skeleton The Object Implementation may call the Object Adapter and the ORB while processing a request or at other times Definitions of the interfaces to objects can be defined in two ways Interfaces can be defined statically in an interface definition language called the OMG Interface Definition Language OMG IDL This language defines the types of objects according to the operations that may be performed on them and the parameters to those operations Alternatively or in addition interfaces can be added to an Interface Repository service this service represents the components of an interface as objects permitting run-time access to these components In any ORB implementation the Interface Definition Language which may be extended beyond its definition in this document and the Interface Repository have equivalent expressive power The client performs a request by having access to an Object Reference for an object and knowing the type of the object and the desired operation to be performed The client initiates the request by calling stub routines that are specific to the object or by constructing the request dynamically see Figure 2-3 Client Dynamic Invocation IDL Stubs ORB Core Interface identical for all ORB implementations There are stubs and a skeleton for each object type ORB-dependent interface Request Request Figure 2-3 A Client Using the Stub or Dynamic Invocation Interface The dynamic and stub interface for invoking a request satisfy the same request semantics and the receiver of the message cannot tell how the request was invoked The ORB locates the appropriate implementation code transmits parameters and transfers control to the Object Implementation through an IDL skeleton or a dynamic skeleton see Figure 2-4 on page 2-5 Skeletons are specific to the interface and the object adapter In performing the request the object implementation may obtain some services from the ORB through the Object Adapter When the request is complete control and output values are returned to the client Object Implementation ORB Interface Dynamic Skeleton Object Adapter ORB Core Static IDL Skeleton Interface identical for all ORB implementations Up-call interface There may be multiple object adapters There are stubs and a skeleton for each object type Normal call interface ORB-dependent interface Figure 2-4 An Object Implementation Receiving a Request The Object Implementation may choose which Object Adapter to use This decision is based on what kind of services the Object Implementation requires Figure 2-5 on page 2-6 shows how interface and implementation information is made available to clients and object implementations The interface is defined in OMG IDL and or in the Interface Repository the definition is used to generate the client Stubs and the object implementation Skeletons Client Object Implementation IDL Definitions Interface Repository Stubs Skeletons Implementation Installation Implementation Repository Figure 2-5 Interface and Implementation Repositories The object implementation information is provided at installation time and is stored in the Implementation Repository for use during request delivery In the architecture the ORB is not required to be implemented as a single component but rather it is defined by its interfaces Any ORB implementation that provides the appropriate interface is acceptable The interface is organized into three categories 1 Operations that are the same for all ORB implementations 2 Operations that are specific to particular types of objects 3 Operations that are specific to particular styles of object implementations Different ORBs may make quite different implementation choices and together with the IDL compilers repositories and various Object Adapters provide a set of services to clients and implementations of objects that have different properties and qualities There may be multiple ORB implementations also described as multiple ORBs which have different representations for object references and different means of performing invocations It may be possible for a client to simultaneously have access to two object references managed by different ORB implementations When two ORBs are intended to work together those ORBs must be able to distinguish their object references It is not the responsibility of the client to do so The ORB Core is that part of the ORB that provides the basic representation of objects and communication of requests CORBA is designed to support different object mechanisms and it does so by structuring the ORB with components above the ORB Core which provide interfaces that can mask the differences between ORB Cores A client of an object has access to an object reference for the object and invokes operations on the object A client knows only the logical structure of the object according to its interface and experiences the behavior of the object through invocations Although we will generally consider a client to be a program or process initiating requests on an object it is important to recognize that something is a client relative to a particular object For example the implementation of one object may be a client of other objects Clients generally see objects and ORB interfaces through the perspective of a language mapping bringing the ORB right up to the programmer’s level Clients are maximally portable and should be able to work without source changes on any ORB that supports the desired language mapping with any object instance that implements the desired interface Clients have no knowledge of the implementation of the object which object adapter is used by the implementation or which ORB is used to access it An object implementation provides the semantics of the object usually by defining data for the object instance and code for the object’s methods Often the implementation will use other objects or additional software to implement the behavior of the object In some cases the primary function of the object is to have side-effects on other things that are not objects A variety of object implementations can be supported including separate servers libraries a program per method an encapsulated application an object-oriented database etc Through the use of additional object adapters it is possible to support virtually any style of object implementation Generally object implementations do not depend on the ORB or how the client invokes the object Object implementations may select interfaces to ORB-dependent services by the choice of Object Adapter An Object Reference is the information needed to specify an object within an ORB Both clients and object implementations have an opaque notion of object references according to the language mapping and thus are insulated from the actual representation of them Two ORB implementations may differ in their choice of Object Reference representations The representation of an object reference handed to a client is only valid for the lifetime of that client All ORBs must provide the same language mapping to an object reference usually referred to as an Object for a particular programming language This permits a program written in a particular language to access object references independent of the particular ORB The language mapping may also provide additional ways to access object references in a typed way for the convenience of the programmer There is a distinguished object reference guaranteed to be different from all object references that denotes no object The OMG Interface Definition Language OMG IDL defines the types of objects by specifying their interfaces An interface consists of a set of named operations and the parameters to those operations Note that although IDL provides the conceptual framework for describing the objects manipulated by the ORB it is not necessary for there to be IDL source code available for the ORB to work As long as the equivalent information is available in the form of stub routines or a run-time interface repository a particular ORB may be able to function correctly IDL is the means by which a particular object implementation tells its potential clients what operations are available and how they should be invoked From the IDL definitions it is possible to map CORBA objects into particular programming languages or object systems Different object-oriented or non-object-oriented programming languages may prefer to access CORBA objects in different ways For object-oriented languages it may be desirable to see CORBA objects as programming language objects Even for non-object-oriented languages it is a good idea to hide the exact ORB representation of the object reference method names etc A particular mapping of OMG IDL to a programming language should be the same for all ORB implementations Language mapping includes definition of the language-specific data types and procedure interfaces to access objects through the ORB It includes the structure of the client stub interface not required for object-oriented languages the dynamic invocation interface the implementation skeleton the object adapters and the direct ORB interface A language mapping also defines the interaction between object invocations and the threads of control in the client or implementation The most common mappings provide synchronous calls in that the routine returns when the object operation completes Additional mappings may be provided to allow a call to be initiated and control returned to the program In such cases additional language-specific routines must be provided to synchronize the program’s threads of control with the object invocation Generally the client stubs will present access to the OMG IDL-defined operations on an object in a way that is easy for programmers to predict once they are familiar with OMG IDL and the language mapping for the particular programming language The stubs make calls on the rest of the ORB using interfaces that are private to and presumably optimized for the particular ORB Core If more than one ORB is available there may be different stubs corresponding to the different ORBs In this case it is necessary for the ORB and language mapping to cooperate to associate the correct stubs with the particular object reference An interface is also available that allows the dynamic construction of object invocations that is rather than calling a stub routine that is specific to a particular operation on a particular object a client may specify the object to be invoked the operation to be performed and the set of parameters for the operation through a call or sequence of calls The client code must supply information about the operation to be performed and the types of the parameters being passed perhaps obtaining it from an Interface Repository or other run-time source The nature of the dynamic invocation interface may vary substantially from one programming language mapping to another For a particular language mapping and possibly depending on the object adapter there will be an interface to the methods that implement each type of object The interface will generally be an up-call interface in that the object implementation writes routines that conform to the interface and the ORB calls them through the skeleton The existence of a skeleton does not imply the existence of a corresponding client stub clients can also make requests via the dynamic invocation interface It is possible to write an object adapter that does not use skeletons to invoke implementation methods For example it may be possible to create implementations dynamically for languages such as Smalltalk An interface is available which allows dynamic handling of object invocations That is rather than being accessed through a skeleton that is specific to a particular operation an object’s implementation is reached through an interface that provides access to the operation name and parameters in a manner analogous to the client side’s Dynamic Invocation Interface Purely static knowledge of those parameters may be used or dynamic knowledge perhaps determined through an Interface Repository may be also used to determine the parameters The implementation code must provide descriptions of all the operation parameters to the ORB and the ORB provides the values of any input parameters for use in performing the operation The implementation code provides the values of any output parameters or an exception to the ORB after performing the operation The nature of the dynamic skeleton interface may vary substantially from one programming language mapping or object adapter to another but will typically be an up-call interface Dynamic skeletons may be invoked both through client stubs and through the dynamic invocation interface either style of client request construction interface provides identical results An object adapter is the primary way that an object implementation accesses services provided by the ORB There are expected to be a few object adapters that will be widely available with interfaces that are appropriate for specific kinds of objects Services provided by the ORB through an Object Adapter often include generation and interpretation of object references method invocation security of interactions object and implementation activation and deactivation mapping object references to implementations and registration of implementations The wide range of object granularities lifetimes policies implementation styles and other properties make it difficult for the ORB Core to provide a single interface that is convenient and efficient for all objects Thus through Object Adapters it is possible for the ORB to target particular groups of object implementations that have similar requirements with interfaces tailored to them The ORB Interface is the interface that goes directly to the ORB which is the same for all ORBs and does not depend on the object’s interface or object adapter Because most of the functionality of the ORB is provided through the object adapter stubs skeleton or dynamic invocation there are only a few operations that are common across all objects These operations are useful to both clients and implementations of objects The Interface Repository is a service that provides persistent objects that represent the IDL information in a form available at run-time The Interface Repository information may be used by the ORB to perform requests Moreover using the information in the Interface Repository it is possible for a program to encounter an object whose interface was not known when the program was compiled yet be able to determine what operations are valid on the object and make an invocation on it In addition to its role in the functioning of the ORB the Interface Repository is a common place to store additional information associated with interfaces to ORB objects For example debugging information libraries of stubs or skeletons routines that can format or browse particular kinds of objects might be associated with the Interface Repository The Implementation Repository contains information that allows the ORB to locate and activate implementations of objects Although most of the information in the Implementation Repository is specific to an ORB or operating environment the Implementation Repository is the conventional place for recording such information Ordinarily installation of implementations and control of policies related to the activation and execution of object implementations is done through operations on the Implementation Repository In addition to its role in the functioning of the ORB the Implementation Repository is a common place to store additional information associated with implementations of ORB objects For example debugging information administrative control resource allocation security etc might be associated with the Implementation Repository There are a wide variety of ORB implementations possible within the Common ORB Architecture This section will illustrate some of the different options Note that a particular ORB might support multiple options and protocols for communication If there is a suitable communication mechanism present an ORB can be implemented in routines resident in the clients and implementations The stubs in the client either use a location-transparent IPC mechanism or directly access a location service to establish communication with the implementations Code linked with the implementation is responsible for setting up appropriate databases for use by clients To centralize the management of the ORB all clients and implementations can communicate with one or more servers whose job it is to route requests from clients to implementations The ORB could be a normal program as far as the underlying operating system is concerned and normal IPC could be used to communicate with the ORB To enhance security robustness and performance the ORB could be provided as a basic service of the underlying operating system Object references could be made unforgeable reducing the expense of authentication on each request Because the operating system could know the location and structure of clients and implementations it would be possible for a variety of optimizations to be implemented for example avoiding marshalling when both are on the same machine For objects that are light-weight and whose implementations can be shared the implementation might actually be in a library In this case the stubs could be the actual methods This assumes that it is possible for a client program to get access to the data for the objects and that the implementation trusts the client not to damage the data A client of an object has an object reference that refers to that object An object reference is a token that may be invoked or passed as a parameter to an invocation on a different object Invocation of an object involves specifying the object to be invoked the operation to be performed and parameters to be given to the operation or returned from it The ORB manages the control transfer and data transfer to the object implementation and back to the client In the event that the ORB cannot complete the invocation an exception response is provided Ordinarily a client calls a routine in its program that performs the invocation and returns when the operation is complete Clients access object-type-specific stubs as library routines in their program see Figure 2-6 on page 2-13 The client program thus sees routines callable in the normal way in its programming language All implementations will provide a language-specific data type to use to refer to objects often an opaque pointer The client then passes that object reference to the stub routines to initiate an invocation The stubs have access to the object reference representation and interact with the ORB to perform the invocation See the C Language Mapping specification for additional general information on language mapping of object references Client Program Language-dependent object references ORB object references Dynamic Invocation Interface Stubs for Interface A Stubs for Interface B Figure 2-6 The Structure of a Typical Client An alternative set of library code is available to perform invocations on objects for example when the object was not defined at compile time In that case the client program provides additional information to name the type of the object and the method being invoked and performs a sequence of calls to specify the parameters and initiate the invocation Clients most commonly obtain object references by receiving them as output parameters from invocations on other objects for which they have references When a client is also an implementation it receives object references as input parameters on invocations to objects it implements An object reference can also be converted to a string that can be stored in files or preserved or communicated by different means and subsequently turned back into an object reference by the ORB that produced the string An object implementation provides the actual state and behavior of an object The object implementation can be structured in a variety of ways Besides defining the methods for the operations themselves an implementation will usually define procedures for activating and deactivating objects and will use other objects or non-object facilities to make the object state persistent to control access to the object as well as to implement the methods The object implementation see Figure 2-7 interacts with the ORB in a variety of ways to establish its identity to create new objects and to obtain ORB-dependent services It primarily does this via access to an Object Adapter which provides an interface to ORB services that is convenient for a particular style of object implementation Object Implementation ORB object references Methods for Interface A Library Routines Object data Skeleton for Interface A Object adapter routines Up-call to Method Dynamic Skeleton br Figure 2-7 The Structure of a Typical Object Implementation Because of the range of possible object implementations it is difficult to be definitive about how an object implementation is structured See the chapters on the Portable Object Adapter When an invocation occurs the ORB Core object adapter and skeleton arrange that a call is made to the appropriate method of the implementation A parameter to that method specifies the object being invoked which the method can use to locate the data for the object Additional parameters are supplied according to the skeleton definition When the method is complete it returns causing output parameters or exception results to be transmitted back to the client When a new object is created the ORB may be notified so that it knows where to find the implementation for that object Usually the implementation also registers itself as implementing objects of a particular interface and specifies how to start up the implementation if it is not already running Most object implementations provide their behavior using facilities in addition to the ORB and object adapter For example although the Portable Object Adapter provides some persistent data associated with an object its OID or Object ID that relatively small amount of data is typically used as an identifier for the actual object data stored in a storage service of the object implementation’s choosing With this structure it is not only possible for different object implementations to use the same storage service it is also possible for objects to choose the service that is most appropriate for them An object adapter see Figure 2-8 on page 2-16 is the primary means for an object implementation to access ORB services such as object reference generation An object adapter exports a public interface to the object implementation and a private interface to the skeleton It is built on a private ORB-dependent interface Object adapters are responsible for the following functions • Generation and interpretation of object references • Method invocation • Security of interactions • Object and implementation activation and deactivation • Mapping object references to the corresponding object implementations • Registration of implementations These functions are performed using the ORB Core and any additional components necessary Often an object adapter will maintain its own state to accomplish its tasks It may be possible for a particular object adapter to delegate one or more of its responsibilities to the Core upon which it is constructed Object Implementation Interface A Methods Interface B Methods Dynamic Skeleton Interface A Skeleton Interface B Skeleton ObjectAdapter Interface ORB Core Figure 2-8 The Structure of a Typical Object Adapter As shown in Figure 2-8 the Object Adapter is implicitly involved in invocation of the methods although the direct interface is through the skeletons For example the Object Adapter may be involved in activating the implementation or authenticating the request The Object Adapter defines most of the services from the ORB that the Object Implementation can depend on Different ORBs will provide different levels of service and different operating environments may provide some properties implicitly and require others to be added by the Object Adapter For example it is common for Object Implementations to want to store certain values in the object reference for easy identification of the object on an invocation If the Object Adapter allows the implementation to specify such values when a new object is created it may be able to store them in the object reference for those ORBs that permit it If the ORB Core does not provide this feature the Object Adapter would record the value in its own storage and provide it to the implementation on an invocation With Object Adapters it is possible for an Object Implementation to have access to a service whether or not it is implemented in the ORB Core—if the ORB Core provides it the adapter simply provides an interface to it if not the adapter must implement it on top of the ORB Core Every instance of a particular adapter must provide the same interface and service for all the ORBs it is implemented on It is also not necessary for all Object Adapters to provide the same interface or functionality Some Object Implementations have special requirements For example an object-oriented database system may wish to implicitly register its many thousands of objects without doing individual calls to the Object Adapter In such a case it would be impractical and unnecessary for the object adapter to maintain any per-object state By using an object adapter interface that is tuned towards such object implementations it is possible to take advantage of particular ORB Core details to provide the most effective access to the ORB There are a variety of possible object adapters however since the object adapter interface is something that object implementations depend on it is desirable that there be as few as practical Most object adapters are designed to cover a range of object implementations so only when an implementation requires radically different services or interfaces should a new object adapter be considered In this section we briefly describe the object adapter defined in this specification This specification defines a Portable Object Adapter that can be used for most ORB objects with conventional implementations See the Portable Object Adapter chapter for more information The intent of the POA as its name suggests is to provide an Object Adapter that can be used with multiple ORBs with a minimum of rewriting needed to deal with different vendors’ implementations This specification allows several ways of using servers but it does not deal with the administrative issues of starting server programs Once started however there can be a servant started and ended for a single method call a separate servant for each object or a shared servant for all instances of the object type It allows for groups of objects to be associated by means of being registered with different instances of the POA object and allows implementations to specify their own activation techniques If the implementation is not active when an invocation is performed the POA will start one The POA is specified in IDL so its mapping to languages is largely automatic following the language mapping rules The primary task left for a language mapping is the definition of the Servant type The Common ORB Architecture is designed to allow interoperation with a wide range of object systems see Figure 2-9 on page 2-18 Because there are many existing object systems a common desire will be to allow the objects in those systems to be accessible via the ORB For those object systems that are ORBs themselves they may be connected to other ORBs through the mechanisms described throughout this manual ORB Core Gateway Object system as another ORB interoperating via a gateway Portable Object Adapter Special-purpose Adapter Object system as a POA object implementation Object system as an implementation with a special-purpose object adapter Figure 2-9 Different Ways to Integrate Foreign Object Systems For object systems that simply want to map their objects into ORB objects and receive invocations through the ORB one approach is to have those object systems appear to be implementations of the corresponding ORB objects The object system would register its objects with the ORB and handle incoming requests and could act like a client and perform outgoing requests In some cases it will be impractical for another object system to act like a POA object implementation An object adapter could be designed for objects that are created in conjunction with the ORB and that are primarily invoked through the ORB Another object system may wish to create objects without consulting the ORB and might expect most invocations to occur within itself rather than through the ORB In such a case a more appropriate object adapter might allow objects to be implicitly registered when they are passed through the ORB Figure 2-1 shows a request being sent by a client to an object implementation The Client is the entity that wishes to perform an operation on the object and the Object Implementation is the code and data that actually implements the object July 2002 Common Object Request Broker Architecture CORBA v3 0 2-1 Client Object Implementation ORB Request Figure 2-1 A Request Being Sent Through the Object Request Broker The ORB is responsible for all of the mechanisms required to find the object implementation for the request to prepare the object implementation to receive the request and to communicate the data making up the request The interface the client sees is completely independent of where the object is located what programming language it is implemented in or any other aspect that is not reflected in the object’s interface Figure 2-2 on page 2-3 shows the structure of an individual Object Request Broker ORB The interfaces to the ORB are shown by striped boxes and the arrows indicate whether the ORB is called or performs an up-call across the interface Client Object Implementation Dynamic Invocation IDL Stubs ORB Interface Dynamic Skeleton Object Adapter ORB Core Static IDL Skeleton Interface identical for all ORB implementations Up-call interface There may be multiple object adapters There are stubs and a skeleton for each object type Normal call interface ORB-dependent interface Figure 2-2 The Structure of Object Request Interfaces To make a request the Client can use the Dynamic Invocation interface the same interface independent of the target object’s interface or an OMG IDL stub the specific stub depending on the interface of the target object The Client can also directly interact with the ORB for some functions The Object Implementation receives a request as an up-call either through the OMG IDL generated skeleton or through a dynamic skeleton The Object Implementation may call the Object Adapter and the ORB while processing a request or at other times Definitions of the interfaces to objects can be defined in two ways Interfaces can be defined statically in an interface definition language called the OMG Interface Definition Language OMG IDL This language defines the types of objects according to the operations that may be performed on them and the parameters to those operations Alternatively or in addition interfaces can be added to an Interface Repository service this service represents the components of an interface as objects permitting run-time access to these components In any ORB implementation the Interface Definition Language which may be extended beyond its definition in this document and the Interface Repository have equivalent expressive power The client performs a request by having access to an Object Reference for an object and knowing the type of the object and the desired operation to be performed The client initiates the request by calling stub routines that are specific to the object or by constructing the request dynamically see Figure 2-3 Client Dynamic Invocation IDL Stubs ORB Core Interface identical for all ORB implementations There are stubs and a skeleton for each object type ORB-dependent interface Request Request Figure 2-3 A Client Using the Stub or Dynamic Invocation Interface The dynamic and stub interface for invoking a request satisfy the same request semantics and the receiver of the message cannot tell how the request was invoked The ORB locates the appropriate implementation code transmits parameters and transfers control to the Object Implementation through an IDL skeleton or a dynamic skeleton see Figure 2-4 on page 2-5 Skeletons are specific to the interface and the object adapter In performing the request the object implementation may obtain some services from the ORB through the Object Adapter When the request is complete control and output values are returned to the client Object Implementation ORB Interface Dynamic Skeleton Object Adapter ORB Core Static IDL Skeleton Interface identical for all ORB implementations Up-call interface There may be multiple object adapters There are stubs and a skeleton for each object type Normal call interface ORB-dependent interface Figure 2-4 An Object Implementation Receiving a Request The Object Implementation may choose which Object Adapter to use This decision is based on what kind of services the Object Implementation requires Figure 2-5 on page 2-6 shows how interface and implementation information is made available to clients and object implementations The interface is defined in OMG IDL and or in the Interface Repository the definition is used to generate the client Stubs and the object implementation Skeletons Client Object Implementation IDL Definitions Interface Repository Stubs Skeletons Implementation Installation Implementation Repository Figure 2-5 Interface and Implementation Repositories The object implementation information is provided at installation time and is stored in the Implementation Repository for use during request delivery In the architecture the ORB is not required to be implemented as a single component but rather it is defined by its interfaces Any ORB implementation that provides the appropriate interface is acceptable The interface is organized into three categories 1 Operations that are the same for all ORB implementations 2 Operations that are specific to particular types of objects 3 Operations that are specific to particular styles of object implementations Different ORBs may make quite different implementation choices and together with the IDL compilers repositories and various Object Adapters provide a set of services to clients and implementations of objects that have different properties and qualities There may be multiple ORB implementations also described as multiple ORBs which have different representations for object references and different means of performing invocations It may be possible for a client to simultaneously have access to two object references managed by different ORB implementations When two ORBs are intended to work together those ORBs must be able to distinguish their object references It is not the responsibility of the client to do so The ORB Core is that part of the ORB that provides the basic representation of objects and communication of requests CORBA is designed to support different object mechanisms and it does so by structuring the ORB with components above the ORB Core which provide interfaces that can mask the differences between ORB Cores A client of an object has access to an object reference for the object and invokes operations on the object A client knows only the logical structure of the object according to its interface and experiences the behavior of the object through invocations Although we will generally consider a client to be a program or process initiating requests on an object it is important to recognize that something is a client relative to a particular object For example the implementation of one object may be a client of other objects Clients generally see objects and ORB interfaces through the perspective of a language mapping bringing the ORB right up to the programmer’s level Clients are maximally portable and should be able to work without source changes on any ORB that supports the desired language mapping with any object instance that implements the desired interface Clients have no knowledge of the implementation of the object which object adapter is used by the implementation or which ORB is used to access it An object implementation provides the semantics of the object usually by defining data for the object instance and code for the object’s methods Often the implementation will use other objects or additional software to implement the behavior of the object In some cases the primary function of the object is to have side-effects on other things that are not objects A variety of object implementations can be supported including separate servers libraries a program per method an encapsulated application an object-oriented database etc Through the use of additional object adapters it is possible to support virtually any style of object implementation Generally object implementations do not depend on the ORB or how the client invokes the object Object implementations may select interfaces to ORB-dependent services by the choice of Object Adapter An Object Reference is the information needed to specify an object within an ORB Both clients and object implementations have an opaque notion of object references according to the language mapping and thus are insulated from the actual representation of them Two ORB implementations may differ in their choice of Object Reference representations The representation of an object reference handed to a client is only valid for the lifetime of that client All ORBs must provide the same language mapping to an object reference usually referred to as an Object for a particular programming language This permits a program written in a particular language to access object references independent of the particular ORB The language mapping may also provide additional ways to access object references in a typed way for the convenience of the programmer There is a distinguished object reference guaranteed to be different from all object references that denotes no object The OMG Interface Definition Language OMG IDL defines the types of objects by specifying their interfaces An interface consists of a set of named operations and the parameters to those operations Note that although IDL provides the conceptual framework for describing the objects manipulated by the ORB it is not necessary for there to be IDL source code available for the ORB to work As long as the equivalent information is available in the form of stub routines or a run-time interface repository a particular ORB may be able to function correctly IDL is the means by which a particular object implementation tells its potential clients what operations are available and how they should be invoked From the IDL definitions it is possible to map CORBA objects into particular programming languages or object systems Different object-oriented or non-object-oriented programming languages may prefer to access CORBA objects in different ways For object-oriented languages it may be desirable to see CORBA objects as programming language objects Even for non-object-oriented languages it is a good idea to hide the exact ORB representation of the object reference method names etc A particular mapping of OMG IDL to a programming language should be the same for all ORB implementations Language mapping includes definition of the language-specific data types and procedure interfaces to access objects through the ORB It includes the structure of the client stub interface not required for object-oriented languages the dynamic invocation interface the implementation skeleton the object adapters and the direct ORB interface A language mapping also defines the interaction between object invocations and the threads of control in the client or implementation The most common mappings provide synchronous calls in that the routine returns when the object operation completes Additional mappings may be provided to allow a call to be initiated and control returned to the program In such cases additional language-specific routines must be provided to synchronize the program’s threads of control with the object invocation Generally the client stubs will present access to the OMG IDL-defined operations on an object in a way that is easy for programmers to predict once they are familiar with OMG IDL and the language mapping for the particular programming language The stubs make calls on the rest of the ORB using interfaces that are private to and presumably optimized for the particular ORB Core If more than one ORB is available there may be different stubs corresponding to the different ORBs In this case it is necessary for the ORB and language mapping to cooperate to associate the correct stubs with the particular object reference An interface is also available that allows the dynamic construction of object invocations that is rather than calling a stub routine that is specific to a particular operation on a particular object a client may specify the object to be invoked the operation to be performed and the set of parameters for the operation through a call or sequence of calls The client code must supply information about the operation to be performed and the types of the parameters being passed perhaps obtaining it from an Interface Repository or other run-time source The nature of the dynamic invocation interface may vary substantially from one programming language mapping to another For a particular language mapping and possibly depending on the object adapter there will be an interface to the methods that implement each type of object The interface will generally be an up-call interface in that the object implementation writes routines that conform to the interface and the ORB calls them through the skeleton The existence of a skeleton does not imply the existence of a corresponding client stub clients can also make requests via the dynamic invocation interface It is possible to write an object adapter that does not use skeletons to invoke implementation methods For example it may be possible to create implementations dynamically for languages such as Smalltalk An interface is available which allows dynamic handling of object invocations That is rather than being accessed through a skeleton that is specific to a particular operation an object’s implementation is reached through an interface that provides access to the operation name and parameters in a manner analogous to the client side’s Dynamic Invocation Interface Purely static knowledge of those parameters may be used or dynamic knowledge perhaps determined through an Interface Repository may be also used to determine the parameters The implementation code must provide descriptions of all the operation parameters to the ORB and the ORB provides the values of any input parameters for use in performing the operation The implementation code provides the values of any output parameters or an exception to the ORB after performing the operation The nature of the dynamic skeleton interface may vary substantially from one programming language mapping or object adapter to another but will typically be an up-call interface Dynamic skeletons may be invoked both through client stubs and through the dynamic invocation interface either style of client request construction interface provides identical results An object adapter is the primary way that an object implementation accesses services provided by the ORB There are expected to be a few object adapters that will be widely available with interfaces that are appropriate for specific kinds of objects Services provided by the ORB through an Object Adapter often include generation and interpretation of object references method invocation security of interactions object and implementation activation and deactivation mapping object references to implementations and registration of implementations The wide range of object granularities lifetimes policies implementation styles and other properties make it difficult for the ORB Core to provide a single interface that is convenient and efficient for all objects Thus through Object Adapters it is possible for the ORB to target particular groups of object implementations that have similar requirements with interfaces tailored to them The ORB Interface is the interface that goes directly to the ORB which is the same for all ORBs and does not depend on the object’s interface or object adapter Because most of the functionality of the ORB is provided through the object adapter stubs skeleton or dynamic invocation there are only a few operations that are common across all objects These operations are useful to both clients and implementations of objects The Interface Repository is a service that provides persistent objects that represent the IDL information in a form available at run-time The Interface Repository information may be used by the ORB to perform requests Moreover using the information in the Interface Repository it is possible for a program to encounter an object whose interface was not known when the program was compiled yet be able to determine what operations are valid on the object and make an invocation on it In addition to its role in the functioning of the ORB the Interface Repository is a common place to store additional information associated with interfaces to ORB objects For example debugging information libraries of stubs or skeletons routines that can format or browse particular kinds of objects might be associated with the Interface Repository The Implementation Repository contains information that allows the ORB to locate and activate implementations of objects Although most of the information in the Implementation Repository is specific to an ORB or operating environment the Implementation Repository is the conventional place for recording such information Ordinarily installation of implementations and control of policies related to the activation and execution of object implementations is done through operations on the Implementation Repository In addition to its role in the functioning of the ORB the Implementation Repository is a common place to store additional information associated with implementations of ORB objects For example debugging information administrative control resource allocation security etc might be associated with the Implementation Repository In the architecture the ORB is not required to be implemented as a single component but rather it is defined by its interfaces Any ORB implementation that provides the appropriate interface is acceptable The interface is organized into three categories 1 Operations that are the same for all ORB implementations 2 Operations that are specific to particular types of objects 3 Operations that are specific to particular styles of object implementations Different ORBs may make quite different implementation choices and together with the IDL compilers repositories and various Object Adapters provide a set of services to clients and implementations of objects that have different properties and qualities There may be multiple ORB implementations also described as multiple ORBs which have different representations for object references and different means of performing invocations It may be possible for a client to simultaneously have access to two object references managed by different ORB implementations When two ORBs are intended to work together those ORBs must be able to distinguish their object references It is not the responsibility of the client to do so The ORB Core is that part of the ORB that provides the basic representation of objects and communication of requests CORBA is designed to support different object mechanisms and it does so by structuring the ORB with components above the ORB Core which provide interfaces that can mask the differences between ORB Cores A client of an object has access to an object reference for the object and invokes operations on the object A client knows only the logical structure of the object according to its interface and experiences the behavior of the object through invocations Although we will generally consider a client to be a program or process initiating requests on an object it is important to recognize that something is a client relative to a particular object For example the implementation of one object may be a client of other objects Clients generally see objects and ORB interfaces through the perspective of a language mapping bringing the ORB right up to the programmer’s level Clients are maximally portable and should be able to work without source changes on any ORB that supports the desired language mapping with any object instance that implements the desired interface Clients have no knowledge of the implementation of the object which object adapter is used by the implementation or which ORB is used to access it An object implementation provides the semantics of the object usually by defining data for the object instance and code for the object’s methods Often the implementation will use other objects or additional software to implement the behavior of the object In some cases the primary function of the object is to have side-effects on other things that are not objects A variety of object implementations can be supported including separate servers libraries a program per method an encapsulated application an object-oriented database etc Through the use of additional object adapters it is possible to support virtually any style of object implementation Generally object implementations do not depend on the ORB or how the client invokes the object Object implementations may select interfaces to ORB-dependent services by the choice of Object Adapter An Object Reference is the information needed to specify an object within an ORB Both clients and object implementations have an opaque notion of object references according to the language mapping and thus are insulated from the actual representation of them Two ORB implementations may differ in their choice of Object Reference representations The representation of an object reference handed to a client is only valid for the lifetime of that client All ORBs must provide the same language mapping to an object reference usually referred to as an Object for a particular programming language This permits a program written in a particular language to access object references independent of the particular ORB The language mapping may also provide additional ways to access object references in a typed way for the convenience of the programmer There is a distinguished object reference guaranteed to be different from all object references that denotes no object The OMG Interface Definition Language OMG IDL defines the types of objects by specifying their interfaces An interface consists of a set of named operations and the parameters to those operations Note that although IDL provides the conceptual framework for describing the objects manipulated by the ORB it is not necessary for there to be IDL source code available for the ORB to work As long as the equivalent information is available in the form of stub routines or a run-time interface repository a particular ORB may be able to function correctly IDL is the means by which a particular object implementation tells its potential clients what operations are available and how they should be invoked From the IDL definitions it is possible to map CORBA objects into particular programming languages or object systems Different object-oriented or non-object-oriented programming languages may prefer to access CORBA objects in different ways For object-oriented languages it may be desirable to see CORBA objects as programming language objects Even for non-object-oriented languages it is a good idea to hide the exact ORB representation of the object reference method names etc A particular mapping of OMG IDL to a programming language should be the same for all ORB implementations Language mapping includes definition of the language-specific data types and procedure interfaces to access objects through the ORB It includes the structure of the client stub interface not required for object-oriented languages the dynamic invocation interface the implementation skeleton the object adapters and the direct ORB interface A language mapping also defines the interaction between object invocations and the threads of control in the client or implementation The most common mappings provide synchronous calls in that the routine returns when the object operation completes Additional mappings may be provided to allow a call to be initiated and control returned to the program In such cases additional language-specific routines must be provided to synchronize the program’s threads of control with the object invocation Generally the client stubs will present access to the OMG IDL-defined operations on an object in a way that is easy for programmers to predict once they are familiar with OMG IDL and the language mapping for the particular programming language The stubs make calls on the rest of the ORB using interfaces that are private to and presumably optimized for the particular ORB Core If more than one ORB is available there may be different stubs corresponding to the different ORBs In this case it is necessary for the ORB and language mapping to cooperate to associate the correct stubs with the particular object reference An interface is also available that allows the dynamic construction of object invocations that is rather than calling a stub routine that is specific to a particular operation on a particular object a client may specify the object to be invoked the operation to be performed and the set of parameters for the operation through a call or sequence of calls The client code must supply information about the operation to be performed and the types of the parameters being passed perhaps obtaining it from an Interface Repository or other run-time source The nature of the dynamic invocation interface may vary substantially from one programming language mapping to another For a particular language mapping and possibly depending on the object adapter there will be an interface to the methods that implement each type of object The interface will generally be an up-call interface in that the object implementation writes routines that conform to the interface and the ORB calls them through the skeleton The existence of a skeleton does not imply the existence of a corresponding client stub clients can also make requests via the dynamic invocation interface It is possible to write an object adapter that does not use skeletons to invoke implementation methods For example it may be possible to create implementations dynamically for languages such as Smalltalk An interface is available which allows dynamic handling of object invocations That is rather than being accessed through a skeleton that is specific to a particular operation an object’s implementation is reached through an interface that provides access to the operation name and parameters in a manner analogous to the client side’s Dynamic Invocation Interface Purely static knowledge of those parameters may be used or dynamic knowledge perhaps determined through an Interface Repository may be also used to determine the parameters The implementation code must provide descriptions of all the operation parameters to the ORB and the ORB provides the values of any input parameters for use in performing the operation The implementation code provides the values of any output parameters or an exception to the ORB after performing the operation The nature of the dynamic skeleton interface may vary substantially from one programming language mapping or object adapter to another but will typically be an up-call interface Dynamic skeletons may be invoked both through client stubs and through the dynamic invocation interface either style of client request construction interface provides identical results An object adapter is the primary way that an object implementation accesses services provided by the ORB There are expected to be a few object adapters that will be widely available with interfaces that are appropriate for specific kinds of objects Services provided by the ORB through an Object Adapter often include generation and interpretation of object references method invocation security of interactions object and implementation activation and deactivation mapping object references to implementations and registration of implementations The wide range of object granularities lifetimes policies implementation styles and other properties make it difficult for the ORB Core to provide a single interface that is convenient and efficient for all objects Thus through Object Adapters it is possible for the ORB to target particular groups of object implementations that have similar requirements with interfaces tailored to them The ORB Interface is the interface that goes directly to the ORB which is the same for all ORBs and does not depend on the object’s interface or object adapter Because most of the functionality of the ORB is provided through the object adapter stubs skeleton or dynamic invocation there are only a few operations that are common across all objects These operations are useful to both clients and implementations of objects The Interface Repository is a service that provides persistent objects that represent the IDL information in a form available at run-time The Interface Repository information may be used by the ORB to perform requests Moreover using the information in the Interface Repository it is possible for a program to encounter an object whose interface was not known when the program was compiled yet be able to determine what operations are valid on the object and make an invocation on it In addition to its role in the functioning of the ORB the Interface Repository is a common place to store additional information associated with interfaces to ORB objects For example debugging information libraries of stubs or skeletons routines that can format or browse particular kinds of objects might be associated with the Interface Repository The Implementation Repository contains information that allows the ORB to locate and activate implementations of objects Although most of the information in the Implementation Repository is specific to an ORB or operating environment the Implementation Repository is the conventional place for recording such information Ordinarily installation of implementations and control of policies related to the activation and execution of object implementations is done through operations on the Implementation Repository In addition to its role in the functioning of the ORB the Implementation Repository is a common place to store additional information associated with implementations of ORB objects For example debugging information administrative control resource allocation security etc might be associated with the Implementation Repository There are a wide variety of ORB implementations possible within the Common ORB Architecture This section will illustrate some of the different options Note that a particular ORB might support multiple options and protocols for communication If there is a suitable communication mechanism present an ORB can be implemented in routines resident in the clients and implementations The stubs in the client either use a location-transparent IPC mechanism or directly access a location service to establish communication with the implementations Code linked with the implementation is responsible for setting up appropriate databases for use by clients To centralize the management of the ORB all clients and implementations can communicate with one or more servers whose job it is to route requests from clients to implementations The ORB could be a normal program as far as the underlying operating system is concerned and normal IPC could be used to communicate with the ORB To enhance security robustness and performance the ORB could be provided as a basic service of the underlying operating system Object references could be made unforgeable reducing the expense of authentication on each request Because the operating system could know the location and structure of clients and implementations it would be possible for a variety of optimizations to be implemented for example avoiding marshalling when both are on the same machine For objects that are light-weight and whose implementations can be shared the implementation might actually be in a library In this case the stubs could be the actual methods This assumes that it is possible for a client program to get access to the data for the objects and that the implementation trusts the client not to damage the data If there is a suitable communication mechanism present an ORB can be implemented in routines resident in the clients and implementations The stubs in the client either use a location-transparent IPC mechanism or directly access a location service to establish communication with the implementations Code linked with the implementation is responsible for setting up appropriate databases for use by clients To centralize the management of the ORB all clients and implementations can communicate with one or more servers whose job it is to route requests from clients to implementations The ORB could be a normal program as far as the underlying operating system is concerned and normal IPC could be used to communicate with the ORB To enhance security robustness and performance the ORB could be provided as a basic service of the underlying operating system Object references could be made unforgeable reducing the expense of authentication on each request Because the operating system could know the location and structure of clients and implementations it would be possible for a variety of optimizations to be implemented for example avoiding marshalling when both are on the same machine For objects that are light-weight and whose implementations can be shared the implementation might actually be in a library In this case the stubs could be the actual methods This assumes that it is possible for a client program to get access to the data for the objects and that the implementation trusts the client not to damage the data A client of an object has an object reference that refers to that object An object reference is a token that may be invoked or passed as a parameter to an invocation on a different object Invocation of an object involves specifying the object to be invoked the operation to be performed and parameters to be given to the operation or returned from it The ORB manages the control transfer and data transfer to the object implementation and back to the client In the event that the ORB cannot complete the invocation an exception response is provided Ordinarily a client calls a routine in its program that performs the invocation and returns when the operation is complete Clients access object-type-specific stubs as library routines in their program see Figure 2-6 on page 2-13 The client program thus sees routines callable in the normal way in its programming language All implementations will provide a language-specific data type to use to refer to objects often an opaque pointer The client then passes that object reference to the stub routines to initiate an invocation The stubs have access to the object reference representation and interact with the ORB to perform the invocation See the C Language Mapping specification for additional general information on language mapping of object references Client Program Language-dependent object references ORB object references Dynamic Invocation Interface Stubs for Interface A Stubs for Interface B Figure 2-6 The Structure of a Typical Client An alternative set of library code is available to perform invocations on objects for example when the object was not defined at compile time In that case the client program provides additional information to name the type of the object and the method being invoked and performs a sequence of calls to specify the parameters and initiate the invocation Clients most commonly obtain object references by receiving them as output parameters from invocations on other objects for which they have references When a client is also an implementation it receives object references as input parameters on invocations to objects it implements An object reference can also be converted to a string that can be stored in files or preserved or communicated by different means and subsequently turned back into an object reference by the ORB that produced the string An object implementation provides the actual state and behavior of an object The object implementation can be structured in a variety of ways Besides defining the methods for the operations themselves an implementation will usually define procedures for activating and deactivating objects and will use other objects or non-object facilities to make the object state persistent to control access to the object as well as to implement the methods The object implementation see Figure 2-7 interacts with the ORB in a variety of ways to establish its identity to create new objects and to obtain ORB-dependent services It primarily does this via access to an Object Adapter which provides an interface to ORB services that is convenient for a particular style of object implementation Object Implementation ORB object references Methods for Interface A Library Routines Object data Skeleton for Interface A Object adapter routines Up-call to Method Dynamic Skeleton br Figure 2-7 The Structure of a Typical Object Implementation Because of the range of possible object implementations it is difficult to be definitive about how an object implementation is structured See the chapters on the Portable Object Adapter When an invocation occurs the ORB Core object adapter and skeleton arrange that a call is made to the appropriate method of the implementation A parameter to that method specifies the object being invoked which the method can use to locate the data for the object Additional parameters are supplied according to the skeleton definition When the method is complete it returns causing output parameters or exception results to be transmitted back to the client When a new object is created the ORB may be notified so that it knows where to find the implementation for that object Usually the implementation also registers itself as implementing objects of a particular interface and specifies how to start up the implementation if it is not already running Most object implementations provide their behavior using facilities in addition to the ORB and object adapter For example although the Portable Object Adapter provides some persistent data associated with an object its OID or Object ID that relatively small amount of data is typically used as an identifier for the actual object data stored in a storage service of the object implementation’s choosing With this structure it is not only possible for different object implementations to use the same storage service it is also possible for objects to choose the service that is most appropriate for them An object adapter see Figure 2-8 on page 2-16 is the primary means for an object implementation to access ORB services such as object reference generation An object adapter exports a public interface to the object implementation and a private interface to the skeleton It is built on a private ORB-dependent interface Object adapters are responsible for the following functions • Generation and interpretation of object references • Method invocation • Security of interactions • Object and implementation activation and deactivation • Mapping object references to the corresponding object implementations • Registration of implementations These functions are performed using the ORB Core and any additional components necessary Often an object adapter will maintain its own state to accomplish its tasks It may be possible for a particular object adapter to delegate one or more of its responsibilities to the Core upon which it is constructed Object Implementation Interface A Methods Interface B Methods Dynamic Skeleton Interface A Skeleton Interface B Skeleton ObjectAdapter Interface ORB Core Figure 2-8 The Structure of a Typical Object Adapter As shown in Figure 2-8 the Object Adapter is implicitly involved in invocation of the methods although the direct interface is through the skeletons For example the Object Adapter may be involved in activating the implementation or authenticating the request The Object Adapter defines most of the services from the ORB that the Object Implementation can depend on Different ORBs will provide different levels of service and different operating environments may provide some properties implicitly and require others to be added by the Object Adapter For example it is common for Object Implementations to want to store certain values in the object reference for easy identification of the object on an invocation If the Object Adapter allows the implementation to specify such values when a new object is created it may be able to store them in the object reference for those ORBs that permit it If the ORB Core does not provide this feature the Object Adapter would record the value in its own storage and provide it to the implementation on an invocation With Object Adapters it is possible for an Object Implementation to have access to a service whether or not it is implemented in the ORB Core—if the ORB Core provides it the adapter simply provides an interface to it if not the adapter must implement it on top of the ORB Core Every instance of a particular adapter must provide the same interface and service for all the ORBs it is implemented on It is also not necessary for all Object Adapters to provide the same interface or functionality Some Object Implementations have special requirements For example an object-oriented database system may wish to implicitly register its many thousands of objects without doing individual calls to the Object Adapter In such a case it would be impractical and unnecessary for the object adapter to maintain any per-object state By using an object adapter interface that is tuned towards such object implementations it is possible to take advantage of particular ORB Core details to provide the most effective access to the ORB There are a variety of possible object adapters however since the object adapter interface is something that object implementations depend on it is desirable that there be as few as practical Most object adapters are designed to cover a range of object implementations so only when an implementation requires radically different services or interfaces should a new object adapter be considered In this section we briefly describe the object adapter defined in this specification This specification defines a Portable Object Adapter that can be used for most ORB objects with conventional implementations See the Portable Object Adapter chapter for more information The intent of the POA as its name suggests is to provide an Object Adapter that can be used with multiple ORBs with a minimum of rewriting needed to deal with different vendors’ implementations This specification allows several ways of using servers but it does not deal with the administrative issues of starting server programs Once started however there can be a servant started and ended for a single method call a separate servant for each object or a shared servant for all instances of the object type It allows for groups of objects to be associated by means of being registered with different instances of the POA object and allows implementations to specify their own activation techniques If the implementation is not active when an invocation is performed the POA will start one The POA is specified in IDL so its mapping to languages is largely automatic following the language mapping rules The primary task left for a language mapping is the definition of the Servant type This specification defines a Portable Object Adapter that can be used for most ORB objects with conventional implementations See the Portable Object Adapter chapter for more information The intent of the POA as its name suggests is to provide an Object Adapter that can be used with multiple ORBs with a minimum of rewriting needed to deal with different vendors’ implementations This specification allows several ways of using servers but it does not deal with the administrative issues of starting server programs Once started however there can be a servant started and ended for a single method call a separate servant for each object or a shared servant for all instances of the object type It allows for groups of objects to be associated by means of being registered with different instances of the POA object and allows implementations to specify their own activation techniques If the implementation is not active when an invocation is performed the POA will start one The POA is specified in IDL so its mapping to languages is largely automatic following the language mapping rules The primary task left for a language mapping is the definition of the Servant type The Common ORB Architecture is designed to allow interoperation with a wide range of object systems see Figure 2-9 on page 2-18 Because there are many existing object systems a common desire will be to allow the objects in those systems to be accessible via the ORB For those object systems that are ORBs themselves they may be connected to other ORBs through the mechanisms described throughout this manual ORB Core Gateway Object system as another ORB interoperating via a gateway Portable Object Adapter Special-purpose Adapter Object system as a POA object implementation Object system as an implementation with a special-purpose object adapter Figure 2-9 Different Ways to Integrate Foreign Object Systems For object systems that simply want to map their objects into ORB objects and receive invocations through the ORB one approach is to have those object systems appear to be implementations of the corresponding ORB objects The object system would register its objects with the ORB and handle incoming requests and could act like a client and perform outgoing requests In some cases it will be impractical for another object system to act like a POA object implementation An object adapter could be designed for objects that are created in conjunction with the ORB and that are primarily invoked through the ORB Another object system may wish to create objects without consulting the ORB and might expect most invocations to occur within itself rather than through the ORB In such a case a more appropriate object adapter might allow objects to be implicitly registered when they are passed through the ORB This chapter describes OMG Interface Definition Language IDL semantics and gives the syntax for OMG IDL grammatical constructs Contents This chapter contains the following sections Section Title Page “Overview? 3-2 “Lexical Conventions? 3-3 “Preprocessing? 3-11 “OMG IDL Grammar? 3-12 “OMG IDL Specification? 3-18 “Import Declaration? 3-19 “Module Declaration? 3-20 “Interface Declaration? 3-21 “Value Declaration? 3-27 “Constant Declaration? 3-32 “Type Declaration? 3-36 “Exception Declaration? 3-49 “Operation Declaration? 3-50 “Attribute Declaration? 3-53 “Repository Identity Related Declarations? 3-55 Section Title Page “Event Declaration? 3-57 “Component Declaration? 3-58 “Home Declaration? 3-64 “CORBA Module? 3-66 “Names and Scoping? 3-67 The OMG Interface Definition Language IDL is the language used to describe the interfaces that client objects call and object implementations provide An interface definition written in OMG IDL completely defines the interface and fully specifies each operation’s parameters An OMG IDL interface provides the information needed to develop clients that use the interface’s operations Clients are not written in OMG IDL which is purely a descriptive language but in languages for which mappings from OMG IDL concepts have been defined The mapping of an OMG IDL concept to a client language construct will depend on the facilities available in the client language For example an OMG IDL exception might be mapped to a structure in a language that has no notion of exception or to an exception in a language that does The binding of OMG IDL concepts to several programming languages is described in this manual The description of OMG IDL’s lexical conventions is presented in Section 3 2 “Lexical Conventions ? on page 3-3 A description of OMG IDL preprocessing is presented in Section 3 3 “Preprocessing ? on page 3-11 The scope rules for identifiers in an OMG IDL specification are described in Section 3 20 “Names and Scoping ? on page 3-67 OMG IDL is a declarative language The grammar is presented in Section 3 4 “OMG IDL Grammar ? on page 3-12 and associated semantics is described in the rest of this chapter either in place or through references to other sections of this standard OMG IDL-specific pragmas those not defined for C++ may appear anywhere in a specification the textual location of these pragmas may be semantically constrained by a particular implementation A source file containing interface specifications written in OMG IDL must have an “ idl? extension The description of OMG IDL grammar uses a syntax notation that is similar to Extended Backus-Naur Format EBNF Table 3-1 lists the symbols used in this format and their meaning Table 3-1 IDL EBNF Symbol Meaning = Is defined to be | Alternatively Nonterminal “text? Literal * The preceding syntactic unit can be repeated zero or more times + The preceding syntactic unit can be repeated one or more times {} The enclosed syntactic units are grouped as a single syntactic unit [] The enclosed syntactic unit is optional—may occur zero or one time This section1 presents the lexical conventions of OMG IDL It defines tokens in an OMG IDL specification and describes comments identifiers keywords and literals—integer character and floating point constants and string literals An OMG IDL specification logically consists of one or more files A file is conceptually translated in several phases The first phase is preprocessing which performs file inclusion and macro substitution Preprocessing is controlled by directives introduced by lines having # as the first character other than white space The result of preprocessing is a sequence of tokens Such a sequence of tokens that is a file after preprocessing is called a translation unit OMG IDL uses the ASCII character set except for string literals and character literals which use the ISO Latin-1 8859 1 character set The ISO Latin-1 character set is divided into alphabetic characters letters digits graphic characters the space blank character and formatting characters Table 3-2 shows the ISO Latin-1 alphabetic characters upper and lower case equivalences are paired The ASCII alphabetic characters are shown in the left-hand column of Table 3-2 Table 3-2 The 114 Alphabetic Characters Letters Char Description Char Description Aa Upper Lower-case A Àà Upper Lower-case A with grave accent Bb Upper Lower-case B ?á Upper Lower-case A with acute accent Cc Upper Lower-case C Ââ Upper Lower-case A with circumflex accent Dd Upper Lower-case D Ãã Upper Lower-case A with tilde 1 This section is an adaptation of The Annotated C++ Reference Manual Chapter 2 it differs in the list of legal keywords and punctuation July 2002 CORBA v3 0 Lexical Conventions Table 3-2 The 114 Alphabetic Characters Letters Continued Char Description Char Description Ee Upper Lower-case E Ää Upper Lower-case A with diaeresis Ff Upper Lower-case F Åå Upper Lower-case A with ring above Gg Upper Lower-case G Ææ Upper Lower-case dipthong A with E Hh Upper Lower-case H Çç Upper Lower-case C with cedilla Ii Upper Lower-case I Èè Upper Lower-case E with grave accent Jj Upper Lower-case J Éé Upper Lower-case E with acute accent Kk Upper Lower-case K Êê Upper Lower-case E with circumflex accent Ll Upper Lower-case L Ëë Upper Lower-case E with diaeresis Mm Upper Lower-case M Ìì Upper Lower-case I with grave accent Nn Upper Lower-case N ?í Upper Lower-case I with acute accent Oo Upper Lower-case O Îî Upper Lower-case I with circumflex accent Pp Upper Lower-case P ?ï Upper Lower-case I with diaeresis Qq Upper Lower-case Q Ññ Upper Lower-case N with tilde Rr Upper Lower-case R Òò Upper Lower-case O with grave accent Ss Upper Lower-case S Óó Upper Lower-case O with acute accent Tt Upper Lower-case T Ôô Upper Lower-case O with circumflex accent Uu Upper Lower-case U Õõ Upper Lower-case O with tilde Vv Upper Lower-case V Öö Upper Lower-case O with diaeresis Ww Upper Lower-case W Øø Upper Lower-case O with oblique stroke Xx Upper Lower-case X Ùù Upper Lower-case U with grave accent Yy Upper Lower-case Y Úú Upper Lower-case U with acute accent Zz Upper Lower-case Z Ûû Upper Lower-case U with circumflex accent Üü Upper Lower-case U with diaeresis ß Lower-case German sharp S ÿ Lower-case Y with diaeresis Table 3-3 lists the decimal digit characters Table 3-3 Decimal Digits 0 1 2 3 4 5 6 7 8 9 Table 3-4 shows the graphic characters Table 3-4 The 65 Graphic Characters Char Description Char Description ! exclamation point ¡ inverted exclamation mark " double quote ¢ cent sign # number sign £ pound sign $ dollar sign ¤ currency sign % percent sign ¥ yen sign Table 3-4 The 65 Graphic Characters Continued Char Description Char Description & ampersand broken bar ’ apostrophe § section paragraph sign left parenthesis ¨ diaeresis right parenthesis © copyright sign * asterisk ª feminine ordinal indicator + plus sign « left angle quotation mark comma ¬ not sign - hyphen minus sign soft hyphen period full stop ® registered trade mark sign solidus ¯ macron colon ° ring above degree sign semicolon ± plus-minus sign < less-than sign 2 superscript two = equals sign 3 superscript three > greater-than sign ´ acute ? question mark m micro @ commercial at ¶ pilcrow [ left square bracket • middle dot \ reverse solidus ¸ cedilla ] right square bracket 1 superscript one ^ circumflex º masculine ordinal indicator low line underscore » right angle quotation mark ‘ grave vulgar fraction 1 4 { left curly bracket vulgar fraction 1 2 | vertical line vulgar fraction 3 4 } right curly bracket ¿ inverted question mark ~ tilde ¥ multiplication sign ³ division sign The formatting characters are shown in Table 3-5 Table 3-5 The Formatting Characters Description Abbreviation ISO 646 Octal Value alert BEL 007 backspace BS 010 horizontal tab HT 011 newline NL LF 012 vertical tab VT 013 Table 3-5 The Formatting Characters Description Abbreviation ISO 646 Octal Value form feed FF 014 carriage return CR 015 There are five kinds of tokens identifiers keywords literals operators and other separators Blanks horizontal and vertical tabs newlines formfeeds and comments collective “white space? as described below are ignored except as they serve to separate tokens Some white space is required to separate otherwise adjacent identifiers keywords and constants If the input stream has been parsed into tokens up to a given character the next token is taken to be the longest string of characters that could possibly constitute a token The characters * start a comment which terminates with the characters * These comments do not nest The characters start a comment which terminates at the end of the line on which they occur The comment characters * and * have no special meaning within a comment and are treated just like other characters Similarly the comment characters and * have no special meaning within a * comment Comments may contain alphabetic digit graphic space horizontal tab vertical tab form feed and newline characters An identifier is an arbitrarily long sequence of ASCII alphabetic digit and underscore “ ? characters The first character must be an ASCII alphabetic character All characters are significant When comparing two identifiers to see if they collide • Upper- and lower-case letters are treated as the same letter Table 3-2 on page 3-3 defines the equivalence mapping of upper- and lower-case letters • All characters are significant Identifiers that differ only in case collide and will yield a compilation error under certain circumstances An identifier for a given definition must be spelled identically e g with respect to case throughout a specification There is only one namespace for OMG IDL identifiers in each scope Using the same identifier for a constant and an interface for example produces a compilation error For example module M {typedef long Foo const long thing = 1 interface thing { error reuse of identifier void doit in Foo foo error Foo and foo collide and refer to different things readonly attribute long Attribute error Attribute collides with keyword attribute } } 3 2 3 1 Escaped Identifiers As IDL evolves new keywords that are added to the IDL language may inadvertently collide with identifiers used in existing IDL and programs that use that IDL Fixing these collisions will require not only the IDL to be modified but programming language code that depends upon that IDL will have to change as well The language mapping rules for the renamed IDL identifiers will cause the mapped identifier names e g method names to be changed To minimize the amount of work users may lexically “escape? identifiers by prepending an underscore to an identifier This is a purely lexical convention that ONLY turns off keyword checking The resulting identifier follows all the other rules for identifier processing For example the identifier AnIdentifier is treated as if it were AnIdentifier The following is a non-exclusive list of implications of these rules • The underscore does not appear in the Interface Repository • The underscore is not used in the DII and DSI • The underscore is not transmitted over “the wire ? • Case sensitivity rules are applied to the identifier after stripping off the leading underscore For example module M { interface thing { attribute boolean abstract error abstract collides with keyword abstract attribute boolean abstract ok abstract is an identifier } } To avoid unnecessary confusion for readers of IDL it is recommended that interfaces only use the escaped form of identifiers when the unescaped form clashes with a newly introduced IDL keyword It is also recommended that interface designers avoid defining new identifiers that are known to require escaping Escaped literals are only recommended for IDL that expresses legacy interface or for IDL that is mechanically generated The identifiers listed in Table 3-6 are reserved for use as keywords and may not be used otherwise unless escaped with a leading underscore Table 3-6 Keywords abstract exception inout provides truncatable any emits interface public typedef attribute enum local publishes typeid boolean eventtype long raises typeprefix case factory module readonly unsigned char FALSE multiple setraises union component finder native sequence uses const fixed Object short ValueBase consumes float octet string valuetype context getraises oneway struct void custom home out supports wchar default import primarykey switch wstring double in private TRUE Keywords must be written exactly as shown in the above list Identifiers that collide with keywords see Section 3 2 3 “Identifiers ? on page 3-6 are illegal For example “boolean? is a valid keyword “Boolean? and “BOOLEAN? are illegal identifiers For example module M { typedef Long Foo Error keyword is long not Long typedef boolean BOOLEAN Error BOOLEAN collides with the keyword boolean } OMG IDL specifications use the characters shown in Table 3-7 as punctuation Table 3-7 Punctuation Characters { } =+- <>[ ] ' "\ | ^&* %~ In addition the tokens listed in Table 3-8 are used by the preprocessor Table 3-8 Preprocessor Tokens # ## ! || && This section describes the following literals • Integer • Character • Floating-point • String • Fixed-point 3 2 5 1 Integer Literals An integer literal consisting of a sequence of digits is taken to be decimal base ten unless it begins with 0 digit zero A sequence of digits starting with 0 is taken to be an octal integer base eight The digits 8 and 9 are not octal digits A sequence of digits preceded by 0x or 0X is taken to be a hexadecimal integer base sixteen The hexadecimal digits include a or A through f or F with decimal values ten through fifteen respectively For example the number twelve can be written 12 014 or 0XC 3 2 5 2 Character Literals A character literal is one or more characters enclosed in single quotes as in ’x ’ Character literals have type char A character is an 8-bit quantity with a numerical value between 0 and 255 decimal The value of a space alphabetic digit or graphic character literal is the numerical value of the character as defined in the ISO Latin-1 8859 1 character set standard See Table 3-2 on page 3-3 Table 3-3 on page 3-4 and Table 3-4 on page 3-4 The value of a null is 0 The value of a formatting character literal is the numerical value of the character as defined in the ISO 646 standard see Table 3-5 on page 3-5 The meaning of all other characters is implementation-dependent Nongraphic characters must be represented using escape sequences as defined below in Table 3-9 Note that escape sequences must be used to represent single quote and backslash characters in character literals Table 3-9 Escape Sequences Table 3-9 Escape Sequences Continued Description Escape Sequence newline \n horizontal tab \t vertical tab \v backspace \b carriage return \r form feed \f alert \a backslash \\ question mark \? single quote \' double quote \" octal number \ooo Description Escape Sequence hexadecimal number \xhh unicode character \uhhhh If the character following a backslash is not one of those specified the behavior is undefined An escape sequence specifies a single character The escape \ooo consists of the backslash followed by one two or three octal digits that are taken to specify the value of the desired character The escape \xhh consists of the backslash followed by x followed by one or two hexadecimal digits that are taken to specify the value of the desired character The escape \uhhhh consists of a backslash followed by the character ‘u’ followed by one two three or four hexadecimal digits This represents a unicode character literal Thus the literal “\u002E? represents the unicode period ‘ ’ character and the literal “\u3BC? represents the unicode greek small letter ‘mu’ The \u escape is valid only with wchar and wstring types Because a wide string literal is defined as a sequence of wide character literals a sequence of \u literals can be used to define a wide string literal Attempts to set a char type to a \u defined literal or a string type to a sequence of \u literals result in an error A sequence of octal or hexadecimal digits is terminated by the first character that is not an octal digit or a hexadecimal digit respectively The value of a character constant is implementation dependent if it exceeds that of the largest char Wide character literals have an L prefix for example const wchar C1 = L'X' Attempts to assign a wide character literal to a non-wide character constant or to assign a non-wide character literal to a wide character constant result in a compile-time diagnostic Both wide and non-wide character literals must be specified using characters from the ISO 8859-1 character set 3 2 5 3 Floating-point Literals A floating-point literal consists of an integer part a decimal point a fraction part an e or E and an optionally signed integer exponent The integer and fraction parts both consist of a sequence of decimal base ten digits Either the integer part or the fraction part but not both may be missing either the decimal point or the letter e or E and the exponent but not both may be missing 3 2 5 4 String Literals A string literal is a sequence of characters as defined in Section 3 2 5 2 “Character Literals ? on page 3-9 with the exception of the character with numeric value 0 surrounded by double quotes as in “ ? Adjacent string literals are concatenated Characters in concatenated strings are kept distinct For example "\xA" "B" contains the two characters '\xA' and 'B' after concatenation and not the single hexadecimal character '\xAB' The size of a string literal is the number of character literals enclosed by the quotes after concatenation Within a string the double quote character " must be preceded by a \ A string literal may not contain the character ‘\0’ Wide string literals have an L prefix for example const wstring S1 = L"Hello" Attempts to assign a wide string literal to a non-wide string constant or to assign a non-wide string literal to a wide string constant result in a compile-time diagnostic Both wide and non-wide string literals must be specified using characters from the ISO 8859-1 character set A wide string literal shall not contain the wide character with value zero 3 2 5 5 Fixed-Point Literals A fixed-point decimal literal consists of an integer part a decimal point a fraction part and a d or D The integer and fraction parts both consist of a sequence of decimal base 10 digits Either the integer part or the fraction part but not both may be missing the decimal point but not the letter d or D may be missing OMG IDL is preprocessed according to the specification of the preprocessor in “International Organization for Standardization 1998 ISO IEC 14882 Standard for the C++ Programming Language Geneva International Organization for Standardization ? The preprocessor may be implemented as a separate process or built into the IDL compiler Lines beginning with # also called “directives? communicate with this preprocessor White space may appear before the # These lines have syntax independent of the rest of OMG IDL they may appear anywhere and have effects that last independent of the OMG IDL scoping rules until the end of the translation unit The textual location of OMG IDL-specific pragmas may be semantically constrained A preprocessing directive or any line may be continued on the next line in a source file by placing a backslash character “\? immediately before the newline at the end of the line to be continued The preprocessor effects the continuation by deleting the backslash and the newline before the input sequence is divided into tokens A backslash character may not be the last character in a source file A preprocessing token is an OMG IDL token see Section 3 2 1 “Tokens ? on page 3-6 a file name as in a #include directive or any single character other than white space that does not match another preprocessing token The primary use of the preprocessing facilities is to include definitions from other OMG IDL specifications Text in files included with a #include directive is treated as if it appeared in the including file except that RepositoryId related pragmas are handled in a special way The special handling of these pragmas is described in Section 10 7 “RepositoryIds ? on page 10-64 Note that whether a particular IDL compiler generates code for included files is an implementation-specific issue To support separate compilation IDL compilers may not generate code for included files or do so only if explicitly instructed 1 = * + 2 = “ ? | “ ? | “ ? | “ ? | “ ? | “ ? | “ ? | “ ? | “ ? | “ ? | “ ? 3 = “module? “{“ + “}? 4 = | 5 = “{? “}? 6 = [ “abstract? | “local? ] “interface? 7 = [ “abstract? | “local? ] “interface? [ ] 8 = * 9 = “ ? | “ ? | “ ? | “ ? | “ ? | “ ? | “ ? 10 =“ ? { “ ? }* 11 = 12 = | “ ? | “ ? 13 = | | | 14 = [ “abstract? ] “valuetype? 15 = “valuetype? 16 = “abstract? “valuetype? [ ] “{“ * “}? 17 = “{“ < value element>* “}? 18 = [“custom? ] “valuetype? [ ] 19 = [ “ ? [ “truncatable? ] { “ ? }* ] [ “supports? { “ ? }* ] 20 = 21 = | < state member> | 22 = “public? | “private? “ ? 23 = “factory? “ “ [ ] “ ? [ ] “ ? 24 = { “ ? }* 25 = 26 = “in? 27 = “const? “=? 28 = | | | | | | | | | 29 = 30 = | “|? 31 = | “^? 32 = | “&? 33 = | “>>? | “< 34 = | “+? | “-? 35 = | “*? | “ ? | “%? 36 = | 37 = “-? | “+? | “~? 38 = | | “ ? “ ? 39 = | | | | | | | 40 = “TRUE? | “FALSE? 41 = 42 = “typedef? | | | | “native? | 43 = 44 = | 45 = |