IIIMCF has three sorts of task delegation system, (1) event forwarding; (2) event dispatchment; and (3) event broadcasting.
Event forwarding is processed by iiimcf_forward_event
.
This function sends a given event to IM service provider(s). IM service
provider may be IIIM server side or intermediate LWE(s) like PCE. IIIMCF
have to forward events to appropriate service provider(s) that deal with
the current input context. If any IM service provider(s) cannot deal with
the delegated task, iiimcf_forward_event
returns
IIIMF_STATUS_EVENT_NOT_FORWARDED
.
See Figure 1.
Event dispatchment is processed by iiimcf_dispatch_event
.
This function sends a given event to component(s) owned by the current component.
Normally, the component handler usually process the delegated task, then
return IIIMF_STATUS_SUCCESS
. If it does not process or fail
to deal with the task, the component handler should return
IIIMF_STATUS_COMPONENT_FAIL
.
Also each component can delegate the task to subcomponent(s) with
iiimcf_dispatch_event
. If all of the subcomponents
do not deal with the task (in this case, all subcomponents must return
IIIMF_STATUS_COMPONENT_INDIFFERENT
), or any of the
subcomponents returns IIIMF_STATUS_COMPONENT_FAIL
,
iiimcf_dispatch_event
fails and returns an error
status code other than IIIMCF_STATUS_SUCCESS
.
Of course, the component that fails to dispatch the event
can process the task by itself. If it do so, its component handler
should return IIIMF_STATUS_SUCCESS
. See
Figure 2.
Notice that IIIMCF does not process any events automatically. Therefore, users
have to dispatch or ignore incoming events obtained by
iiimcf_get_next_event
properly; otherwise, such events are
stored in the event queue of IIIMCF, that is, those events occupy memory
forever (c.f. the Section called IIIMCF object life-cycle).
Event broadcasting is only used for special purpose, and only that type of
event processing cannot be controlled by users. IIIMCF library deliver the event
to all components by compulsion. iiimcf_dispatch_event
is
completely ignored during event broadcasting. Even though a component fails to
process the event, event broadcasting will be succeeded.
Fortunately, event broadcasting is only used for an exceptional situation. Currently, IIIMCF broadcast an event only when a context is destroyed or the connection is shut down. That is, event broadcasting is used to convey the information that all components should process. For detail of connection shutdown, refer to the Section called connection shutdown