Robot Raconteur Core C++ Library
|
callback
member type interface
More...
Inherits boost::noncopyable.
Inherited by RobotRaconteur::CallbackClient< T >, and RobotRaconteur::CallbackServer< T >.
Public Member Functions | |
virtual T | GetFunction ()=0 |
Get the currently configured callback function on client side. More... | |
virtual void | SetFunction (T value)=0 |
Set the callback function reference on the client side. More... | |
virtual T | GetClientFunction (const boost::shared_ptr< Endpoint > &endpoint)=0 |
Get the proxy function to call the callback for the specified client on the service side. More... | |
virtual T | GetClientFunction (uint32_t endpoint)=0 |
Get the proxy function to call the callback for the specified client on the service side. More... | |
virtual std::string | GetMemberName () |
Get the member name of the callback. More... | |
callback
member type interface
The Callback class implements the callback
member type. Callbacks are declared in service definition files using the callback
keyword within object declarations. They provide functionality similar to the function
member, but the direction is reversed, allowing the service to call a function on a specified client. The desired client is specified using the Robot Raconteur endpoint identifier. Clients must configure the callback to use using SetFunction().
On the client side, the client specifies a function for the callback using the SetFunction() function. On the service side, the function GetFunction(const RR_SHARED_PTR<Endpoint>& endpoint) is used to retrieve the proxy function to call a client callback.
This class is instantiated by the node. It should not be instantiated by the user.
T | The type of the callback function. This is determined by the thunk source generator. |
|
pure virtual |
Get the proxy function to call the callback for the specified client on the service side.
This function returns a proxy to the callback on a specified client. The proxy operates as a reverse function, sending parameters, executing the callback, and receiving the results.
Because services can have multiple clients, it is necessary to specify which client to call. This is done by passing the endpoint of the client connection to the endpoint parameter.
The endpoint of a client can be determined using the ServerEndpoint::CurrentEndpoint() function during a function
or property
member call. The service can store this value, and use it to retrieve the callback proxy.
endpoint | The endpoint of the client connection |
|
pure virtual |
Get the proxy function to call the callback for the specified client on the service side.
Same as GetClientFunction(const RR_SHARED_PTR<Endpoint>& endpoint), except the endpoint is specified using the uint32_t LocalEndpoint id instead of the Endpoint object.
endpoint | The uint32_t LocalEndpoint id |
|
pure virtual |
Get the currently configured callback function on client side.
|
inlinevirtual |
Get the member name of the callback.
|
pure virtual |
Set the callback function reference on the client side.
The callback function set will be made available to be called by the service using a function proxy.
Use lambda function or boost::bind to create the callback function reference
value | The callback function. |