• No results found

The context internal interface is defined by the following rules:

1. For each component <component name>, a local context interface with the same name as the component, but with a prefix of ÒCCM_Ó and a postfix of

Ò_ContextÓ is defined.

2. If the component has a base component with a name of <base name>, the context interface inherits CCM_<base name>_Context. If the component does not have a base, the context interface inherits Components::CCMContext.

3. Additional operations are added to the context interface for receptacles and event sources.

The container will implement an interface that inherits both the above context interface and either Components::SessionContext or Components::EntityContext, depending on the type of the component. The component implementation can narrow the Components::SessionContext or Components::EntityContext reference that it receives to the above component-specific context interface.

3.3.3.4 Example

For the following component declaration in IDL, interface Hello {

void sayHello (); };

component HelloWorld supports Hello { attribute string message;

};

local interface CCM_Hello : Hello {

}

local interface CCM_HelloWorld_Executor : Components::EnterpriseComponent, Hello {

attribute string message; };

local interface CCM_HelloWorld :

Components::EnterpriseComponent, Hello {

attribute string message; };

local interface CCM_HelloWorld_Context : Components::CCMContext

{ };

Read on for further contents of these interfaces.

3.3.3.5 Ports

This section defines equivalent operations that are added to either of the three interfaces for each port definition.

Facets

For each facet, an equivalent operation is defined in the monolithic executor interface. For a facet of name <name> and type <type>, an operation with the same name as the facet but with a Òget_Ó prefix is generated. This operation has an empty parameter list and a reference of the interfaceÕs facet executor type as return value: CCM_<type> get_<name> ();

Users may optionally implement facet interfaces directly in the monolithic executor implementation by declaring a new local interface that inherits both the monolithic executor interface and the facet executor, and by then returning a reference to itself in the implementation of the above operation. Example:

// IDL

component MyComponent { provides MyInterface MyFacet; };

// User IDL

local interface MyComponentImpl :

CCM_MyComponent, CCM_MyInterface {}; // C++ CCM_MyInterface_ptr MyComponent_Impl::get_MyFacet () {

return CCM_MyInterface::_duplicate (this); }

If the locator strategy is used, the container calls the obtain_executor operation on the ExecutorLocator with the name parameter set to <name> in order to acquire a reference to the facet executor that matches this facet port.

Receptacles

For each receptacle, an equivalent operation is defined in the context interface. The signature of this operation depends on whether the receptacle is simplex or multiplex. For a simplex receptacle of name <name> and type <type>, an operation of the same name as the receptacle but with a Òget_connection_Ó prefix is generated. The operation has an empty parameter list, and an object reference of the interfaceÕs type as return value:

<type> get_connection_<name> ();

If there is no connection, this operation returns a nil reference.

For a multiplex receptacle of name <name> and type <type>, an operation of the same name as the receptacle but with a Òget_connections_Ó prefix is generated. The operation has an empty parameter list and a sequence of type

<name>Connections as return value (this type is defined by the client-side equivalent IDL):

<name>Connections get_connections_<name> ();

Publisher and Emitter

For each publisher and emitter port, an equivalent operation is defined in the context interface. For a publisher or emitter port of name <name> and type <type>, an operation of the same name as the port but with a Òpush_Ó prefix is generated. This operation has no return value and a single in parameter containing the event.

The component may call this operation in order to push an event to the consumer (for emitter ports) or to all subscribers (for publisher ports). The container is responsible for delivering the event.

Consumer

For each consumer port, an equivalent operation is defined in the monolithic executor interface. For a consumer port of name <name> and type <type>, an operation of the same name as the port but with a Òpush_Ó prefix is generated. This operation has no return value and a single in parameter containing the event.

void push_<name> (in <type> ev);

For component implementations that use the monolithic strategy, the container invokes this operation whenever a client sends an event to this sink.

For component implementations that use the locator strategy, the container calls the obtain_executor operation on the ExecutorLocator with the name parameter set to <name> in order to acquire a reference to an implementation of the eventtypeÕs consumer executor interface.

3.3.3.6 Home

For each home, three callback interfaces are generated, similar in structure to the interfaces defined on the client side. The three interfaces are named the Implicit, Explicit, and Main home executor.