Register a handler called if any remote proxy tries to set the current field value.

notice

Note: The registered handler must provide the effective field value using asynchronous future / promise approach. The SetHandler is mandatory for fields with HAS-SETTER=true configuration.

Syntax

template <…>
auto amsr::socal::events::SkeletonField<…>::RegisterSetHandler(GetHandlerInterface set_handler) -> void

Parameters

in

set_handler

Handler function which is called with set() from the client.

The given handler must not be nullptr and must be valid as long as the service is offered.

Returns

void

notice

Note: Any exception thrown by the callback will lead to a termination through std::terminate().

Precondition

Thread-safety, Reentrance, Result Delivery

  • Threadsafe : FALSE for same class instance, TRUE for different instances
  • Reentrant : FALSE for same class instance, TRUE for different instances
  • Synchronous : TRUE

Example

ExampleApplicationField1.RegisterGetHandler([this]() {
    ara::core::Promise<service1::skeleton::fields::ExampleApplicationField1::FieldType> promise;
    promise.set_value(field1_value_);
    return promise.get_future();
});