DispatchProxy class reference
[Base module]

Declaration

Description

This class may be used to dispatch operations to several underlying UserData objects.

This can be used to create a composite object where different operations are handled by different objects. Table operations are handled in a special way which enables to expose table entries from multiple objects as if all entries were merged in a single table object.

Order in which underlying objects are added to the dispatcher object matters. See operation functions documentation in this class for a detailed description of the associated behaviors.

Please read the Members detail section for details about behavior of different operations.

Members detail

DispatchProxy()

~DispatchProxy()

This function register a new target object which will be used to provide support for some operations. It returns the position of the new entry. The mask parameter can be used to prevent use of this object to provide support for some operations.

Template argument may be used to force use of operation functions from a specific class in the UserData inheritance tree. When this feature is used, a reimplementation of the UserData::meta_contains function must be available in the same class if either the UserData::meta_index function or the UserData::meta_newindex function is reimplemented.

This function handles the ValueBase::OpCall operation by relying on the first registered object which supports this operation and had this operation enabled when registered with the DispatchProxy::add_target function.

This function queries all registered object which support the ValueBase::OpIndex or ValueBase::OpNewindex operations and had one of these operations enabled when registered with the DispatchProxy::add_target function.

This function handles the ValueBase::OpIndex operation by querying all registered objects which support this operation and had this operation enabled when registered with the DispatchProxy::add_target function.

This function handles the ValueBase::OpNewindex operation by writing to the first registered object which supports this operation and had this operation enabled when registered with the DispatchProxy::add_target function.

If the new_keys argument to the DispatchProxy::add_target function was false on registration, the associated object is skipped if it does not already contains the passed key (according to object DispatchProxy::meta_contains function).

If a previous object contains an entry for the passed key but only supports the ValueBase::OpIndex table access operation and had this operation enabled when registered, an exception is thrown before the call to DispatchProxy::meta_newindex is forwarded. This avoids shadowing a table entry.

This function handles the requested operation by relying on the first registered object which supports the operation and had associated operations enabled when registered with the DispatchProxy::add_target function.

This function handles the ValueBase::OpIterate operation by relying on all registered objects which support this operation and had this operation enabled when registered with the DispatchProxy::add_target function. Iterators for underlying objects are created in registration order to expose all entries.